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

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

action="$(printf "Screen off\nLock\nSleep\nReboot\nShutdown" | dmenu -i -c -l 5 -p 'Action:')"

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