Commit d18ec1c3d8

d18ec1c3d8f0e8d87592ce30ae0f44ad88fd86cf

parent: 512650677f

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 21:13 UTC

Mac: one running-clock display

The running clock shows in the main window's toolbar only, as a label with the clock symbol; the modeline no longer shows it.

Ref #223

Layout: unified · split

Changed files (8)
Sources/Orgstar/ContentView.swift +17 −12 · view
@@ -182,7 +182,7 @@ struct ContentView: View {
182182 }
183183 .safeAreaInset(edge: .bottom, spacing: 0) {
184184 VStack(spacing: 0) {
185 ModeLine(session: session, commands: commands, clock: clock, perform: perform)
185 ModeLine(session: session, commands: commands)
186186 EchoArea(commands: commands)
187187 }
188188 }
@@ -237,18 +237,23 @@ struct ContentView: View {
237237 }
238238 if let running = clock.running {
239239 ToolbarItem(id: "clock") {
240 Menu {
241 Button("Clock Out") { perform("app.clock.out") }
242 Button("Cancel Clock") { perform("app.clock.cancel") }
243 Button("Go to Clocked Entry") { perform("app.clock.goto") }
244 Divider()
245 Button("Clock In to Recent Entry…") { perform("app.clock.in-recent") }
246 Button("Go to Recent Clocked Entry…") { perform("app.clock.goto-recent") }
247 RecentClocks(clock: clock) { perform($0) }
248 } label: {
249 TimelineView(.periodic(from: .now, by: 30)) { context in
250 Text("⏱ \(running.heading) \(clockElapsed(running, now: context.date))").lineLimit(1)
240 TimelineView(.periodic(from: .now, by: 30)) { context in
241 Menu {
242 Button("Clock Out") { perform("app.clock.out") }
243 Button("Cancel Clock") { perform("app.clock.cancel") }
244 Button("Go to Clocked Entry") { perform("app.clock.goto") }
245 Divider()
246 Button("Clock In to Recent Entry…") { perform("app.clock.in-recent") }
247 Button("Go to Recent Clocked Entry…") { perform("app.clock.goto-recent") }
248 RecentClocks(clock: clock) { perform($0) }
249 } label: {
250 Label {
251 Text(verbatim: "\(running.heading) \(clockElapsed(running, now: context.date))").lineLimit(1)
252 } icon: {
253 Image(systemName: "clock")
254 }
251255 }
256 .labelStyle(.titleAndIcon)
252257 }
253258 .help("Clocked in since \(running.startedAt.formatted(date: .omitted, time: .shortened))")
254259 }
Sources/Orgstar/EditorWindowView.swift +1 −2 · view
@@ -6,7 +6,6 @@ import SwiftUI
66struct EditorWindowView: View {
77 let session: DocumentSession
88 let commands: AppCommands
9 let clock: ClockModel
109 @AppStorage("showTabBar") private var showTabBar = false
1110 @State private var window: WindowModel?
1211 @Environment(\.openWindow) private var openWindow
@@ -25,7 +24,7 @@ struct EditorWindowView: View {
2524 }
2625 .safeAreaInset(edge: .bottom, spacing: 0) {
2726 VStack(spacing: 0) {
28 ModeLine(session: session, commands: commands, clock: clock) { run($0) }
27 ModeLine(session: session, commands: commands)
2928 EchoArea(commands: commands)
3029 }
3130 }
Sources/Orgstar/ModeLine.swift +1 −21 · view
@@ -4,14 +4,11 @@ import OrgPresentation
44import SwiftUI
55
66/// The line under the editor: evil state, unsaved mark and the headings around the caret on
7/// the left; the running clock, the selection's counts, line and column, the file's words,
7/// the left; the timer, the selection's counts, line and column, the file's words,
88/// anything unusual about its encoding and the git branch on the right.
99struct ModeLine: View {
1010 let session: DocumentSession
1111 let commands: AppCommands
12 let clock: ClockModel
13 /// Runs an app command (clock out, go to the clocked entry).
14 let perform: (String) -> Void
1512 @Environment(\.orgTheme) private var theme
1613 @Environment(\.colorScheme) private var colorScheme
1714 @Environment(\.appearsActive) private var appearsActive
@@ -34,23 +31,6 @@ struct ModeLine: View {
3431 }
3532 breadcrumb(at: selection.location)
3633 Spacer(minLength: 12)
37 if let running = clock.running {
38 Menu {
39 Button("Clock Out") { perform("app.clock.out") }
40 Button("Cancel Clock") { perform("app.clock.cancel") }
41 Button("Go to Clocked Entry") { perform("app.clock.goto") }
42 } label: {
43 TimelineView(.periodic(from: .now, by: 30)) { context in
44 Text("⏱ \(clockElapsed(running, now: context.date)) \(running.heading)")
45 .font(.system(.caption, design: .monospaced))
46 }
47 }
48 .menuStyle(.borderlessButton)
49 .menuIndicator(.hidden)
50 .fixedSize()
51 .foregroundStyle(theme.color("modeline-highlight") ?? .primary)
52 .help("Clocked in since \(running.startedAt.formatted(date: .omitted, time: .shortened))")
53 }
5434 if let timer = TimerModel.shared.timer {
5535 Menu {
5636 Button(timer.paused == nil ? "Pause Timer" : "Continue Timer") { commands.editor?.run("org.timer.pause") }
Sources/Orgstar/OrgstarApp.swift +1 −1 · view
@@ -435,7 +435,7 @@ struct OrgstarApp: App {
435435 .defaultSize(width: 1280, height: 860)
436436 WindowGroup("Editor", id: "editor") {
437437 if case .success = workspace {
438 EditorWindowView(session: session, commands: commands, clock: clock)
438 EditorWindowView(session: session, commands: commands)
439439 .environment(\.orgTheme, ConfigSync.shared.theme)
440440 .tint(ConfigSync.shared.theme.color("accent"))
441441 }
docs/manual/guide/02-the-editor.org +1 −2 · view
@@ -195,7 +195,6 @@ The line under the editor shows, from the left:
195195| Evil state | Doom preset | =NORMAL=, =INSERT=, =VISUAL=, =V-LINE= or =V-BLOCK=, on a coloured tag |
196196| Unsaved dot | the buffer has unsaved edits | a small dot |
197197| Outline path | the caret is under a heading | the headings containing the caret, outermost first, as =Projects › House › Roof= |
198| Running clock | a clock is running | elapsed time and the clocked heading; click for Clock Out, Cancel Clock and Go to Clocked Entry |
199198| Selection counts | text is selected | lines, words and characters in the selection, as =count-words-region= |
200199| Line and column | always | =LINE:COLUMN= of the caret (the end of the selection) |
201200| Word count | always | words in the whole file, as =count-words=; click for the characters and reading time of the file and the selection |
@@ -206,7 +205,7 @@ Lines count from 1. Columns count from 0, as Emacs's =column-number-mode= does:
206205
207206The word count follows edits after a pause. Reading time is at 230 words a minute, rounded up. The Git branch is read from the repository's =HEAD= file without running =git=, and checked again every 5 seconds; worktrees and submodules are followed.
208207
209The running clock is covered in [[file:06-dates-and-clocking.org][Dates and clocking]]; the evil states in [[file:03-keys.org][Keys and commands]].
208The running clock shows in the toolbar; see [[file:06-dates-and-clocking.org][Dates and clocking]]. The evil states are covered in [[file:03-keys.org][Keys and commands]].
210209
211210* The echo area
212211
docs/manual/guide/06-dates-and-clocking.org +2 −3 · view
@@ -312,10 +312,9 @@ An existing drawer of that name always takes the new line.
312312
313313** The running clock
314314
315While a clock runs, orgstar shows it in three places, refreshed every 30 seconds:
315While a clock runs, orgstar shows it in two places, refreshed every 30 seconds:
316316
317- the mode line under the editor: =⏱ 0:42 Write the report=;
318- the window's toolbar;
317- the main window's toolbar, with a clock symbol, the heading and the elapsed time: =Write the report 0:42=;
319318- the macOS menu bar, with the elapsed time.
320319
321320The time shown is the time since you clocked in, not the entry's total. Each of them opens a menu with Clock Out, Cancel Clock and Go to Clocked Entry. The toolbar's menu also has Clock In to Recent Entry…, Go to Recent Clocked Entry… and the recent entries. The menu bar item also has Clock In to Recent Entry…, Clock Report and a Recent Entries section. Choosing a recent entry clocks in to it.
docs/manual/guide/13-configuration.org +1 −1 · view
@@ -797,7 +797,7 @@ The colors stack in this order, each over the one before: the themes chosen with
797797| =sidebar-header= | folder names there |
798798| =modeline-background= | the modeline and message line |
799799| =modeline-foreground= | modeline text |
800| =modeline-highlight= | the outline path and the clock in the modeline |
800| =modeline-highlight= | the outline path in the modeline |
801801| =state-normal= | the NORMAL tag (Doom keys) |
802802| =state-insert= | the INSERT tag |
803803| =state-visual= | the VISUAL and V-LINE tags |
l10n/Localizable.xcstrings −11 · view
@@ -41155,17 +41155,6 @@
4115541155 }
4115641156 }
4115741157 }
41158 },
41159 "⏱ %@ %@": {
41160 "localizations": {
41161 "en": {
41162 "stringUnit": {
41163 "state": "new",
41164 "value": "⏱ %1$@ %2$@"
41165 }
41166 }
41167 },
41168 "shouldTranslate": false
4116941158 }
4117041159 },
4117141160 "version": "1.1"
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