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