Convert power menu into a rofi selection screen
This commit is contained in:
parent
9ddf5bc34e
commit
4f7afc811b
|
@ -0,0 +1,25 @@
|
||||||
|
#!/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_command() {
|
||||||
|
bash -c "$1" "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
execute_action() {
|
||||||
|
case "$1" in
|
||||||
|
"Shutdown") ~/.local/share/scripts/power-manager "poweroff" ;;
|
||||||
|
"Reboot") ~/.local/share/scripts/power-manager "reboot" ;;
|
||||||
|
"Suspend") execute_command "systemctl suspend -i" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
select_action "$@"
|
|
@ -286,17 +286,7 @@ bindsym $mod+p exec ~/.local/share/scripts/popup-window
|
||||||
# tmuxp session menu
|
# tmuxp session menu
|
||||||
bindsym $mod+Shift+s exec ~/.local/share/scripts/tmuxp-session
|
bindsym $mod+Shift+s exec ~/.local/share/scripts/tmuxp-session
|
||||||
# power menu
|
# power menu
|
||||||
bindsym $mod+Shift+p mode "$Pause-break"
|
bindsym $mod+Shift+p exec ~/.local/share/scripts/power-menu
|
||||||
|
|
||||||
set $Pause-break (p) poweroff, (r) reboot
|
|
||||||
|
|
||||||
mode "$Pause-break" {
|
|
||||||
bindsym s exec --no-startup-id ~/.local/share/scripts/power-manager "poweroff", mode "default"
|
|
||||||
bindsym r exec --no-startup-id ~/.local/share/scripts/power-manager "reboot", mode "default"
|
|
||||||
|
|
||||||
bindsym Return mode "default"
|
|
||||||
bindsym Escape mode "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
# theme switcher menu
|
# theme switcher menu
|
||||||
bindsym $mod+Shift+t mode "$Theme-switch"
|
bindsym $mod+Shift+t mode "$Theme-switch"
|
||||||
|
|
Loading…
Reference in New Issue