summaryrefslogtreecommitdiff
path: root/sysact
blob: 977b9a649e1e5f404f28a5e009a15cc56c1afdb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

case "$(readlink -f /sbin/init)" in
	*systemd*) ctl='systemctl' ;;
	*) ctl='loginctl' ;;
esac

action="$(printf "Lock\nSleep\nReboot\nShutdown" | dmenu -i -c -l 4 -p 'Action:')"

case "$action" in
	"Lock") xset dpms force off && slock ;;
	"Sleep") slock $ctl suspend -i ;;
	"Reboot") $ctl reboot -i ;;
	"Shutdown") $ctl poweroff -i ;;
	*) exit ;;
esac