From 86f99da8d08e1f2e290d8ebfd5adb016faff7bac Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Sat, 24 Sep 2022 12:21:56 +0530 Subject: script's --- system_action | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 system_action (limited to 'system_action') 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 -- cgit v1.2.3-59-g8ed1b