diff options
| -rwxr-xr-x | .a/sys/lock.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/.a/sys/lock.sh b/.a/sys/lock.sh index 3ea9ca2..727b4af 100755 --- a/.a/sys/lock.sh +++ b/.a/sys/lock.sh @@ -17,6 +17,8 @@ before_locking () { # https://wiki.archlinux.org/title/Dunst#Disable_dunst_temporarily dunstctl set-paused true sleep 0.1 # Could fix notifications sometimes being shown https://github.com/dunst-project/dunst/issues/697#issuecomment-1045122705 + + touch /tmp/locksh-locked } before_suspend () { @@ -30,10 +32,14 @@ when_unlocked () { # Resets programs, in case resolution changes res ~/.fehbg # wallpaper res lead # hot corners, this is MageJohn's fork: https://github.com/MageJohn/lead + + rm /tmp/locksh-locked } when_unlocked_after_suspend () { gtk-launch picom # sometimes my compositor stops working after suspend, this makes sure it's running + + rm /tmp/locksh-slept } # ++==================================++ @@ -69,7 +75,7 @@ fi # || Lock if not locked already || # ++============================++ -if ! pgrep i3lock 1>&2; then +if ! [ -f /tmp/locksh-locked ]; then # The first line of i3lock arguments uses standard arguments, while the rest of the lines are i3lock-color ones # If you want to use i3lock, remove those lines (and the \ at the end) # But I highly advise you to use i3lock-color, it's amazing: https://github.com/Raymo111/i3lock-color @@ -80,7 +86,7 @@ if ! pgrep i3lock 1>&2; then --date-str='%d.%m.%Y' --verif-text='Verifying…' --wrong-text='Wrong!' --noinput-text='No Input!' \ --insidever-color d47408cc --ringver-color d47408 --insidewrong-color c35b5bcc --ringwrong-color c35b5b \ --layout-color ffeede --time-color ffeede --date-color ffeede --greeter-color ffeede --verif-color ffeede --wrong-color ffeede \ - ; when_unlocked && if [ -f '/tmp/slept' ]; then when_unlocked_after_suspend; rm /tmp/slept; fi + ; when_unlocked && [ -f '/tmp/locksh-slept' ] && when_unlocked_after_suspend ) & fi @@ -94,7 +100,7 @@ if [[ "$1" == 'suspend' ]]; then # A file is created to indicate that the system was suspended # After i3lock is done (unlocked), existence of this file is checked to determine if # script should run when_unlocked_after_suspend function - touch /tmp/slept + touch /tmp/locksh-slept # Wait for the lock screen to appear, before suspending # Without this, sometimes you could awaken the computer and see the desktop for a second, before the lock screen loads. |
