From cc50dbb368c3c61f33366f398bf00544d12db813 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 27 May 2021 16:55:49 +0200 Subject: [PATCH] Implement a temporary popup window selection menu --- scripts/.local/share/scripts/popup-window | 25 +++++++++++++++++++++++ sway/.config/sway/config | 6 +++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100755 scripts/.local/share/scripts/popup-window diff --git a/scripts/.local/share/scripts/popup-window b/scripts/.local/share/scripts/popup-window new file mode 100755 index 0000000..240dc34 --- /dev/null +++ b/scripts/.local/share/scripts/popup-window @@ -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 diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 11d969d..e85ebed 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -247,7 +247,7 @@ exec_always { # Enable floating windows for_window [app_id="mpv"] 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 for_window [app_id="org.pwmt.zathura" workspace=$workspace4] resize set width 70 ppt # Split windows vertically @@ -281,8 +281,8 @@ bindsym Print exec grim bindsym Shift+Print exec slurp | grim -g - - | wl-copy # find PDFs with rofi bindsym $mod+f exec ~/.local/share/scripts/finder -# temporary floating htop -bindsym $mod+Shift+h exec kitty --class htop -- htop +# temporary popup window selection +bindsym $mod+Shift+h exec ~/.local/share/scripts/popup-window # power menu bindsym $mod+Shift+p mode "$Pause-break"