fix: open alt-tab during space transitions (closes #92)

This commit is contained in:
louis.pontoise authored and lwouis committed 2020-03-10 14:00:37 +09:00
1 parent f8e1b00985
commit 141562de04
4 files changed
+13 -3

No files matched your search

+3
View File
@@ -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()
})
}
+2 -2
View File
@@ -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)
}
}
}
+7
View File
@@ -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)
+1 -1
View File
@@ -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)