From 3d3fa8de9503d61d738c38b999d02ec715161713 Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Wed, 30 Nov 2022 03:35:35 -0500 Subject: [PATCH] new version of window_list.sh. Hopefully it works better than the previous version. It now uses window ID instead of title to set the focus. --- scripts/window_list.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/window_list.sh b/scripts/window_list.sh index 37b765b..fc837da 100755 --- a/scripts/window_list.sh +++ b/scripts/window_list.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash -select_window() { - local window="$(yad --list --column "Select Window" "$@")" - echo "${window%|}" -} +mapfile -t windowList < <(python3 -c ' +import i3ipc -i3-msg '[title="'$(i3-msg -t get_tree | jq -r "recurse(.nodes[]) | select(.window) | .name" | select_window)'"] focus' +i3 = i3ipc.Connection() -exit 0 +for con in i3.get_tree(): + if con.window and con.parent.type != "dockarea": + print(con.window) + print(con.name)') +id="$(yad --title "I38" --list --separator "" --column "id" --column "Select Window" --hide-column 1 --print-column 1 "${windowList[@]}")" +if [[ -z "${id}" ]]; then + exit 0 +fi +i3-msg \[id="${id}"\] focus