Browse Source

Config: Actually lock the screen before going to sleep, using systemd

master
Riyyi 2 years ago
parent
commit
cf417d95b2
  1. 1
      .config/xorg/xinitrc
  2. 3
      .local/bin/wm/lock.sh
  3. 9
      README.org
  4. 1
      packages
  5. 19
      usr/lib/systemd/system/i3lock@.service

1
.config/xorg/xinitrc

@ -23,7 +23,6 @@ emacs --daemon &
thunar --daemon & thunar --daemon &
sxhkd "$XDG_CONFIG_HOME/sxhkd/$WM" & sxhkd "$XDG_CONFIG_HOME/sxhkd/$WM" &
xss-lock -- "$HOME/.local/bin/wm/lock.sh" &
/usr/lib/polkit-kde-authentication-agent-1 & /usr/lib/polkit-kde-authentication-agent-1 &

3
.local/bin/wm/lock.sh

@ -51,6 +51,7 @@ i3lock -n -i "$LOCK" -B 6 -S 1 -e \
--time-size=64 --date-size=24 \ --time-size=64 --date-size=24 \
--time-str="%I:%M %p" --date-str="%A, %B %e" \ --time-str="%I:%M %p" --date-str="%A, %B %e" \
--time-pos="ix:iy-250" --date-pos="ix:iy-200" \ --time-pos="ix:iy-250" --date-pos="ix:iy-200" \
--time-color=FFFFFFC0 --date-color=FFFFFFC0 --time-color=FFFFFFC0 --date-color=FFFFFFC0 \
--no-modkey-text
revert revert

9
README.org

@ -65,8 +65,8 @@ $ sudo EDITOR=vim visudo
Add user: Add user:
#+BEGIN_SRC shell-script #+BEGIN_SRC shell-script
$ useradd -m -G wheel -s /bin/bash <username> $ useradd -m -G wheel -s /bin/bash <user>
$ passwd <username> $ passwd <user>
#+END_SRC #+END_SRC
Pacman colors: Pacman colors:
@ -99,6 +99,11 @@ $ git config --global user.email "<email address>"
$ git config --global user.name "<name>" $ git config --global user.name "<name>"
#+END_SRC #+END_SRC
Lock before sleep:
#+BEGIN_SRC shell-script
$ sudo systemctl enable i3lock@<user>
#+END_SRC
Tlp: Tlp:
#+BEGIN_SRC shell-script #+BEGIN_SRC shell-script
$ systemctl enable tlp.service $ systemctl enable tlp.service

1
packages

@ -220,7 +220,6 @@ xorg-xinput
xorg-xprop xorg-xprop
xorg-xrandr xorg-xrandr
xorg-xsetroot xorg-xsetroot
xss-lock
yt-dlp yt-dlp
yt-dlp-drop-in yt-dlp-drop-in
zathura zathura

19
usr/lib/systemd/system/i3lock@.service

@ -0,0 +1,19 @@
# -*- conf -*-
[Unit]
Description=Lock the screen with i3lock
Before=sleep.target
[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
Environment=XDG_CACHE_HOME=/home/%I/.cache
ExecStart=/bin/setsid -f /home/%I/.local/bin/wm/lock.sh
ExecStartPost=/bin/sleep 1
[Install]
WantedBy=sleep.target
# Reference:
# https://wiki.archlinux.org/title/Power_management#Sleep_hooks
Loading…
Cancel
Save