Fix up menu with sorting and a relaunch hyprland option

This commit is contained in:
David Heinemeier Hansson
2025-07-06 18:41:12 -07:00
parent 0f7d5744b9
commit e03c9fce07

View File

@ -5,31 +5,21 @@
# Function to show power menu # Function to show power menu
show_power_menu() { show_power_menu() {
local menu_options=" Lock local menu_options="\u200B Lock
󰤄 Sleep \u200C󰤄 Sleep
󰜉 Restart \u200D Relaunch
󰐥 Shutdown" \u2060󰜉 Restart
󰐥\u2063 Shutdown" # These first characters are invisible sort keys
# Show menu and get selection local selection=$(echo -e "$menu_options" | wofi --show dmenu --prompt "Power Options" --width 200 --height 250 -O alphabetical)
local selection=$(echo -e "$menu_options" | wofi --show dmenu --prompt "Power Options" --width 200 --height 210)
if [ -n "$selection" ]; then case "$selection" in
case "$selection" in *Lock*) hyprlock ;;
"󰐥 Shutdown") *Sleep*) systemctl suspend ;;
systemctl poweroff *Relaunch*) hyprctl dispatch exit ;;
;; *Restart*) systemctl reboot ;;
"󰜉 Restart") *Shutdown*) systemctl poweroff ;;
systemctl reboot esac
;;
"󰤄 Sleep")
systemctl suspend
;;
" Lock")
hyprlock
;;
*) ;;
esac
fi
} }
# Main execution # Main execution