[UPDATE][I3] Move Xautolock toggle to script

To allow notifications when toggling the state of Xautolock, the logic
has been moved to its own script.
This commit is contained in:
Bruno BELANYI 2020-01-27 14:55:52 +01:00
parent aeef0b0ca8
commit b5eb803f9d
2 changed files with 18 additions and 2 deletions

View file

@ -280,8 +280,8 @@ bindsym $mod+b mode "$mode_background"
set $mode_xautolock (e)nable (d)isable Xautolock
mode "$mode_xautolock" {
bindsym e exec --no-startup-id xautolock -enable, mode "default"
bindsym d exec --no-startup-id xautolock -disable, mode "default"
bindsym e exec --no-startup-id toggle-xautolock enable, mode "default"
bindsym d exec --no-startup-id toggle-xautolock disable, mode "default"
# Exit xautolock mode: "Enter" or "Escape" or $mod+x
bindsym Return mode "default"

16
scripts/toggle-xautolock Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
case "$1" in
enable|disable)
;;
*)
echo "Unkown command '$1'" >&2
echo "Usage: '$0 <enable|disable>'" >&2
exit 1
;;
esac
xautolock "-$1"
notify-send -u low "Toggled Xautolock (${1}d)" \
-h string:x-canonical-private-synchronous:xautolock-toggle # Override previous one