2026-02-19 20:27:50 +01:00

34 lines
726 B
Bash
Executable File

#!/bin/bash
if pkill wofi; then
# If successful, exit the script/app
exit 0
fi
# Define options as a single string, separated by newlines
OPTIONS="Shutdown\nReboot\nSuspend\nHibernate\nLogout"
# Use wofi to present the options and get the user's choice
SELECTED=$(echo -e "$OPTIONS" | wofi -W 24% -H 26% -dmenu -s ~/.config/wofi/shutdown.css --prompt "Power Menu")
# Act on the user's choice
case "$SELECTED" in
"Shutdown")
shutdown now
;;
"Reboot")
reboot
;;
"Suspend")
systemctl suspend
;;
"Hibernate")
systemctl hibernate
;;
"Logout")
# This command is for Hyprland.
# If you use a different compositor, change this line.
hyprctl dispatch exit
;;
esac