From cf417d95b29e80baa1f062bc2dd504acc1d8f0cc Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 2 Sep 2022 15:52:56 +0200 Subject: [PATCH] Config: Actually lock the screen before going to sleep, using systemd --- .config/xorg/xinitrc | 1 - .local/bin/wm/lock.sh | 3 ++- README.org | 9 +++++++-- packages | 1 - usr/lib/systemd/system/i3lock@.service | 19 +++++++++++++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 usr/lib/systemd/system/i3lock@.service diff --git a/.config/xorg/xinitrc b/.config/xorg/xinitrc index 5b5aac7..a14f775 100644 --- a/.config/xorg/xinitrc +++ b/.config/xorg/xinitrc @@ -23,7 +23,6 @@ emacs --daemon & thunar --daemon & sxhkd "$XDG_CONFIG_HOME/sxhkd/$WM" & -xss-lock -- "$HOME/.local/bin/wm/lock.sh" & /usr/lib/polkit-kde-authentication-agent-1 & diff --git a/.local/bin/wm/lock.sh b/.local/bin/wm/lock.sh index 09cfd6f..2fed212 100755 --- a/.local/bin/wm/lock.sh +++ b/.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-str="%I:%M %p" --date-str="%A, %B %e" \ --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 diff --git a/README.org b/README.org index 123f283..51f8ca2 100644 --- a/README.org +++ b/README.org @@ -65,8 +65,8 @@ $ sudo EDITOR=vim visudo Add user: #+BEGIN_SRC shell-script -$ useradd -m -G wheel -s /bin/bash -$ passwd +$ useradd -m -G wheel -s /bin/bash +$ passwd #+END_SRC Pacman colors: @@ -99,6 +99,11 @@ $ git config --global user.email "" $ git config --global user.name "" #+END_SRC +Lock before sleep: +#+BEGIN_SRC shell-script +$ sudo systemctl enable i3lock@ +#+END_SRC + Tlp: #+BEGIN_SRC shell-script $ systemctl enable tlp.service diff --git a/packages b/packages index 4259674..b582e6c 100644 --- a/packages +++ b/packages @@ -220,7 +220,6 @@ xorg-xinput xorg-xprop xorg-xrandr xorg-xsetroot -xss-lock yt-dlp yt-dlp-drop-in zathura diff --git a/usr/lib/systemd/system/i3lock@.service b/usr/lib/systemd/system/i3lock@.service new file mode 100644 index 0000000..2d9bb90 --- /dev/null +++ b/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