From 3015eb729a35edf68365cee48806fbe130243682 Mon Sep 17 00:00:00 2001 From: aclist Date: Wed, 10 May 2023 11:49:17 +0900 Subject: [PATCH] fix: harden client targeting function (#60) --- changelog.md | 4 ++++ dzgui.sh | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 5de74ac..2f46931 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,10 @@ - Custom query API - Standardize dialogs +## [3.3.0-rc.21] 2023-05-10 +### Fixed +- Hardening of beta client targeting function to avoid false positives + ## [3.3.0-rc.20] 2023-05-09 ### Changed - Use same WM_CLASS targeting method for beta and stable clients diff --git a/dzgui.sh b/dzgui.sh index f8632cc..7c12650 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -1032,13 +1032,14 @@ is_beta(){ fi } focus_beta_client(){ - until [[ -z $(wmctrl -lG | grep "Steam Games List") ]]; do - sleep 0.1s + wid(){ + wmctrl -ilx | awk 'tolower($3) == "steam.steam"' | grep 'Steam$' | awk '{print $1}' + } + until [[ -n $(wid) ]]; do + : done - until [[ -n $(wmctrl -lG | grep "Steam Games List") ]]; do - sleep 0.1s - done - wmctrl -a "Steam Games List" + wmctrl -ia $(wid) + sleep 0.1s wid=$(xdotool getactivewindow) local geo=$(xdotool getwindowgeometry $wid) local pos=$(<<< "$geo" awk 'NR==2 {print $2}' | sed 's/,/ /')