diff options
author | ben <ben@nagy.contact> | 2025-01-10 11:14:29 -0800 |
---|---|---|
committer | ben <ben@nagy.contact> | 2025-01-10 11:14:29 -0800 |
commit | fb4f206e21cc2853e904e8e548b3d4450b208c8d (patch) | |
tree | 92044e436174b598bbb831473412ee4382a05396 /scripts/util/power | |
parent | 7339a5dae5f48ba37d44094f8aaa9915695f86e5 (diff) |
added scriptsmain
Diffstat (limited to 'scripts/util/power')
-rwxr-xr-x | scripts/util/power | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/util/power b/scripts/util/power new file mode 100755 index 0000000..ce9a8f5 --- /dev/null +++ b/scripts/util/power @@ -0,0 +1,16 @@ +#!/bin/sh + + +case "$(readlink -f /sbin/init)" in + *systemd*) ctl='systemctl' ;; + *) ctl='loginctl' ;; +esac + +case "$(printf " reboot\n shutdown\n sleep\n lock\n kill dwm\n" | dmenu -i -p 'Action: ')" in + ' lock') slock ;; + ' leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;; + ' sleep') slock $ctl suspend ;; + ' reboot') /bin/reboot ;; + ' shutdown') /bin/shutdown -h now ;; + *) exit 1 ;; +esac |