fix: ui would take time to display sometimes (see #563)

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-09-09 23:44:16 +09:00
1 parent d61739996f
commit 7efc806a89
3 files changed
+3 -5

No files matched your search

+2 -2
View File
@@ -81,10 +81,10 @@ class Applications {
static func refreshBadges_(_ items: [(URL?, String?)], _ currentIndex: Int = 0) {
Windows.list.enumerated().forEach { (i, window) in
if !App.app.appIsBeingUsed { return }
let view = ThumbnailsView.recycledViews[i]
if let app = (Applications.list.first { window.application.pid == $0.pid }) {
if App.app.appIsBeingUsed,
app.runningApplication.activationPolicy == .regular,
if app.runningApplication.activationPolicy == .regular,
let bundleId = app.runningApplication.bundleIdentifier,
let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleId),
let matchingItem = (items.first { $0.0 == url }),
+1 -1
View File
@@ -30,7 +30,7 @@ class BackgroundWork {
extension DispatchQueue {
static func globalConcurrent(_ label: String, _ qos: DispatchQoS) -> DispatchQueue {
return DispatchQueue(label: label, target: .global(qos: qos.qosClass))
return DispatchQueue(label: label, attributes: .concurrent, target: .global(qos: qos.qosClass))
}
func asyncWithCap(_ deadline: DispatchTime? = nil, _ fn: @escaping () -> Void) {
-2
View File
@@ -259,8 +259,6 @@ class App: AppCenterApplication, NSApplicationDelegate {
guard appIsBeingUsed else { return }
Windows.refreshFirstFewThumbnailsSync()
guard appIsBeingUsed else { return }
Applications.refreshBadges()
guard appIsBeingUsed else { return }
thumbnailsPanel.makeKeyAndOrderFront(nil) // workaround: without this, switching between 2 monitors make thumbnailPanel invisible
guard appIsBeingUsed else { return }
refreshOpenUi()