1
0
Fork 0
dotfiles/.local/bin/sysact

19 lines
723 B
Plaintext
Raw Normal View History

2022-07-04 21:36:33 +02:00
#!/bin/sh
# A dmenu wrapper script for system functions.
case "$(readlink -f /sbin/init)" in
*systemd*) ctl='systemctl' ;;
*) ctl='loginctl' ;;
esac
case "$(printf " lock\nﴚ leave dwm\n累 renew dwm\nﭦ hibernate\n sleep\nﰇ reboot\n襤 shutdown\n display off" | dmenu -i -p 'Action: ')" in
' lock') xset s activate & gpg-connect-agent --no-autostart reloadagent /bye;;
2022-07-04 21:36:33 +02:00
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
# 'ﭦ hibernate') slock $ctl hibernate ;;
# ' sleep') slock $ctl suspend ;;
2022-07-04 21:36:33 +02:00
'ﰇ reboot') $ctl reboot ;;
'襤 shutdown') $ctl poweroff ;;
' display off') xset dpms force off ;;
*) exit 1 ;;
esac