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
|
2020-10-22 18:27:50 +00:00
|
|
|
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
|
|
|
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
2020-11-14 20:16:13 +00:00
|
|
|
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
|
2020-05-06 18:34:33 +00:00
|
|
|
🔃 reboot ${reb:-sudo -A reboot}
|
2021-03-30 01:30:01 +00:00
|
|
|
🖥 shutdown ${shut:-sudo -A shutdown -h now}
|
|
|
|
📺 display off xset dpms force off"
|
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-02 16:47:20 +00:00
|
|
|
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`
|