diff options
| Commit | dce4fccf08255afaaa218e2e21e53e45e7e1c582 (patch) | |
|---|---|---|
| Author | 2025-03-28 19:44:31 +0200 | |
| Committer | 2025-03-28 19:44:31 +0200 | |
| Files | 8514b9290d3c44b728b287f574b64116a111b1ca /.scripts/lock | |
| .files-dce4fccf08255afaaa218e2e21e53e45e7e1c582.tar .files-dce4fccf08255afaaa218e2e21e53e45e7e1c582.tar.gz .files-dce4fccf08255afaaa218e2e21e53e45e7e1c582.zip | ||
| Parent | 6b71263670e0924294610b537f0ac17292ce2f19 (diff) | |
feat: Add scripts
1 files changed, 50 insertions, 0 deletions
| -rwxr-xr-x | .scripts/lock | 50 |
diff --git a/.scripts/lock b/.scripts/lock new file mode 100755 index 0000000..f2e1699 --- /dev/null +++ b/.scripts/lock @@ -0,0 +1,50 @@ +#!/bin/bash +# Suspend is managed by elogind +# Refer to ~/.b/etc/elogind/logind.conf +# ~/.b/etc/elogind/system-sleep/run-lock.sh + +# ++=================================++ +# || Actions before and after unlock || +# ++=================================++ + +before_locking () { + # Disables dunst, my notification daemon, so I don't see notification on lock screen + # https://github.com/dunst-project/dunst/issues/697 + # https://wiki.archlinux.org/title/Dunst#Disable_dunst_temporarily + dunstctl set-paused true + + touch ~/.tmp/locksh-locked +} + +before_suspend () { + # Keep track of time when machine is suspended, as well as how long it has been up for + uptime >> ~/.scripts/suspend-history +} + +when_unlocked () { + dunstctl set-paused false # Enables my notification daemon + + # Resets programs, in case resolution changes + ~/.fehbg # wallpaper + + rm ~/.tmp/locksh-locked +} + +# ++============================++ +# || Lock if not locked already || +# ++============================++ + +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 + before_locking && \ + i3lock -f -c d49408 -i ~/.scripts/lockscreen.png -n \ + -k --indicator --keylayout 1 --radius 95 --pass-volume-keys \ + --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 +else + echo "Not locking, lockfile exists!" +fi |
