diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-09-24 12:21:56 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-09-24 12:21:56 +0530 |
commit | 86f99da8d08e1f2e290d8ebfd5adb016faff7bac (patch) | |
tree | 8f121a2aaa187d8266e20df23ad36262ab051866 /system_action | |
download | bin-86f99da8d08e1f2e290d8ebfd5adb016faff7bac.tar.gz bin-86f99da8d08e1f2e290d8ebfd5adb016faff7bac.tar.bz2 bin-86f99da8d08e1f2e290d8ebfd5adb016faff7bac.zip |
script's
Diffstat (limited to 'system_action')
-rwxr-xr-x | system_action | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/system_action b/system_action new file mode 100755 index 0000000..32fe118 --- /dev/null +++ b/system_action @@ -0,0 +1,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 display off\n logout\n sleep\n reboot\n shutdown" | dmenu -i -p 'Action: ')" in + ' lock') slock ;; + ' display off') xset dpms force off ;; + ' logout') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;; + ' sleep') slock $ctl suspend ;; + ' reboot') $ctl reboot ;; + ' shutdown') $ctl poweroff ;; + *) exit 1 ;; +esac |