Convert power menu into a rofi selection screen
This commit is contained in:
21
scripts/.local/share/scripts/power-menu
Executable file
21
scripts/.local/share/scripts/power-menu
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
select_action() {
|
||||
action_content=(
|
||||
"Shutdown"
|
||||
"Reboot"
|
||||
"Suspend"
|
||||
)
|
||||
action=$(printf '%s\n' "${action_content[@]}" | rofi -no-auto-select -i "$@" -dmenu -p "Choose an action")
|
||||
execute_action "$action"
|
||||
}
|
||||
|
||||
execute_action() {
|
||||
case "$1" in
|
||||
"Shutdown") ~/.local/share/scripts/power-manager "poweroff" ;;
|
||||
"Reboot") ~/.local/share/scripts/power-manager "reboot" ;;
|
||||
"Suspend") systemctl suspend -i ;;
|
||||
esac
|
||||
}
|
||||
|
||||
select_action "$@"
|
||||
Reference in New Issue
Block a user