Skip to content

Commit 220d319

Browse files
committed
Fix menubar not dimming on inactive screens
Drop explicit foregroundColor from the status item attributed string so NSStatusBarButton can apply native inactive-screen dimming. Fixes #170
1 parent dbde5cb commit 220d319

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

mac/Sources/CodeBurnMenubar/CodeBurnApp.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,15 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
281281
let valueText = compact
282282
? (formatted?.asCompactCurrencyWhole() ?? fallback)
283283
: " " + (formatted?.asCompactCurrency() ?? fallback)
284-
let color: NSColor = hasPayload ? .labelColor : .secondaryLabelColor
284+
285+
var textAttrs: [NSAttributedString.Key: Any] = [.font: font, .baselineOffset: -1.0]
286+
if !hasPayload {
287+
textAttrs[.foregroundColor] = NSColor.secondaryLabelColor
288+
}
285289

286290
let composed = NSMutableAttributedString()
287291
composed.append(NSAttributedString(attachment: attachment))
288-
composed.append(NSAttributedString(
289-
string: valueText,
290-
attributes: [.font: font, .foregroundColor: color, .baselineOffset: -1.0]
291-
))
292+
composed.append(NSAttributedString(string: valueText, attributes: textAttrs))
292293
button.attributedTitle = composed
293294
}
294295

0 commit comments

Comments
 (0)