dotfiles/waybar/scripts/power-menu.sh
2025-02-04 15:21:33 +00:00

31 lines
570 B
Bash
Executable File

#!/usr/bin/env bash
config="$HOME/.config/rofi/power-menu.rasi"
actions=$(echo -e " Lock\n Shutdown\n Reboot\n Suspend\n Hibernate\n Logout")
# Display logout menu
selected_option=$(echo -e "$actions" | rofi -dmenu -i -config "${config}" || pkill -x rofi)
# Perform actions based on the selected option
case "$selected_option" in
*Lock)
hyprlock
;;
*Shutdown)
systemctl poweroff
;;
*Reboot)
systemctl reboot
;;
*Suspend)
systemctl suspend
;;
*Hibernate)
systemctl hibernate
;;
*Logout)
hyprctl dispatch exit 0
;;
esac