diff options
| Commit | 375d11b33142e971a82f28ddb4cc7d386e3551cf (patch) | |
|---|---|---|
| Author | 2026-11-01 17:50:07 +0200 | |
| Committer | 2026-11-01 17:50:07 +0200 | |
| Files | 85373ae415fcff7142ee1194594e8bb1e381176b /scripts/bin/lock | |
| .files-375d11b33142e971a82f28ddb4cc7d386e3551cf.tar .files-375d11b33142e971a82f28ddb4cc7d386e3551cf.tar.gz .files-375d11b33142e971a82f28ddb4cc7d386e3551cf.zip | ||
| Parent | e41b78ee956a6adcfc07b3c453f70198214ca599 (diff) | |
feat!: Rework how .files are managed
1 files changed, 51 insertions, 0 deletions
| -rwxr-xr-x | scripts/bin/lock | 51 |
diff --git a/scripts/bin/lock b/scripts/bin/lock new file mode 100755 index 0000000..e0f8365 --- /dev/null +++ b/scripts/bin/lock @@ -0,0 +1,51 @@ +#!/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 + echo "$(date) $(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 + [ "$1" == 'suspend' ] && before_suspend + # 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 |
