#!/usr/bin/env sh rofi_command="rofi" # Buttons lock="󰌾 Lock" logout="󰿅 Log out" suspend="󰤄 Suspend" shutdown=" Power off" reboot="󰜉 Reboot" # countdown countdown() { for sec in $(seq $1 -1 1); do dunstify -t 1000 --replace=699 "Taking action in : $sec" sleep 1 done } # do actions dolock() { hyprlock } dologout() { countdown 3 hyprctl dispatch exit } dosuspend() { systemctl suspend } doshutdown() { countdown 3 hyprshutdown -t 'Shutting down...' --post-cmd 'systemctl shutdown' } doreboot() { countdown 3 hyprshutdown -t 'Restarting...' --post-cmd 'systemctl reboot' } # Variable passed to rofi options="$shutdown\n$reboot\n$suspend\n$lock\n$logout" chosen="$(echo -e "$options" | $rofi_command -p 'Power' -dmenu -selected-row 0)" case $chosen in $lock) dolock ;; $logout) dologout ;; $suspend) dosuspend ;; $shutdown) doshutdown ;; $reboot) doreboot ;; esac