aboutsummaryrefslogtreecommitdiff
path: root/menubar/model.swift
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-10-20 14:51:07 +0300
committerIgor Soarez <igor@soarez.org>2026-10-20 14:51:07 +0300
commiteed9c9c1141e118e43b0055f935dd891d89bebd6 (patch)
tree146a2b3132358fb28fde27223753670b36e87f2a /menubar/model.swift
parent0f8438547e50e10b3c09f17356b1d88b93718b79 (diff)
panel: readable everywhere, compact/full toggle, change-driven; jump shortcut
- contrast: the summary used attributed-string colors (never vibrant) and the subtitles a vibrant system color, so they blended differently over light and dark desktops. the panel now uses herdr's mocha colors explicitly over a dark tint, identical on any background. - layout: compact in "when agents are waiting"; in "always" a show all / show less toggle switches to the full list (waiting, separator, rest). - rows are single-line with a trailing ellipsis instead of wrapping. - render only when the content changes, and log each render, instead of rebuilding every view every second. - --snapshot-panel renders the real panel offscreen over white and black after a different first render (stale content would show). - jump shortcut ctrl+opt+cmd+u (jump_hotkey) runs dingger focus; shortcuts are registered by id. an unedited first config file is upgraded. selftest covers the layout rules and content; e2e step 13 checks the full list, its separator, and the toggle labels.
Diffstat (limited to 'menubar/model.swift')
-rw-r--r--menubar/model.swift16
1 files changed, 13 insertions, 3 deletions
diff --git a/menubar/model.swift b/menubar/model.swift
index b4a54a0..e60cb84 100644
--- a/menubar/model.swift
+++ b/menubar/model.swift
@@ -19,6 +19,15 @@ let herdrYellow = herdrColor(dark: (249, 226, 175), light: (223, 142, 29))
let herdrGreen = herdrColor(dark: (166, 227, 161), light: (64, 160, 43))
let herdrGray = herdrColor(dark: (108, 112, 134), light: (156, 160, 176))
+/// herdr's mocha text colors, fixed (not appearance-dependent) for the
+/// always-dark floating panel.
+func mocha(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat, _ a: CGFloat = 1) -> NSColor {
+ NSColor(srgbRed: r / 255, green: g / 255, blue: b / 255, alpha: a)
+}
+let mochaText = mocha(205, 214, 244)
+let mochaSubtext = mocha(166, 173, 200)
+let mochaOverlay = mocha(108, 112, 134)
+
// MARK: herdr's status vocabulary
enum Status: String {
@@ -55,7 +64,7 @@ enum Status: String {
}
}
-struct Row {
+struct Row: Equatable {
let paneId: String
let agent: String
/// What the agent works on (its session/task name), if it has one.
@@ -187,13 +196,14 @@ func plainTitle(for rows: [Row]) -> String {
/// Row title: the colored status symbol, then the agent's name. Unnamed
/// agents show their harness, dimmed, so it never competes with real names.
-func rowTitle(_ row: Row) -> NSAttributedString {
+func rowTitle(_ row: Row, primary: NSColor = .labelColor,
+ secondary: NSColor = .secondaryLabelColor) -> NSAttributedString {
let font = NSFont.menuFont(ofSize: 0)
let mono = NSFont.monospacedSystemFont(ofSize: font.pointSize, weight: .medium)
let text = NSMutableAttributedString()
text.append(NSAttributedString(
string: "\(row.status.symbol) ", attributes: [.font: mono, .foregroundColor: row.status.color]))
- let labelColor = row.name.isEmpty ? NSColor.secondaryLabelColor : NSColor.labelColor
+ let labelColor = row.name.isEmpty ? secondary : primary
text.append(NSAttributedString(
string: row.label, attributes: [.font: font, .foregroundColor: labelColor]))
return text