#!/bin/bash dmenu_command=(wofi -dmenu -p "Power Menu" -i) # Define menu options and corresponding actions options=( "Lock" "Logout" "Shutdown" "Reboot" ) # Create associative array mapping text to actions declare -A actions actions["Lock"]="sleep 0.2 && hyprlock" actions["Logout"]="hyprctl dispatch exit" actions["Shutdown"]="systemctl poweroff" actions["Reboot"]="systemctl reboot" # Prompt user using wofi in dmenu mode choice=$(printf '%s\n' "${options[@]}" | "${dmenu_command[@]}") # Run the corresponding command if valid choice was made if [[ -n "$choice" && -n "${actions[$choice]}" ]]; then eval "${actions[$choice]}" fi