dotfiles/.local/bin/power
Osaigbovo Omere 055e9c2e64
updated stuff
2026-09-29 04:38:11 +01:00

40 lines
877 B
Bash
Executable file

#!/usr/bin/env bash
# MENU ENTRIES
# define the string values for the power options
lock="lock"
suspend="suspend"
hibernate="hibernate"
logout="log out"
reboot="reboot"
shutdown="shutdown"
# USER INPUT
# pipe options into fuzzel and capture the string output
selected=$(printf "%s\n%s\n%s\n%s\n%s\n%s" "$lock" "$suspend" "$hibernate" "$logout" "$reboot" "$shutdown" | fuzzel --dmenu --prompt "power: ")
# EXECUTION ROUTING
# match the captured string to the system daemon command
case "$selected" in
"$lock")
swaylock -f -c 000000
;;
"$suspend")
loginctl suspend
;;
"$hibernate")
doas loginctl hibernate
;;
"$logout")
loginctl terminate-session "$XDG_SESSION_ID"
;;
"$reboot")
loginctl reboot
;;
"$shutdown")
loginctl shutdown
;;
*)
exit 0
;;
esac