2020-04-14 22:10:38 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# A dmenu wrapper script for system functions.
|
|
|
|
|
2020-05-06 14:34:33 -04:00
|
|
|
# For non-systemd init systems.
|
2020-05-06 09:50:00 -04:00
|
|
|
case "$(readlink -f /sbin/init)" in
|
2020-05-06 14:34:33 -04:00
|
|
|
*runit*) hib="sudo -A zzz" ;;
|
|
|
|
*openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p" ;;
|
2020-05-06 09:50:00 -04:00
|
|
|
esac
|
|
|
|
|
2020-04-14 22:10:38 -04:00
|
|
|
cmds="\
|
2020-05-04 10:30:11 -04:00
|
|
|
🔒 lock slock
|
|
|
|
🚪 leave dwm kill -TERM $(pidof -s dwm)
|
|
|
|
♻ renew dwm kill -HUP $(pidof -s dwm)
|
2020-05-06 09:50:00 -04:00
|
|
|
🐻 hibernate ${hib:-sudo -A systemctl suspend-then-hibernate}
|
2020-05-06 14:34:33 -04:00
|
|
|
🔃 reboot ${reb:-sudo -A reboot}
|
|
|
|
🖥 shutdown ${shut:-sudo -A shutdown -h now}"
|
2020-04-14 22:10:38 -04:00
|
|
|
|
2020-04-28 14:50:57 +02:00
|
|
|
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
2020-04-14 22:10:38 -04:00
|
|
|
|
2020-06-02 12:47:20 -04:00
|
|
|
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`
|