From 53c439a418e50b8e68008df298695bc713c73dee Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Wed, 8 Oct 2025 08:05:47 -0400 Subject: [PATCH] fix: Fixes windowctl action picker to not focus on it's own window when the '--active' flag is passed. --- .../scripts/hypr/utils/windows/window-action-picker | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/env/.local/scripts/hypr/utils/windows/window-action-picker b/env/.local/scripts/hypr/utils/windows/window-action-picker index 1702d9b..73dc072 100755 --- a/env/.local/scripts/hypr/utils/windows/window-action-picker +++ b/env/.local/scripts/hypr/utils/windows/window-action-picker @@ -37,7 +37,16 @@ while [[ $# -gt 0 ]]; do if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then usage && exit 0 elif [[ $1 == "-a" ]] || [[ $1 == "--active" ]]; then - address=$(hyprctl activewindow -j | jq -r '.address') + + class=$(hyprctl activewindow -j | jq -r '.class') + if [[ $class == "com.ghostty.windowctl" ]]; then + # Select the previously focused window if we were launched in a new terminal window. + address=$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 1) | .address') + else + # Select the active address if not. + address=$(hyprctl activewindow -j | jq -r '.address') + fi + elif [[ $1 == "--show-back" ]]; then show_back_choice="1" else