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
show_power_menu() {
local menu_options=" Lock
󰤄 Sleep
󰜉 Restart
󰐥 Shutdown"
local menu_options="\u200B Lock
\u200C󰤄 Sleep
\u200D Relaunch
\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 210)
local selection=$(echo -e "$menu_options" | wofi --show dmenu --prompt "Power Options" --width 200 --height 250 -O alphabetical)
if [ -n "$selection" ]; then
case "$selection" in
"󰐥 Shutdown")
systemctl poweroff
;;
"󰜉 Restart")
systemctl reboot
;;
"󰤄 Sleep")
systemctl suspend
;;
" Lock")
hyprlock
;;
*) ;;
*Lock*) hyprlock ;;
*Sleep*) systemctl suspend ;;
*Relaunch*) hyprctl dispatch exit ;;
*Restart*) systemctl reboot ;;
*Shutdown*) systemctl poweroff ;;
esac
fi
}
# Main execution