aboutsummaryrefslogtreecommitdiff
path: root/SystemdGraphicalSession/pwrdialog
diff options
context:
space:
mode:
Diffstat (limited to 'SystemdGraphicalSession/pwrdialog')
-rwxr-xr-xSystemdGraphicalSession/pwrdialog35
1 files changed, 35 insertions, 0 deletions
diff --git a/SystemdGraphicalSession/pwrdialog b/SystemdGraphicalSession/pwrdialog
new file mode 100755
index 0000000..4507e1a
--- /dev/null
+++ b/SystemdGraphicalSession/pwrdialog
@@ -0,0 +1,35 @@
+#!/bin/sh
+set -e
+choice=$(dialog \
+ --clear \
+ --erase-on-exit \
+ --stdout \
+ --backtitle $(hostname) \
+ --title "Power Options" \
+ --menu "Select an option:" 24 50 12 \
+ l "Lock" \
+ e "Logout" \
+ s "S3" \
+ r "Reboot" \
+ h "S5")
+case $choice in
+ l)
+ cmd="exec systemctl --user start i3lock"
+ ;;
+ e)
+ cmd="exec systemctl --user stop graphical-session.target"
+ ;;
+ s)
+ cmd="systemctl --user start i3lock && exec systemctl suspend"
+ ;;
+ r)
+ cmd="exec systemctl reboot"
+ ;;
+ h)
+ cmd="exec systemctl poweroff"
+ ;;
+ *)
+ cmd="exit 1"
+ ;;
+esac
+$cmd