blob: ae4b2ec7744b15f4c61eb967f6d13b30f17873a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/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 renew dwm\n sleep\n reboot\n shutdown\n display off" | dmenu -i -p 'Action: ')" in
' lock') slock ;;
' renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
' sleep') slock $ctl suspend -i ;;
' reboot') $ctl reboot ;;
' shutdown') $ctl poweroff ;;
' display off') xset dpms force off ;;
*) exit 1 ;;
esac
|