aboutsummaryrefslogtreecommitdiff
path: root/i3/bin/suspend-menu
diff options
context:
space:
mode:
Diffstat (limited to 'i3/bin/suspend-menu')
-rwxr-xr-xi3/bin/suspend-menu27
1 files changed, 27 insertions, 0 deletions
diff --git a/i3/bin/suspend-menu b/i3/bin/suspend-menu
new file mode 100755
index 0000000..7b8c802
--- /dev/null
+++ b/i3/bin/suspend-menu
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+print_options () {
+ cat <<EOF
+suspend
+reboot
+shutdown
+reload i3 configuration in-place
+restart i3
+exit i3
+EOF
+}
+
+# Colors from i3-nagbar: https://github.com/i3/i3/blob/a5da4d54f315e830e2a901b8e75ae7e478401c6e/i3-nagbar/main.c#L492-L496
+CHOICE="$(print_options | dmenu -i -fn 'DejaVu Sans' -nb '#900000' -nf white -sb '#680a0a' -sf white)"
+
+case "$CHOICE" in
+ suspend) systemctl suspend ;;
+ reboot) systemctl reboot ;;
+ shutdown) shutdown now ;;
+ "reload i3 configuration in-place") i3-msg reload ;;
+ "restart i3") i3-msg restart ;;
+ "exit i3") i3-msg exit ;;
+ *)
+ exit 1
+ ;;
+esac