voidrice/.local/bin/sysact
Eike Flath 8e144b60ff
Specified shutdown time (0 seconds) for openrc shutdown option (#925)
If you don't specify it, it won't work:
$ sudo -A openrc-shutdown -p
 * openrc-shutdown: No shutdown time specified
2021-03-30 12:09:33 -04:00

22 lines
678 B
Bash
Executable file

#!/bin/sh
# A dmenu wrapper script for system functions.
# For non-systemd init systems.
case "$(readlink -f /sbin/init)" in
*runit*) hib="sudo -A zzz" ;;
*openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p 0" ;;
esac
cmds="\
🔒 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}
🔃 reboot ${reb:-sudo -A reboot}
🖥 shutdown ${shut:-sudo -A shutdown -h now}
📺 display off xset dpms force off"
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`