Commit Diff


commit - 15ad92fa0b00e5f79d4eea1951db5385506e1219
commit + 89906091882875b0a67ffd3bbfa99b5368f06ec8
blob - c271eaccc431aaa10d35c5f8336584de57147ea5
blob + 2163e8bd6a6f0d40264e255df916c5fe7c8b3644
--- scripts/dmenu_power
+++ scripts/dmenu_power
@@ -1,14 +1,19 @@
 #!/bin/sh
 
-case "$(printf 'Lock\nSuspend\nShutdown\nReboot\nHibernate\n' | dmenu -l 5 "$@")" in
-Lock)
+lock() {
 	if pgrep xidle > /dev/null; then
 		pkill -USR1 xidle
 	else
 		slock
 	fi
+}
+
+case "$(printf 'Lock\nSuspend\nShutdown\nReboot\nHibernate\n' | dmenu -l 5 "$@")" in
+Lock)
+	lock
 	;;
 Suspend)
+	lock
 	case "$(uname)" in
 	OpenBSD|FreeBSD)
 		doas zzz
@@ -25,6 +30,7 @@ Reboot)
 	doas reboot
 	;;
 Hibernate)
+	lock
 	case "$(uname)" in
 	OpenBSD)
 		ZZZ