fix: ignore trigger shortcuts if mission control is active
This commit is contained in:
1 parent
547311ea5d
commit
b03b0aa22e
2 files changed
+11
-1
No files matched your search
@@ -8,6 +8,15 @@ extension CGWindow {
|
||||
return CGWindowListCopyWindowInfo([.excludeDesktopElements, option], kCGNullWindowID) as! [CGWindow]
|
||||
}
|
||||
|
||||
static func isMissionControlActive() -> Bool {
|
||||
// when Mission Control is active, the Dock process spawns some windows. We observe this side-effect and infer
|
||||
for window in windows(.optionOnScreenOnly) {
|
||||
guard window.ownerName() == "Dock" else { continue }
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// workaround: filtering this criteria seems to remove non-windows UI elements
|
||||
func isNotMenubarOrOthers() -> Bool {
|
||||
return layer() == 0
|
||||
|
||||
@@ -82,7 +82,7 @@ class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
|
||||
if isFirstSummon {
|
||||
debugPrint("showUiOrCycleSelection: isFirstSummon")
|
||||
isFirstSummon = false
|
||||
if Windows.listRecentlyUsedFirst.count == 0 {
|
||||
if Windows.listRecentlyUsedFirst.count == 0 || CGWindow.isMissionControlActive() {
|
||||
appIsBeingUsed = false
|
||||
isFirstSummon = true
|
||||
return
|
||||
@@ -112,6 +112,7 @@ class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
|
||||
|
||||
func focusSelectedWindow(_ window: Window?) {
|
||||
hideUi()
|
||||
guard !CGWindow.isMissionControlActive() else { return }
|
||||
window?.focus()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user