@@ -126,7 +126,7 @@ final class MenuBarItemManager: ObservableObject {
126126
127127 /// Cached timeouts for move operations.
128128 private var moveOperationTimeouts = [ MenuBarItemTag: Duration] ( )
129-
129+
130130 /// Cached timeouts for click operations (adaptive per app).
131131 private var clickOperationTimeouts = [ MenuBarItemTag: Duration] ( )
132132 /// Storage for internal observers.
@@ -1553,7 +1553,7 @@ extension MenuBarItemManager {
15531553 private func pruneMoveOperationTimeouts( keeping validTags: Set < MenuBarItemTag > ) {
15541554 moveOperationTimeouts = moveOperationTimeouts. filter { validTags. contains ( $0. key) }
15551555 }
1556-
1556+
15571557 /// Returns the default timeout for click operations based on the item's namespace.
15581558 private func getDefaultClickOperationTimeout( for item: MenuBarItem ) -> Duration {
15591559 // Known slow apps with dynamic content
@@ -1564,23 +1564,23 @@ extension MenuBarItemManager {
15641564 " com.hegenberg.BetterTouchTool " ,
15651565 " net.matthewpalmer.Vanilla " ,
15661566 ]
1567-
1567+
15681568 let namespaceString = item. tag. namespace. description
15691569 if slowAppBundleIDs. contains ( where: { namespaceString. contains ( $0) } ) {
15701570 return . milliseconds( 500 ) // Extra time for slow apps
15711571 }
1572-
1572+
15731573 return . milliseconds( 350 ) // Default
15741574 }
1575-
1575+
15761576 /// Returns the cached timeout for click operations associated with the given item.
15771577 private func getClickOperationTimeout( for item: MenuBarItem ) -> Duration {
15781578 if let timeout = clickOperationTimeouts [ item. tag] {
15791579 return timeout
15801580 }
15811581 return getDefaultClickOperationTimeout ( for: item)
15821582 }
1583-
1583+
15841584 /// Updates the cached timeout for click operations associated with the given item.
15851585 private func updateClickOperationTimeout( _ duration: Duration , for item: MenuBarItem ) {
15861586 let current = getClickOperationTimeout ( for: item)
@@ -1589,7 +1589,7 @@ extension MenuBarItemManager {
15891589 clickOperationTimeouts [ item. tag] = clamped
15901590 MenuBarItemManager . diagLog. debug ( " Updated click timeout for \( item. logString) : \( Int ( clamped. milliseconds) ) ms (measured: \( Int ( duration. milliseconds) ) ms) " )
15911591 }
1592-
1592+
15931593 /// Prunes the click operation timeouts cache, keeping only the entries
15941594 /// for the given valid tags.
15951595 private func pruneClickOperationTimeouts( keeping validTags: Set < MenuBarItemTag > ) {
@@ -1920,7 +1920,7 @@ extension MenuBarItemManager {
19201920 let clickTypes = getClickSubtypes ( for: mouseButton)
19211921 // Use adaptive timeout based on app performance history
19221922 let timeout = getClickOperationTimeout ( for: item)
1923-
1923+
19241924 MenuBarItemManager . diagLog. debug ( " postClickEvents: using timeout \( Int ( timeout. milliseconds) ) ms for \( item. logString) " )
19251925
19261926 guard
@@ -1959,7 +1959,7 @@ extension MenuBarItemManager {
19591959 timeout: timeout,
19601960 repeating: 2 // Double mouse up prevents invalid item state.
19611961 )
1962-
1962+
19631963 // Update timeout cache with successful duration
19641964 let successDuration = Duration . milliseconds ( Date . now. timeIntervalSince ( eventStartTime) * 1000 )
19651965 updateClickOperationTimeout ( successDuration, for: item)
@@ -3668,7 +3668,6 @@ private extension Duration {
36683668 let ( seconds, attoseconds) = self . components
36693669 return Double ( seconds) * 1000 + Double( attoseconds) / 1_000_000_000_000_000
36703670 }
3671-
36723671}
36733672
36743673// MARK: - CGEvent Helpers
0 commit comments