Skip to content

Commit

Permalink
fix: app launched while in fullscreen shows first window
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent 0c731f4 commit c5cbcdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions alt-tab-macos/logic/Applications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ class Applications {
static var list = [Application]()
static var appsObserver = RunningApplicationsObserver()

static func observeNewWindows() {
for app in list {
guard app.runningApplication.isFinishedLaunching else { continue }
app.observeNewWindows()
}
}

static func initialDiscovery() {
addInitialRunningApplications()
observeRunningApplications()
Expand All @@ -31,10 +38,7 @@ class Applications {
}
if windows.count > 0 {
CGSAddWindowsToSpaces(cgsMainConnectionId, windows as NSArray, [Spaces.currentSpaceId])
for app in list {
guard app.runningApplication.isFinishedLaunching else { continue }
app.observeNewWindows()
}
Applications.observeNewWindows()
Windows.sortByLevel()
CGSRemoveWindowsFromSpaces(cgsMainConnectionId, windows as NSArray, [Spaces.currentSpaceId])
return
Expand Down
1 change: 1 addition & 0 deletions alt-tab-macos/logic/Spaces.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Spaces {
static func observeSpaceChanges() {
NSWorkspace.shared.notificationCenter.addObserver(forName: NSWorkspace.activeSpaceDidChangeNotification, object: nil, queue: nil, using: { _ in
updateCurrentSpace()
Applications.observeNewWindows()
let app = App.shared as! App
guard app.appIsBeingUsed else { return }
app.reopenUi()
Expand Down

0 comments on commit c5cbcdb

Please sign in to comment.