#!/usr/bin/env bash # Power menu using rofi or wofi # Detect which one is available if command -v rofi &> /dev/null; then MENU="rofi -dmenu -i -p Power" elif command -v wofi &> /dev/null; then MENU="wofi --dmenu -i -p Power" else notify-send "Power Menu" "Neither rofi nor wofi is installed" exit 1 fi # Menu options OPTIONS="⏻ Shutdown\n⟳ Reboot\n⏾ Suspend\n Lock\n Logout" # Show menu and get choice CHOICE=$(echo -e "$OPTIONS" | $MENU) # Execute based on choice case $CHOICE in *Shutdown) systemctl poweroff ;; *Reboot) systemctl reboot ;; *Suspend) systemctl suspend ;; *Lock) # Try different lock commands if command -v swaylock &> /dev/null; then swaylock -f -c 000000 elif command -v gtklock &> /dev/null; then gtklock else notify-send "Lock" "No lock screen program found" fi ;; *Logout) swaymsg exit ;; esac