Skip to content

Commit

Permalink
fix(focusindicator): Don't update for unmanaged windows that are invi…
Browse files Browse the repository at this point in the history
…sible
  • Loading branch information
imawizard committed Apr 22, 2024
1 parent 3968d89 commit b3bf740
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/miguru/miguru.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,23 @@ class MiguruWM extends WMEvents {
;; e.g. appear for the first time by unhiding instead of
;; creation, add new windows on any event.
window := this._manage(event, hwnd)

if !window {
;; A new explorer window actually seems to get focused while
;; still being invisible. So in case that same window is shown
;; later on it should be additionally focused.
if event == EV_WINDOW_FOCUSED
&& !WinExist("ahk_id" hwnd " ahk_group MIGURU_IGNORE") {
debug("Set active to non-managed {}", WinInfo(hwnd))

debug("Set maybe-active to non-managed {}", WinInfo(hwnd))
this._maybeActiveWindow := hwnd
this._focusIndicator.Unmanaged(hwnd)

;; Only update the focus indicator for non-managed windows
;; that are visible, though.
if DllCall("IsWindowVisible", "Ptr", hwnd, "Int")
|| !IsWindowCloaked(hwnd) {
this._focusIndicator.Unmanaged(hwnd)
}
}
return
}
Expand Down Expand Up @@ -342,7 +353,6 @@ class MiguruWM extends WMEvents {
PINNED_WINDOW_FOCUSED,
)
}

} else if event == EV_WINDOW_REPOSITIONED {
debug(() => ["Repositioned: D={} WS={} {}",
monitor.Index, ws.Index, WinInfo(hwnd)])
Expand Down

0 comments on commit b3bf740

Please sign in to comment.