diff options
| author | tslil clingman <tslil@posteo.net> | 2022-01-29 14:24:11 -0500 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.net> | 2022-01-29 14:24:11 -0500 |
| commit | 0b4aa5db57f3572feb97cadc61db3f69665989c8 (patch) | |
| tree | 5d075001883f31593980b1e38999efadd3496d5e /sway/sway_autolock | |
| parent | 20c46801b996da5480c8270e86b3ca9c1943621d (diff) | |
Hotkey to toggle autolocking
Diffstat (limited to 'sway/sway_autolock')
| -rwxr-xr-x | sway/sway_autolock | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/sway_autolock b/sway/sway_autolock new file mode 100755 index 0000000..9168249 --- /dev/null +++ b/sway/sway_autolock @@ -0,0 +1,12 @@ +#!/bin/sh + +pid="$(pgrep swayidle)" +if [ -z "$pid" ]; then + swayidle -w timeout 300 'swaylock -f -c 000000' \ + timeout 300 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' & + notify-send --app-name "Autolock" "Enabled" +else + kill -9 "$pid" + notify-send --app-name "Autolock" "DISABLED" +fi |
