Last active
September 27, 2024 07:56
-
-
Save advilm/f8d4ba12e34fae9090f3b47e8b0836a3 to your computer and use it in GitHub Desktop.
Revisions
-
advilm revised this gist
Feb 22, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ else fi # Set settings back to what they were before test -z "$old_mute" || amixer set Master unmute > /dev/null test "$old_dnd" = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false ``` Note: The xfconf-query do not disturb stuff is only for xfce-notifyd. -
advilm renamed this gist
Feb 22, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
advilm revised this gist
Feb 22, 2022 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ### scripts/lock.sh ```sh #!/bin/sh @@ -50,8 +50,7 @@ test "$old_dnd" = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s f ``` Note: The xfconf-query do not disturb stuff is only for xfce-notifyd. ### xss-lock command ``` xss-lock --transfer-sleep-lock -- ~/scripts/lock.sh ``` -
advilm revised this gist
Feb 22, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,6 +48,8 @@ fi test -z "$old_mute" || amixer set Master unmute > /dev/null test "$old_dnd" = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false ``` Note: The xfconf-query do not disturb stuff is only for xfce-notifyd. xss-lock command ``` -
advilm revised this gist
Feb 22, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ fi # Set settings back to what they were before test -z "$old_mute" || amixer set Master unmute > /dev/null test "$old_dnd" = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false ``` xss-lock command -
advilm renamed this gist
Feb 22, 2022 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ scripts/lock.sh ```sh #!/bin/sh scrot -o /tmp/screenshot.png @@ -46,6 +47,9 @@ fi # Set settings back to what they were before test -z "$old_mute" || amixer set Master unmute > /dev/null test $old_dnd = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false ``` xss-lock command ``` xss-lock --transfer-sleep-lock -- ~/scripts/lock.sh ``` -
advilm revised this gist
Feb 22, 2022 . 1 changed file with 38 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,45 +1,51 @@ # scripts/lock.sh #!/bin/sh scrot -o /tmp/screenshot.png convert /tmp/screenshot.png -blur 0x5 /tmp/screenshot.png # Turn on DND old_dnd="$(xfconf-query -c xfce4-notifyd -p /do-not-disturb)" xfconf-query -c xfce4-notifyd -p /do-not-disturb -s true # Pause stuff and mute audio playerctl -a pause > /dev/null old_mute="$(amixer get Master | tail -2 | grep '\[on\]')" amixer set Master mute > /dev/null # Waits for i3lock to die or valid fingerprint to kill i3lock wait_fingerprint() { while pidof i3lock > /dev/null; do if (timeout 5 fprintd-verify | grep -q verify-match); then pkill i3lock fi done } # Code taken from xss-lock transfer sleep lock example if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then kill_i3lock() { pkill -xu $EUID "$@" i3lock } trap kill_i3lock TERM INT # we have to make sure the locker does not inherit a copy of the lock fd i3lock -ui /tmp/screenshot.png {XSS_SLEEP_LOCK_FD}<&- # now close our fd (only remaining copy) to indicate we're ready to sleep exec {XSS_SLEEP_LOCK_FD}<&- wait_fingerprint else trap 'kill %%' TERM INT i3lock -nui /tmp/screenshot.png & wait_fingerprint fi # Set settings back to what they were before test -z "$old_mute" || amixer set Master unmute > /dev/null test $old_dnd = false && xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false # xss-lock command xss-lock --transfer-sleep-lock -- ~/scripts/lock.sh -
advilm revised this gist
Feb 22, 2022 . 1 changed file with 36 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,45 @@ # /etc/systemd/system/suspend.service [Unit] Description=Delay suspend until i3lock starts Before=sleep.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target [Service] Type=oneshot ExecStart=/bin/bash -c 'while ! pidof i3lock; do sleep 1; done' [Install] WantedBy=sleep.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target # scripts/lock.sh #!/bin/sh if ! pidof i3lock; then scrot -o /tmp/screenshot.png convert /tmp/screenshot.png -blur 0x5 /tmp/screenshot.png # Turn on DND old="$(xfconf-query -c xfce4-notifyd -p /do-not-disturb)" xfconf-query -c xfce4-notifyd -p /do-not-disturb -s true # Pause stuff and mute audio playerctl -a pause > /dev/null aold="$(amixer get Master | tail -2 | grep '\[on\]')" amixer set Master mute > /dev/null i3lock -ui /tmp/screenshot.png while pidof i3lock > /dev/null; do if (timeout 5 fprintd-verify | grep -q verify-match); then pkill i3lock fi done # Set settings back to what they were before if ! [ -z "$aold" ]; then amixer set Master unmute > /dev/null fi xfconf-query -c xfce4-notifyd -p /do-not-disturb -s $old fi # xss-lock command xss-lock -- ~/scripts/lock.sh -
advilm revised this gist
Feb 9, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # /etc/systemd/system/[email protected] [Unit] Description=Lock screen when waking up Before=sleep.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target -
advilm revised this gist
Feb 8, 2022 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,5 +14,9 @@ ExecStartPost=/usr/bin/sleep 1 WantedBy=sleep.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target # /etc/pam.d/i3lock auth sufficient pam_unix.so try_first_pass likeauth nullok auth sufficient pam_fprintd.so auth include system-auth # Note: even without the nullok it still requires you to press enter to use fingerprint # Not sure why -
advilm created this gist
Feb 8, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ # /etc/systemd/system/[email protected] [Unit] Description=Lock screen when waking up Before=sleep.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target [Service] User=%I Type=forking Environment=DISPLAY=:0 ExecStart=i3lock ExecStartPost=/usr/bin/sleep 1 [Install] WantedBy=sleep.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target # /etc/pam.d/i3lock auth sufficient pam_fprintd.so auth include system-auth