feat: improve performance and order accuracy at launch
This commit is contained in:
1 parent
9156ad915a
commit
fc6d63603a
3 files changed
+9
-8
No files matched your search
@@ -40,7 +40,3 @@ extension CGWindowID {
|
||||
return value as? T
|
||||
}
|
||||
}
|
||||
|
||||
//class Testt {
|
||||
// static var sampleCgImage: CGImage? = nil
|
||||
//}
|
||||
@@ -30,7 +30,9 @@ class Applications {
|
||||
|
||||
static func addInitialRunningApplicationsWindows() {
|
||||
let otherSpaces = Spaces.otherSpaces()
|
||||
if otherSpaces.count > 0 {
|
||||
// the CGSAddWindowsToSpaces trick stopped working starting with macOS 12.2
|
||||
// see https://github.com/lwouis/alt-tab-macos/issues/1324
|
||||
if otherSpaces.count > 0, #unavailable(macOS 12.2) {
|
||||
let windowsOnCurrentSpace = Spaces.windowsInSpaces([Spaces.currentSpaceId])
|
||||
let windowsOnOtherSpaces = Spaces.windowsInSpaces(otherSpaces)
|
||||
let windowsOnlyOnOtherSpaces = Array(Set(windowsOnOtherSpaces).subtracting(windowsOnCurrentSpace))
|
||||
@@ -41,7 +43,7 @@ class Applications {
|
||||
CGSRemoveWindowsFromSpaces(cgsMainConnectionId, windowsOnlyOnOtherSpaces as NSArray, [Spaces.currentSpaceId])
|
||||
}
|
||||
} else {
|
||||
Applications.manuallyUpdateWindowsFor2s()
|
||||
Applications.manuallyUpdateWindows()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -24,6 +24,7 @@ class App: AppCenterApplication, NSApplicationDelegate {
|
||||
var feedbackWindow: FeedbackWindow!
|
||||
var permissionsWindow: PermissionsWindow!
|
||||
var isFirstSummon = true
|
||||
var isVeryFirstSummon = true
|
||||
var appIsBeingUsed = false
|
||||
var globalShortcutsAreDisabled = false
|
||||
var shortcutIndex = 0
|
||||
@@ -75,8 +76,6 @@ class App: AppCenterApplication, NSApplicationDelegate {
|
||||
KeyboardEvents.addEventHandlers()
|
||||
MouseEvents.observe()
|
||||
TrackpadEvents.observe()
|
||||
// TODO: undeterministic; events in the queue may still be processing; good enough for now
|
||||
DispatchQueue.main.async { () -> () in Windows.sortByLevel() }
|
||||
self.preloadWindows()
|
||||
#if DEBUG
|
||||
// self.showPreferencesWindow()
|
||||
@@ -281,6 +280,10 @@ class App: AppCenterApplication, NSApplicationDelegate {
|
||||
Logger.debug(shortcutIndex, self.shortcutIndex, isFirstSummon)
|
||||
App.app.appIsBeingUsed = true
|
||||
if isFirstSummon || shortcutIndex != self.shortcutIndex {
|
||||
if isVeryFirstSummon {
|
||||
DispatchQueue.main.async { () -> () in Windows.sortByLevel() }
|
||||
isVeryFirstSummon = false
|
||||
}
|
||||
isFirstSummon = false
|
||||
self.shortcutIndex = shortcutIndex
|
||||
let screen = NSScreen.preferred()
|
||||
|
||||
Reference in new issue
Block a user