You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
637 B
22 lines
637 B
2 years ago
|
#!/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 $(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}"
|
||
|
|
||
|
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
||
|
|
||
|
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`
|