Skip to content

Commit

Permalink
Update menu bar item cache when running applications change
Browse files Browse the repository at this point in the history
Fixes #332
  • Loading branch information
jordanbaird committed Oct 8, 2024
1 parent 713c60c commit b715904
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Ice/MenuBar/ItemManagement/MenuBarItemManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ final class MenuBarItemManager: ObservableObject {
}
.store(in: &c)

NSWorkspace.shared.publisher(for: \.runningApplications)
.delay(for: 0.25, scheduler: DispatchQueue.main)
.sink { [weak self] _ in
guard let self else {
return
}
Task {
await self.cacheItemsIfNeeded()
}
}
.store(in: &c)

Publishers.Merge(
UniversalEventMonitor.publisher(for: mouseTrackingMask),
RunLoopLocalEventMonitor.publisher(for: mouseTrackingMask, mode: .eventTracking)
Expand Down

0 comments on commit b715904

Please sign in to comment.