summaryrefslogtreecommitdiff
path: root/sysact
blob: 245eabb2264a4e04e3ed8ccb9eb92d5f00bc9af6 (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