Commit 2d27bbd039

2d27bbd039d3e073cdcb897beca32214cb7281e1

parent: 7693220003

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 20:48 UTC

Watch: keyword and status colours by class, as the agenda draws them

Ref #223

Layout: unified · split

Sources/OrgstarWatch/WatchApp.swift +26 −2
@@ -179,13 +179,37 @@ struct EntryRow: View {
179 } 179 }
180 VStack(alignment: .leading, spacing: 1) { 180 VStack(alignment: .leading, spacing: 1) {
181 if !entry.gutter.isEmpty { 181 if !entry.gutter.isEmpty {
182 Text(entry.gutter).font(.caption2).foregroundStyle(entry.status == "overdue" ? .red : .secondary) 182 Text(entry.gutter).font(.caption2).foregroundStyle(statusColor)
183 } 183 }
184 Text(entry.title).strikethrough(entry.isDone).lineLimit(3) 184 Text(entry.title).strikethrough(entry.isDone).lineLimit(3)
185 if let todo = entry.todo { Text(todo).font(.caption2.weight(.semibold)).foregroundStyle(entry.isDone ? .green : .orange) } 185 if let todo = entry.todo { Text(todo).font(.caption2.weight(.semibold)).foregroundStyle(Self.color(keyword: todo, isDone: entry.isDone)) }
186 } 186 }
187 } 187 }
188 } 188 }
189
190 /// The agenda's status colors: `agenda-overdue`, `agenda-due-soon`, `done`.
191 private var statusColor: Color {
192 switch entry.status {
193 case "overdue": .red
194 case "due-soon": .orange
195 case "done": .green
196 default: .secondary
197 }
198 }
199
200 /// The keyword's class color, as the default theme draws it: `todo`, `todo-next`,
201 /// `todo-waiting`, `done`, `todo-cancelled`. The words are `ThemeSpec.TodoClass`'s.
202 static func color(keyword: String, isDone: Bool) -> Color {
203 let word = keyword.uppercased()
204 if isDone { return cancelledWords.contains(word) ? .gray : .green }
205 if nextWords.contains(word) { return .blue }
206 if waitingWords.contains(word) { return .yellow }
207 return .red
208 }
209
210 static let nextWords: Set<String> = ["NEXT", "STRT", "STARTED", "START", "DOING", "ACTIVE", "INPROGRESS", "IN-PROGRESS"]
211 static let waitingWords: Set<String> = ["WAIT", "WAITING", "HOLD", "ONHOLD", "BLOCKED", "DEFERRED", "SOMEDAY", "MAYBE"]
212 static let cancelledWords: Set<String> = ["KILL", "KILLED", "CANCELLED", "CANCELED", "CANCEL", "SKIPPED", "SKIP", "ABORTED", "NO", "WONTFIX"]
189} 213}
190#else 214#else
191/// The watch app builds for watchOS only; elsewhere the product does nothing. 215/// The watch app builds for watchOS only; elsewhere the product does nothing.
docs/manual/guide/14-ios.org +1 −1
@@ -254,7 +254,7 @@ The watch app shows today's agenda from your iPhone, marks entries done, shows a
254 254
255- Clocked In :: the running clock's heading and its time so far, with Clock Out. Without a running clock, Clock In to /heading/ clocks in to the entry clocked last (=org-clock-in-last=). 255- Clocked In :: the running clock's heading and its time so far, with Clock Out. Without a running clock, Clock In to /heading/ clocks in to the entry clocked last (=org-clock-in-last=).
256- Capture :: dictate or scribble text, then Done. It goes to orgstar on iPhone, which opens the capture sheet with it as =%i=, with the first template, as text from the share sheet does; see Capture below. 256- Capture :: dictate or scribble text, then Done. It goes to orgstar on iPhone, which opens the capture sheet with it as =%i=, with the first template, as text from the share sheet does; see Capture below.
257- Overdue, then today :: as the agenda lists them, with the time or status, the title and the keyword. Tap an open TODO entry to mark it done: it takes its sequence's first done keyword, as the agenda's Done does. The entry shows done at once; the iPhone changes the file, unless the heading changed since the agenda was sent. 257- Overdue, then today :: as the agenda lists them, with the time or status, the title and the keyword. Keywords are red when open, blue for work under way (NEXT and the like), yellow for work on hold (WAIT and the like), green when done and grey when cancelled; an overdue status is red and one due soon orange. Tap an open TODO entry to mark it done: it takes its sequence's first done keyword, as the agenda's Done does. The entry shows done at once; the iPhone changes the file, unless the heading changed since the agenda was sent.
258 258
259What the watch asks for runs on your iPhone, which iOS wakes for it when orgstar isn't open; while the iPhone is out of reach, the requests wait and run when it is back. 259What the watch asks for runs on your iPhone, which iOS wakes for it when orgstar isn't open; while the iPhone is out of reach, the requests wait and run when it is back.
260 260