voidrice/.local/bin/sysact
JameyBear f820ccf4dd
Shellcheck (#676)
Co-authored-by: WhispersOfJ <kaotiks@gmail.com>
2020-06-01 15:29:57 -04:00

21 lines
612 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" ;;
esac
cmds="\
🔒 lock slock
🚪 leave dwm kill -TERM $(pidof -s dwm)
♻ renew dwm kill -HUP $(pidof -s dwm)
🐻 hibernate ${hib:-sudo -A systemctl suspend-then-hibernate}
🔃 reboot ${reb:-sudo -A reboot}
🖥 shutdown ${shut:-sudo -A shutdown -h now}"
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-