diff --git a/alt-tab-macos/logic/Spaces.swift b/alt-tab-macos/logic/Spaces.swift index 05a31988..155d21a4 100644 --- a/alt-tab-macos/logic/Spaces.swift +++ b/alt-tab-macos/logic/Spaces.swift @@ -10,6 +10,9 @@ class Spaces { static func observeSpaceChanges() { NSWorkspace.shared.notificationCenter.addObserver(forName: NSWorkspace.activeSpaceDidChangeNotification, object: nil, queue: nil, using: { _ in updateCurrentSpace() + let app = App.shared as! App + guard app.appIsBeingUsed else { return } + app.reopenUi() }) } diff --git a/alt-tab-macos/logic/SystemPermissions.swift b/alt-tab-macos/logic/SystemPermissions.swift index 6e716cae..5e9c715f 100644 --- a/alt-tab-macos/logic/SystemPermissions.swift +++ b/alt-tab-macos/logic/SystemPermissions.swift @@ -10,7 +10,7 @@ class SystemPermissions { "Please authorize and re-launch.", "See https://help.rescuetime.com/article/59-how-do-i-enable-accessibility-permissions-on-mac-osx", separator: "\n") - NSApp.terminate(self) + App.shared.terminate(self) } } @@ -22,7 +22,7 @@ class SystemPermissions { "Please authorize and re-launch.", "See https://dropshare.zendesk.com/hc/en-us/articles/360033453434-Enabling-Screen-Recording-Permission-on-macOS-Catalina-10-15-", separator: "\n") - NSApp.terminate(self) + App.shared.terminate(self) } } } diff --git a/alt-tab-macos/ui/App.swift b/alt-tab-macos/ui/App.swift index 0132b66b..b42e44c4 100644 --- a/alt-tab-macos/ui/App.swift +++ b/alt-tab-macos/ui/App.swift @@ -100,6 +100,13 @@ class App: NSApplication, NSApplicationDelegate, NSWindowDelegate { } } + func reopenUi() { + thumbnailsPanel!.orderOut(nil) + Windows.refreshAllThumbnails() + refreshOpenUi() + thumbnailsPanel!.show() + } + func refreshOpenUi() { guard appIsBeingUsed else { return } let currentScreen = Screen.preferred() // fix screen between steps since it could change (e.g. mouse moved to another screen) diff --git a/alt-tab-macos/ui/PreferencesWindow.swift b/alt-tab-macos/ui/PreferencesWindow.swift index 261290b0..bd7aa401 100644 --- a/alt-tab-macos/ui/PreferencesWindow.swift +++ b/alt-tab-macos/ui/PreferencesWindow.swift @@ -208,7 +208,7 @@ class PreferencesWindow: NSWindow, NSWindowDelegate { throw NSError.make(domain: "Preferences", message: "Please enter a valid value for '" + key + "'") } try Preferences.updateAndValidateFromString(key, newValue) - (NSApp as! App).initPreferencesDependentComponents() + (App.shared as! App).initPreferencesDependentComponents() try Preferences.saveRawToDisk() } catch let error { debugPrint("PreferencesWindow: save: error", key, newValue, error)