#!/bin/bash

# Power menu for Omarchy
# Provides power off, restart, and sleep options

# Function to show power menu
show_power_menu() {
  local menu_options="\u200B Lock (Super + Escape)
\u200C󰤄 Sleep (Shift + Super + Escape)
\u200D Relaunch (Alt + Super + Escape)
\u2060󰜉 Restart (Ctrl + Super + Escape)
󰐥\u2063 Shutdown (Ctrl + Shift + Super + Escape)" # These first characters are invisible sort keys

  local selection=$(echo -e "$menu_options" | wofi --show dmenu --prompt "Power Options" --width 500 --height 195 -O alphabetical --style ~/.local/share/omarchy/config/wofi/omarchy-power-menu.css)

  case "$selection" in
  *Lock*) hyprlock ;;
  *Sleep*) systemctl suspend ;;
  *Relaunch*) hyprctl dispatch exit ;;
  *Restart*) systemctl reboot ;;
  *Shutdown*) systemctl poweroff ;;
  esac
}

# Main execution
show_power_menu
