summaryrefslogtreecommitdiffstats
path: root/roles/hyprland/files/scripts
diff options
context:
space:
mode:
authorAhmed AbdelHalim <[email protected]>2026-02-22 23:31:46 +0100
committerAhmed AbdelHalim <[email protected]>2026-02-22 23:37:08 +0100
commit0b1ab11c41eebea2ba88c8c411abef9b4deead31 (patch)
tree2f61023fce1c0ab1a707f97845373b167a1169c0 /roles/hyprland/files/scripts
parentdc6121942bd6e070cc30f61678877acc5b720c6e (diff)
Configure power menu using tofi
Since it was almost impossible to change the spacing between the gum choose items, I used tofi instead, which is already themed and the only downside to it, is that it allows typing input on the menu which isn't my favorite but it's also not bad at all
Diffstat (limited to 'roles/hyprland/files/scripts')
-rwxr-xr-xroles/hyprland/files/scripts/power.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/hyprland/files/scripts/power.sh b/roles/hyprland/files/scripts/power.sh
new file mode 100755
index 00000000..77e37626
--- /dev/null
+++ b/roles/hyprland/files/scripts/power.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Use the commented styling to get tofi fullscreen theme instead of
+# using the hpyrland windowrule workaround to get the dimming effect
+ # --width 100% \
+ # --height 120% \
+ # --font-size 20 \
+ # --anchor center \
+ # --border-width 0 \
+ # --outline-width 0 \
+ # --padding-top 50% \
+ # --padding-left 42% \
+ # --result-spacing 10 \
+ # --placeholder-text "" \
+ # --prompt-text "Power:" \
+ # --background-color "#000B"
+ACTION=$(printf ' Shutdown\n󰑙 Reboot\n󰤄 Suspend' | tofi \
+ --width 450 \
+ --height 300 \
+ --font-size 20 \
+ --anchor center \
+ --prompt-text "Power:" \
+ --placeholder-text "" \
+ --result-spacing 10
+)
+
+
+case "$ACTION" in
+ *Shutdown*)
+ hyprctl dispatch exec hyprshutdown --no-fork -t "Shutting down..." --post-cmd "systemctl poweroff"
+ ;;
+ *Reboot*)
+ hyprctl dispatch exec hyprshutdown --no-fork -t "Restarting..." --post-cmd "systemctl reboot"
+ ;;
+ *Suspend*)
+ loginctl lock-session && systemctl suspend
+ ;;
+esac