aboutsummaryrefslogtreecommitdiff
path: root/i3/bin
diff options
context:
space:
mode:
authorCamil Staps2023-02-23 09:43:49 +0100
committerCamil Staps2023-02-23 09:43:49 +0100
commite5edac0a57f87db1fd9333e2b3b67bde6d388216 (patch)
tree5de44c10c056340d705e25fc0e7d95a03d5611fc /i3/bin
parentAdd note about suspend on yoga (diff)
Add suspend-menu; do not use i3-nagbar for shutdown confirmation
Diffstat (limited to 'i3/bin')
-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