Files
nixos/Droidnix/generated/.config/scripts/power.sh
T
2026-04-22 12:23:49 +02:00

49 lines
998 B
Bash
Executable File

#!/usr/bin/env bash
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
#
# Launch a power menu
#
# Requires fzf and systemd (loginctl, systemctl)
#
# Author: Jesse Mirabel <sejjymvm@gmail.com>
# Date: August 19, 2025
# License: MIT
main() {
local list=(
"󰌾 Lock"
"󰐥 Shutdown"
"󰑙 Reboot"
"󰍃 Logout"
"󰒲 Hibernate"
"󰤄 Suspend"
)
local options=(
"--border=sharp"
"--border-label= Power Menu "
"--cycle"
"--ghost=Search"
"--height=~100%"
"--highlight-line"
"--info=inline-right"
"--pointer="
"--reverse"
)
local selected
selected=$(printf "%s\n" "${list[@]}" | fzf "${options[@]}")
case $selected in
Lock) loginctl lock-session ;;
Shutdown) systemctl poweroff ;;
Reboot) systemctl reboot ;;
Logout) loginctl terminate-session "$XDG_SESSION_ID" ;;
Hibernate) systemctl hibernate ;;
Suspend) systemctl suspend ;;
*) return 1 ;;
esac
}
main