perf: move app icon capture to background queue
This commit is contained in:
1 parent
53da0344bf
commit
5a35aa95bc
1 file changed
+7
-1
@@ -73,13 +73,19 @@ class Application: NSObject {
|
||||
pid = runningApplication.processIdentifier
|
||||
isHidden = runningApplication.isHidden
|
||||
hasBeenActiveOnce = runningApplication.isActive
|
||||
icon = Application.appIconWithoutPadding(runningApplication.icon)
|
||||
localizedName = runningApplication.localizedName
|
||||
bundleIdentifier = runningApplication.bundleIdentifier
|
||||
bundleURL = runningApplication.bundleURL
|
||||
executableURL = runningApplication.executableURL
|
||||
debugId = "(pid:\(pid) \(bundleIdentifier ?? bundleURL?.absoluteString ?? executableURL?.absoluteString ?? localizedName))"
|
||||
super.init()
|
||||
BackgroundWork.screenshotsQueue.addOperation { [weak self] in
|
||||
guard let self else { return }
|
||||
let r = Application.appIconWithoutPadding(runningApplication.icon)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.icon = r
|
||||
}
|
||||
}
|
||||
Logger.info { self.debugId }
|
||||
observeEventsIfEligible()
|
||||
kvObservers = [
|
||||
|
||||
Reference in new issue
Block a user