summaryrefslogtreecommitdiff
path: root/sysact
diff options
context:
space:
mode:
authortsxv478 <vt0451@yandex.ru>2022-11-23 07:25:02 +0300
committertsxv478 <vt0451@yandex.ru>2022-11-23 07:25:02 +0300
commit2e3cd5a7a52f08f45e768a777ce2d488b2bed81b (patch)
tree7b6256a69e5843e4178e5e70854fe9a4121e696c /sysact
parentb4bb66c47323ee531473d3176a807bd1a2aa7ac5 (diff)
sysact script
Diffstat (limited to 'sysact')
-rwxr-xr-xsysact16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysact b/sysact
new file mode 100755
index 0000000..977b9a6
--- /dev/null
+++ b/sysact
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+case "$(readlink -f /sbin/init)" in
+ *systemd*) ctl='systemctl' ;;
+ *) ctl='loginctl' ;;
+esac
+
+action="$(printf "Lock\nSleep\nReboot\nShutdown" | dmenu -i -c -l 4 -p 'Action:')"
+
+case "$action" in
+ "Lock") xset dpms force off && slock ;;
+ "Sleep") slock $ctl suspend -i ;;
+ "Reboot") $ctl reboot -i ;;
+ "Shutdown") $ctl poweroff -i ;;
+ *) exit ;;
+esac