fix: app badges would sometimes not be up-to-date
This commit is contained in:
1 parent
a7ef4c7554
commit
8ad03a5976
2 files changed
+4
-3
No files matched your search
@@ -74,7 +74,8 @@ class Applications {
|
||||
}
|
||||
|
||||
static func refreshBadges() {
|
||||
retryAxCallUntilTimeout {
|
||||
let group = DispatchGroup()
|
||||
retryAxCallUntilTimeout(group) {
|
||||
if let dockPid = (Applications.list.first { $0.runningApplication.bundleIdentifier == "com.apple.dock" }?.runningApplication.processIdentifier),
|
||||
let axList = (try AXUIElementCreateApplication(dockPid).children()?.first { try $0.role() == "AXList" }),
|
||||
let axAppDockItem = (try axList.children()?.filter { try $0.subrole() == "AXApplicationDockItem" && ($0.appIsRunning() ?? false) }) {
|
||||
@@ -87,6 +88,7 @@ class Applications {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ = group.wait(wallTimeout: .now() + .seconds(1))
|
||||
}
|
||||
|
||||
private static func isActualApplication(_ app: NSRunningApplication) -> Bool {
|
||||
|
||||
@@ -48,8 +48,6 @@ class ThumbnailView: NSStackView {
|
||||
|
||||
private func addDockLabelIcon() {
|
||||
appIcon.addSubview(dockLabelIcon, positioned: .above, relativeTo: nil)
|
||||
dockLabelIcon.topAnchor.constraint(equalTo: appIcon.topAnchor, constant: -4).isActive = true
|
||||
dockLabelIcon.rightAnchor.constraint(equalTo: appIcon.rightAnchor, constant: 1).isActive = true
|
||||
}
|
||||
|
||||
private func addWindowControls() {
|
||||
@@ -139,6 +137,7 @@ class ThumbnailView: NSStackView {
|
||||
} else {
|
||||
view.setNumber(dockLabel, true)
|
||||
}
|
||||
dockLabelIcon.setFrameOrigin(NSPoint(x: appIcon.frame.maxX - dockLabelIcon.fittingSize.width - 1, y: appIcon.frame.maxY - dockLabelIcon.fittingSize.height + 4))
|
||||
}
|
||||
assignIfDifferent(&frame.size.width, max(thumbnail.frame.size.width + Preferences.intraCellPadding * 2, ThumbnailView.widthMin(screen)))
|
||||
assignIfDifferent(&frame.size.height, newHeight)
|
||||
|
||||
Reference in new issue
Block a user