Commit 7cec273175

7cec2731753efa969d43dcd5854656c02f53bcd5

parent: 9f4554a96f

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-27 03:47 UTC

Agenda and sidebars follow the font size setting on the Mac

Settings ▸ Appearance ▸ Size scales the agenda window, the agenda and
file sidebars and the outline from the system's text style sizes, never
below them. macOS has no Dynamic Type, so @ScaledMetric widths in the
agenda become the same scale. File icons keep their size.

Layout: unified · split

Changed files (6)
Sources/Orgstar/AgendaRowView.swift +14 −13 · view
@@ -17,13 +17,14 @@ struct AgendaRowView: View {
1717 /// Marked for a bulk action.
1818 var marked = false
1919 @Environment(\.orgTheme) private var theme
20 @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth
20 @Environment(\.textScale) private var scale
2121 @Environment(\.colorSchemeContrast) private var contrast
2222 @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor
23 @ScaledMetric(relativeTo: .caption) private var badgeSize: CGFloat = 18
2423
2524 static let gutterWidth: CGFloat = 92
2625
26 private var badgeSize: CGFloat { 18 * scale }
27
2728 var body: some View {
2829 HStack(alignment: .top, spacing: 12) {
2930 if showsGutter { gutter }
@@ -34,7 +35,7 @@ struct AgendaRowView: View {
3435 marks
3536 }
3637 Text(row.title.isEmpty ? " " : row.title)
37 .font(.body)
38 .font(.scaled(.body, scale))
3839 .strikethrough(row.isDone)
3940 .foregroundStyle(row.isDone ? AnyShapeStyle(.secondary) : AnyShapeStyle(theme.color("foreground") ?? .primary))
4041 .lineLimit(1)
@@ -76,21 +77,21 @@ struct AgendaRowView: View {
7677 VStack(alignment: .leading, spacing: 2) {
7778 let lines = row.gutterLines
7879 Text(lines[0])
79 .font(.callout.weight(row.status == .overdue || row.status == .dueSoon ? .semibold : .regular).monospacedDigit())
80 .font(.scaled(.callout, scale).weight(row.status == .overdue || row.status == .dueSoon ? .semibold : .regular).monospacedDigit())
8081 .foregroundStyle(statusColor)
8182 .lineLimit(2)
8283 .fixedSize(horizontal: false, vertical: true)
8384 if lines.count > 1 {
84 Text(lines[1]).font(.caption.monospacedDigit()).foregroundStyle(.secondary)
85 Text(lines[1]).font(.scaled(.caption, scale).monospacedDigit()).foregroundStyle(.secondary)
8586 }
8687 if let symbol = row.symbol {
8788 Image(systemName: symbol)
88 .font(.caption.weight(.semibold))
89 .font(.scaled(.caption, scale).weight(.semibold))
8990 .imageScale(row.icon == .event ? .small : .medium)
9091 .foregroundStyle(iconColor)
9192 }
9293 }
93 .frame(width: gutterWidth, alignment: .leading)
94 .frame(width: Self.gutterWidth * scale, alignment: .leading)
9495 }
9596
9697 private var iconColor: Color {
@@ -108,21 +109,21 @@ struct AgendaRowView: View {
108109 ?? theme.dynamic { [theme, row] in theme.categoryColor(row.category, dark: $0) })
109110 .frame(width: 6, height: 6)
110111 Text(row.category)
111 .font(.subheadline)
112 .font(.scaled(.subheadline, scale))
112113 .foregroundStyle(theme.color("agenda-category") ?? .secondary)
113114 .lineLimit(1)
114115 }
115116 }
116117 if let detail = row.prefixDetail {
117118 Text(detail)
118 .font(.subheadline)
119 .font(.scaled(.subheadline, scale))
119120 .foregroundStyle(.secondary)
120121 .lineLimit(1)
121122 .truncationMode(.middle)
122123 }
123124 ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in
124125 Text(progress)
125 .font(.caption.weight(.semibold).monospacedDigit())
126 .font(.scaled(.caption, scale).weight(.semibold).monospacedDigit())
126127 .foregroundStyle(.secondary)
127128 .padding(.horizontal, 6)
128129 .padding(.vertical, 1)
@@ -130,7 +131,7 @@ struct AgendaRowView: View {
130131 }
131132 ForEach(row.tags, id: \.self) { tag in
132133 Text(tag)
133 .font(.caption.weight(.medium))
134 .font(.scaled(.caption, scale).weight(.medium))
134135 .foregroundStyle(theme.color("tags") ?? .secondary)
135136 .padding(.horizontal, 6)
136137 .padding(.vertical, 1)
@@ -149,7 +150,7 @@ struct AgendaRowView: View {
149150 if withoutColor, row.isDone { Image(systemName: "checkmark") }
150151 Text(todo)
151152 }
152 .font(.caption.weight(.bold))
153 .font(.scaled(.caption, scale).weight(.bold))
153154 .foregroundStyle(highContrast ? background : color)
154155 .padding(.horizontal, 7)
155156 .padding(.vertical, 2)
@@ -166,7 +167,7 @@ struct AgendaRowView: View {
166167 if let priority = row.priority {
167168 let color = theme.dynamic(.systemOrange) { [theme] in theme.priorityColor(priority, dark: $0) }
168169 Text(priority)
169 .font(.caption.weight(.bold))
170 .font(.scaled(.caption, scale).weight(.bold))
170171 .foregroundStyle(highContrast ? background : color)
171172 .frame(width: badgeSize, height: badgeSize)
172173 .background(Circle().fill(highContrast ? color : color.opacity(0.14)))
Sources/Orgstar/AgendaSidebar.swift +8 −6 · view
@@ -24,6 +24,7 @@ struct AgendaSidebar: View {
2424 @Environment(\.orgTheme) private var theme
2525 @Environment(\.colorScheme) private var colorScheme
2626 @Environment(\.openWindow) private var openWindow
27 @Environment(\.textScale) private var scale
2728
2829 init(workspace: WorkspaceModel, session: DocumentSession, commands: AppCommands, hour: Int, showsAgenda: Binding<Bool>) {
2930 self.workspace = workspace
@@ -84,14 +85,14 @@ struct AgendaSidebar: View {
8485 let groups = groups
8586 List {
8687 if groups.allSatisfy(\.rows.isEmpty) {
87 Text("Nothing scheduled").foregroundStyle(.secondary)
88 Text("Nothing scheduled").font(.scaled(.body, scale)).foregroundStyle(.secondary)
8889 }
8990 ForEach(groups) { group in
9091 if !group.rows.isEmpty {
9192 Section {
9293 ForEach(Array(group.rows.enumerated()), id: \.offset) { _, row in line(row) }
9394 } header: {
94 Text(group.header).foregroundStyle((group.isToday ? theme.color("agenda-today") : theme.color("sidebar-header")) ?? .secondary)
95 Text(group.header).font(.scaled(.subheadline, scale).weight(.semibold)).foregroundStyle((group.isToday ? theme.color("agenda-today") : theme.color("sidebar-header")) ?? .secondary)
9596 }
9697 }
9798 }
@@ -122,10 +123,10 @@ struct AgendaSidebar: View {
122123 let label = HStack(alignment: .firstTextBaseline, spacing: 6) {
123124 if !row.gutter.isEmpty {
124125 Text(row.gutter)
125 .font(.caption)
126 .font(.scaled(.caption, scale))
126127 .monospacedDigit()
127128 .foregroundStyle(theme.dynamic(.secondaryLabelColor) { [theme] in theme.statusColor(row.status, dark: $0) })
128 .frame(width: 52, alignment: .trailing)
129 .frame(width: 52 * scale, alignment: .trailing)
129130 .lineLimit(1)
130131 .minimumScaleFactor(0.7)
131132 }
@@ -133,16 +134,17 @@ struct AgendaSidebar: View {
133134 HStack(alignment: .firstTextBaseline, spacing: 4) {
134135 if let todo = row.todo {
135136 Text(todo)
136 .font(.caption.bold())
137 .font(.scaled(.caption, scale).bold())
137138 .foregroundStyle(theme.dynamic(row.isDone ? .systemGreen : .systemRed) { [theme] in theme.todoColor(todo, isDone: row.isDone, dark: $0) })
138139 }
139140 Text(row.title.isEmpty ? "(untitled)" : row.title)
141 .font(.scaled(.body, scale))
140142 .lineLimit(2)
141143 .strikethrough(row.isDone)
142144 .foregroundStyle(row.isDone ? .secondary : theme.color("sidebar-foreground") ?? .primary)
143145 }
144146 if !row.category.isEmpty {
145 Text(row.category).font(.caption2).foregroundStyle(.secondary).lineLimit(1)
147 Text(row.category).font(.scaled(.caption2, scale)).foregroundStyle(.secondary).lineLimit(1)
146148 }
147149 }
148150 }
Sources/Orgstar/AgendaView.swift +14 −13 · view
@@ -59,7 +59,8 @@ struct AgendaView: View {
5959 @State var pickedDate = Date()
6060 @AppStorage("agendaOverdueExpanded") private var overdueShown = true
6161 @State private var hovered: String?
62 @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth
62 @Environment(\.textScale) private var scale
63 private var gutterWidth: CGFloat { AgendaRowView.gutterWidth * scale }
6364 @FocusState private var focused: Bool
6465 @AppStorage("agendaSpan") var span = 10
6566 @AppStorage("agendaStartOffset") var startOffset = 0
@@ -297,7 +298,7 @@ struct AgendaView: View {
297298 }
298299 }
299300 } header: {
300 header { Text(block.header).font(.body.weight(.semibold)) }
301 header { Text(block.header).font(.scaled(.body, scale).weight(.semibold)) }
301302 }
302303 }
303304 } else if isAgenda {
@@ -314,7 +315,7 @@ struct AgendaView: View {
314315 rowView(Line(id: "list:\(index)", row: row, day: agenda.today), showsGutter: false)
315316 }
316317 } header: {
317 header { Text(listTitle).font(.body.weight(.semibold)) }
318 header { Text(listTitle).font(.scaled(.body, scale).weight(.semibold)) }
318319 }
319320 }
320321 }
@@ -338,7 +339,7 @@ struct AgendaView: View {
338339 PromptBar(request: $prompt)
339340 } else if let message = message ?? (filter.isEmpty ? reminderStatus : String(localized: "Filter: \(filter.description)")) {
340341 Text(message)
341 .font(.callout)
342 .font(.scaled(.callout, scale))
342343 .frame(maxWidth: .infinity, alignment: .leading)
343344 .padding(.horizontal, 12)
344345 .padding(.vertical, 6)
@@ -423,7 +424,7 @@ struct AgendaView: View {
423424 }
424425 if group.isEmpty {
425426 Text("Nothing scheduled")
426 .font(.callout)
427 .font(.scaled(.callout, scale))
427428 .foregroundStyle(.secondary)
428429 .padding(.horizontal, 16)
429430 .padding(.vertical, 10)
@@ -450,7 +451,7 @@ struct AgendaView: View {
450451 private func gridLine(_ time: Int) -> some View {
451452 HStack(spacing: 6) {
452453 Text(String(format: "%02d:%02d", time / 100, time % 100))
453 .font(.caption.monospacedDigit())
454 .font(.scaled(.caption, scale).monospacedDigit())
454455 .frame(width: gutterWidth, alignment: .leading)
455456 GridRule().stroke(style: StrokeStyle(lineWidth: 0.5, dash: [2, 3])).frame(height: 1)
456457 }
@@ -475,19 +476,19 @@ struct AgendaView: View {
475476 return header {
476477 if let relative = group.relativeName(today: agenda.today) {
477478 Text(relative)
478 .font(.body.weight(.bold))
479 .font(.scaled(.body, scale).weight(.bold))
479480 .foregroundStyle(color)
480481 Text("·").foregroundStyle(.tertiary)
481482 }
482483 Text(Self.format(group.day, Days.date(group.day).year == Days.date(agenda.today).year ? "EEEE d MMMM" : "EEEE d MMMM yyyy"))
483 .font(.body.weight(group.isToday ? .bold : .semibold))
484 .font(.scaled(.body, scale).weight(group.isToday ? .bold : .semibold))
484485 .foregroundStyle(color)
485486 Spacer()
486487 Button {
487488 capture(on: group.day)
488489 } label: {
489490 Image(systemName: "plus")
490 .font(.callout.weight(.semibold))
491 .font(.scaled(.callout, scale).weight(.semibold))
491492 .frame(width: 22, height: 22)
492493 .contentShape(Rectangle())
493494 }
@@ -505,11 +506,11 @@ struct AgendaView: View {
505506 } label: {
506507 HStack(spacing: 6) {
507508 Image(systemName: "chevron.right")
508 .font(.caption.weight(.bold))
509 .font(.scaled(.caption, scale).weight(.bold))
509510 .rotationEffect(.degrees(overdueShown ? 90 : 0))
510 Text("Overdue").font(.callout.weight(.semibold))
511 Text("Overdue").font(.scaled(.callout, scale).weight(.semibold))
511512 Text("\(count)")
512 .font(.caption.weight(.bold).monospacedDigit())
513 .font(.scaled(.caption, scale).weight(.bold).monospacedDigit())
513514 .padding(.horizontal, 6)
514515 .padding(.vertical, 1)
515516 .background(Capsule().fill(color.opacity(0.15)))
@@ -528,7 +529,7 @@ struct AgendaView: View {
528529 private var nowLine: some View {
529530 HStack(spacing: 6) {
530531 Text(now.formatted(.dateTime.hour(.twoDigits(amPM: .omitted)).minute()))
531 .font(.caption.weight(.semibold).monospacedDigit())
532 .font(.scaled(.caption, scale).weight(.semibold).monospacedDigit())
532533 .frame(width: gutterWidth, alignment: .leading)
533534 Circle().frame(width: 6, height: 6)
534535 Rectangle().frame(height: 1)
Sources/Orgstar/OrgstarApp.swift +2 · view
@@ -546,6 +546,7 @@ struct OrgstarApp: App {
546546 case .success(let model):
547547 ContentView(workspace: model, session: session, commands: commands, scheduler: scheduler, clock: clock)
548548 .environment(\.orgTheme, ConfigSync.shared.theme)
549 .textScaled()
549550 .tint(ConfigSync.shared.theme.color("accent"))
550551 .onAppear {
551552 delegate.session = session
@@ -577,6 +578,7 @@ struct OrgstarApp: App {
577578 if case .success(let model) = workspace {
578579 AgendaView(workspace: model, session: session, commands: commands, scheduler: scheduler, clock: clock)
579580 .environment(\.orgTheme, ConfigSync.shared.theme)
581 .textScaled()
580582 .tint(ConfigSync.shared.theme.color("accent"))
581583 }
582584 }
Sources/Orgstar/Sidebar.swift +6 −2 · view
@@ -20,6 +20,7 @@ struct Sidebar: View {
2020 /// A file operation waiting for a name or a confirmation.
2121 @Environment(\.orgTheme) private var theme
2222 @Environment(\.colorScheme) private var colorScheme
23 @Environment(\.textScale) private var scale
2324 @State var pending: FileOperation?
2425 @State var name = ""
2526 @State var failure: String?
@@ -41,7 +42,7 @@ struct Sidebar: View {
4142 ForEach(workspace.rootPaths, id: \.self) { root in
4243 Section(isExpanded: expanded(root)) {
4344 OutlineGroup(workspace.tree(forRoot: root).children ?? [], children: \.children) { node in
44 Label(node.name, systemImage: icon(node))
45 Label { Text(node.name).font(.scaled(.body, scale)) } icon: { Image(systemName: icon(node)) }
4546 .foregroundStyle(node.file?.kind == .conflict ? .orange : node.isDownloading ? .secondary : theme.color("sidebar-foreground") ?? .primary)
4647 .help(node.isDownloading ? "Downloading from iCloud" : "")
4748 .tag(node.file?.path)
@@ -49,6 +50,7 @@ struct Sidebar: View {
4950 }
5051 } header: {
5152 Text((root as NSString).lastPathComponent)
53 .font(.scaled(.subheadline, scale).weight(.semibold))
5254 .foregroundStyle(theme.color("sidebar-header") ?? .secondary)
5355 .help(root)
5456 .contextMenu { folderMenu(root) }
@@ -193,6 +195,7 @@ struct SidebarBar<Content: View>: View {
193195struct OutlineColumn: View {
194196 let session: DocumentSession
195197 @Environment(\.orgTheme) private var theme
198 @Environment(\.textScale) private var scale
196199 @Environment(\.colorScheme) private var colorScheme
197200
198201 var body: some View {
@@ -201,9 +204,10 @@ struct OutlineColumn: View {
201204 session.reveal(entry.start)
202205 } label: {
203206 Text(entry.title.isEmpty ? "(untitled)" : entry.title)
207 .font(.scaled(.body, scale))
204208 .foregroundStyle(theme.color("sidebar-foreground") ?? .primary)
205209 .lineLimit(1)
206 .padding(.leading, CGFloat(entry.level - 1) * 12)
210 .padding(.leading, CGFloat(entry.level - 1) * 12 * scale)
207211 }
208212 .buttonStyle(.plain)
209213 }
Sources/Orgstar/TextScale.swift added +47 · view
@@ -0,0 +1,47 @@
1import AppKit
2import OrgPresentation
3import SwiftUI
4
5extension EnvironmentValues {
6 /// Settings ▸ Appearance ▸ Size over its default, never below 1: how much larger than the
7 /// system's sizes the agenda and sidebars show text. macOS has no Dynamic Type to do this.
8 @Entry var textScale: CGFloat = 1
9}
10
11extension Font {
12 /// `style` at the system's size for it times `scale`.
13 static func scaled(_ style: Font.TextStyle, _ scale: CGFloat) -> Font {
14 .system(size: NSFont.preferredFont(forTextStyle: style.appKit).pointSize * scale)
15 }
16}
17
18extension Font.TextStyle {
19 fileprivate var appKit: NSFont.TextStyle {
20 switch self {
21 case .largeTitle: .largeTitle
22 case .title: .title1
23 case .title2: .title2
24 case .title3: .title3
25 case .headline: .headline
26 case .subheadline: .subheadline
27 case .callout: .callout
28 case .footnote: .footnote
29 case .caption: .caption1
30 case .caption2: .caption2
31 default: .body
32 }
33 }
34}
35
36private struct TextScaled: ViewModifier {
37 @AppStorage("themeFontSize") private var size = ThemeSpec.default.fontSize
38
39 func body(content: Content) -> some View {
40 content.environment(\.textScale, max(1, CGFloat(size) / CGFloat(ThemeSpec.default.fontSize)))
41 }
42}
43
44extension View {
45 /// Sets `textScale` from Settings ▸ Appearance ▸ Size.
46 func textScaled() -> some View { modifier(TextScaled()) }
47}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form