summaryrefslogtreecommitdiffstats
path: root/.local/bin/system_action
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2025-02-13 14:13:49 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2025-02-13 14:13:49 +0530
commit8a2e1006b3b272126332aa064f3ad95387129544 (patch)
tree944c80ac612a65980d94a54ba11b6c7102037ecf /.local/bin/system_action
parentdcbb16d8b08ff5956abef5e6478b59df2e93ad35 (diff)
downloaddotfiles-8a2e1006b3b272126332aa064f3ad95387129544.tar.gz
dotfiles-8a2e1006b3b272126332aa064f3ad95387129544.tar.bz2
dotfiles-8a2e1006b3b272126332aa064f3ad95387129544.zip
new dot filesHEADmaster
Diffstat (limited to '.local/bin/system_action')
-rwxr-xr-x.local/bin/system_action16
1 files changed, 16 insertions, 0 deletions
diff --git a/.local/bin/system_action b/.local/bin/system_action
new file mode 100755
index 0000000..32fe118
--- /dev/null
+++ b/.local/bin/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