File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -147,17 +147,22 @@ class MenuBarOverlayPanel: NSPanel {
147147 }
148148 let displayID = owningScreen. displayID
149149 updateTaskContext. setTask ( for: . applicationMenuFrame, timeout: . seconds( 10 ) ) {
150+ var hasDoneInitialUpdate = false
150151 while true {
151152 try Task . checkCancellation ( )
152153 guard
153154 let latestFrame = appState. menuBarManager. getApplicationMenuFrame ( for: displayID) ,
154155 latestFrame != self . applicationMenuFrame
155156 else {
156- try await Task . sleep ( for: . milliseconds( 1 ) )
157+ if hasDoneInitialUpdate {
158+ try await Task . sleep ( for: . seconds( 1 ) )
159+ } else {
160+ try await Task . sleep ( for: . milliseconds( 1 ) )
161+ }
157162 continue
158163 }
159164 self . insertUpdateFlag ( . applicationMenuFrame)
160- return
165+ hasDoneInitialUpdate = true
161166 }
162167 }
163168 Task {
@@ -193,6 +198,13 @@ class MenuBarOverlayPanel: NSPanel {
193198 }
194199 . store ( in: & c)
195200
201+ Timer . publish ( every: 10 , on: . main, in: . default)
202+ . autoconnect ( )
203+ . sink { [ weak self] _ in
204+ self ? . insertUpdateFlag ( . applicationMenuFrame)
205+ }
206+ . store ( in: & c)
207+
196208 $needsShow
197209 . debounce ( for: 0.05 , scheduler: DispatchQueue . main)
198210 . sink { [ weak self] needsShow in
You can’t perform that action at this time.
0 commit comments