Implement a temporary popup window selection menu

This commit is contained in:
coolneng 2021-05-27 16:55:49 +02:00
parent 7e9301983d
commit 1ec54bccfc
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
select_action() {
action_content=(
"System resources usage"
"Connectivity test"
"Kill emacs"
)
action=$(printf '%s\n' "${action_content[@]}" | rofi -no-auto-select -i "$@" -dmenu -p "Choose an action")
execute_action "$action"
}
launch_kitty() {
bash -c "kitty --class popup -- $1"
}
execute_action() {
case "$1" in
"System resources usage") launch_kitty "htop" ;;
"Connectivity test") launch_kitty "ping -c 2 freebsd.org" ;;
"Kill emacs") launch_kitty "pkill emacs" ;;
esac
}
select_action "$@"

View File

@ -247,7 +247,7 @@ exec_always {
# Enable floating windows # Enable floating windows
for_window [app_id="mpv"] floating enable for_window [app_id="mpv"] floating enable
for_window [app_id="imv"] floating enable for_window [app_id="imv"] floating enable
for_window [app_id="htop"] floating enable, resize set 1280 720 for_window [app_id="popup"] floating enable, resize set 1280 720
# Resize zathura to 70% in tiling mode # Resize zathura to 70% in tiling mode
for_window [app_id="org.pwmt.zathura" workspace=$workspace4] resize set width 70 ppt for_window [app_id="org.pwmt.zathura" workspace=$workspace4] resize set width 70 ppt
# Split windows vertically # Split windows vertically
@ -281,8 +281,8 @@ bindsym Print exec grim
bindsym Shift+Print exec slurp | grim -g - - | wl-copy bindsym Shift+Print exec slurp | grim -g - - | wl-copy
# find PDFs with rofi # find PDFs with rofi
bindsym $mod+f exec ~/.local/share/scripts/finder bindsym $mod+f exec ~/.local/share/scripts/finder
# temporary floating htop # temporary popup window selection
bindsym $mod+Shift+h exec kitty --class htop -- htop bindsym $mod+p exec ~/.local/share/scripts/popup-window
# power menu # power menu
bindsym $mod+Shift+p mode "$Pause-break" bindsym $mod+Shift+p mode "$Pause-break"