voidrice/.local/bin/sysact

23 lines
676 B
Text
Raw Normal View History

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 $(pgrep -u $USER "\bdwm$")
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
2020-05-06 18:34:33 +00:00
🔃 reboot ${reb:-sudo -A reboot}
🖥 shutdown ${shut:-sudo -A shutdown -h now}
📺 display off xset dpms force off"
2020-04-15 02:10:38 +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-`