summaryrefslogtreecommitdiff
path: root/.local/bin/sysact
blob: b07e1c91bd292b2a36e3a001b7d5a73d1e3b2b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/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󰑙 reboot\n󰤆 shutdown\n󰇄 display off" | dmenu -i -p 'Action: ')" in
	'󰌾 lock') slock ;;
	'󰑐 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
	'󰑙 reboot') $ctl reboot ;;
	'󰤆 shutdown') $ctl poweroff ;;
	'󰇄 display off') xset dpms force off ;;
	*) exit 1 ;;
esac