fix: window order in the switcher might be incorrect (#5346)
This commit is contained in:
1 parent
3b1c7c76a9
commit
545d81d872
2 files changed
+9
-8
No files matched your search
@@ -321,8 +321,9 @@ class Window {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/// some apps will not trigger AXApplicationActivated, where we usually update application.focusedWindow
|
/// Scenarios addressed by this:
|
||||||
/// workaround: we check and possibly do it here
|
/// * Some apps will not trigger AXApplicationActivated, where we usually update application.focusedWindow
|
||||||
|
/// * Sometimes, we subscribe to an app after it has emitted the focusedWindow / applicationActivated events, so we never receive these
|
||||||
private func checkIfFocused() {
|
private func checkIfFocused() {
|
||||||
let app = application
|
let app = application
|
||||||
guard let appAxUiElement = app.axUiElement else { return }
|
guard let appAxUiElement = app.axUiElement else { return }
|
||||||
@@ -332,6 +333,9 @@ class Window {
|
|||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
guard let window = (Windows.list.first { $0.isEqualRobust(focusedWindow, focusedWid) }) else { return }
|
guard let window = (Windows.list.first { $0.isEqualRobust(focusedWindow, focusedWid) }) else { return }
|
||||||
app.focusedWindow = window
|
app.focusedWindow = window
|
||||||
|
if let windows = Windows.updateLastFocusOrder(window) {
|
||||||
|
App.refreshOpenUiAfterExternalEvent(windows)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,9 +243,8 @@ class Windows {
|
|||||||
hoveredWindowIndex = nil
|
hoveredWindowIndex = nil
|
||||||
TilesView.highlight(oldIndex)
|
TilesView.highlight(oldIndex)
|
||||||
}
|
}
|
||||||
if let frontmostPid = Applications.frontmostPid,
|
if Applications.frontmostPid != nil,
|
||||||
let frontmostApp = Applications.findOrCreate(frontmostPid, false),
|
Preferences.windowOrder[App.shortcutIndex] != .recentlyFocused,
|
||||||
(frontmostApp.focusedWindow == nil || Preferences.windowOrder[App.shortcutIndex] != .recentlyFocused),
|
|
||||||
let lastFocusedOrderWindowIndex = getLastFocusedOrderWindowIndex() {
|
let lastFocusedOrderWindowIndex = getLastFocusedOrderWindowIndex() {
|
||||||
updateSelectedAndHoveredWindowIndex(lastFocusedOrderWindowIndex)
|
updateSelectedAndHoveredWindowIndex(lastFocusedOrderWindowIndex)
|
||||||
} else {
|
} else {
|
||||||
@@ -511,9 +510,7 @@ class Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func appendWindow(_ window: Window) {
|
static func appendWindow(_ window: Window) {
|
||||||
list.forEach {
|
window.lastFocusOrder = list.count
|
||||||
$0.lastFocusOrder += 1
|
|
||||||
}
|
|
||||||
list.append(window)
|
list.append(window)
|
||||||
if list.count > TilesView.recycledViews.count {
|
if list.count > TilesView.recycledViews.count {
|
||||||
TilesView.recycledViews.append(TileView())
|
TilesView.recycledViews.append(TileView())
|
||||||
|
|||||||
Reference in new issue
Block a user