summaryrefslogtreecommitdiffstats
path: root/.local/bin/sysact
blob: a404257e6a547705b9dc439490d32dc84c4690b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# A dmenu wrapper script for system functions.

case "$(readlink -f /sbin/init)" in
	*runit-init) hib="sudo -A zzz" ;;
esac

cmds="\
🔒 lock		slock
🚪 leave dwm	kill -TERM $(pidof -s dwm)
♻ renew dwm	kill -HUP $(pidof -s dwm)
🐻 hibernate	${hib:-sudo -A systemctl suspend-then-hibernate}
🔃 reboot	sudo -A reboot
🖥 shutdown	sudo -A shutdown -h now"

choice="$(echo "$cmds" | cut -d'	' -f 1 | dmenu)" || exit 1

`echo "$cmds" | grep "^$choice	" | cut -d '	' -f2-`