Commit d18ec1c3d8
Verified · cmc
Changed files (8)
- Sources/Orgstar/ContentView.swift +17 −12
- Sources/Orgstar/EditorWindowView.swift +1 −2
- Sources/Orgstar/ModeLine.swift +1 −21
- Sources/Orgstar/OrgstarApp.swift +1 −1
- docs/manual/guide/02-the-editor.org +1 −2
- docs/manual/guide/06-dates-and-clocking.org +2 −3
- docs/manual/guide/13-configuration.org +1 −1
- l10n/Localizable.xcstrings −11
Sources/Orgstar/ContentView.swift +17 −12 · view
| @@ -182,7 +182,7 @@ struct ContentView: View { | |||
| 182 | } | 182 | } |
| 183 | .safeAreaInset(edge: .bottom, spacing: 0) { | 183 | .safeAreaInset(edge: .bottom, spacing: 0) { |
| 184 | VStack(spacing: 0) { | 184 | VStack(spacing: 0) { |
| 185 | ModeLine(session: session, commands: commands, clock: clock, perform: perform) | 185 | ModeLine(session: session, commands: commands) |
| 186 | EchoArea(commands: commands) | 186 | EchoArea(commands: commands) |
| 187 | } | 187 | } |
| 188 | } | 188 | } |
| @@ -237,18 +237,23 @@ struct ContentView: View { | |||
| 237 | } | 237 | } |
| 238 | if let running = clock.running { | 238 | if let running = clock.running { |
| 239 | ToolbarItem(id: "clock") { | 239 | ToolbarItem(id: "clock") { |
| 240 | Menu { | 240 | TimelineView(.periodic(from: .now, by: 30)) { context in |
| 241 | Button("Clock Out") { perform("app.clock.out") } | 241 | Menu { |
| 242 | Button("Cancel Clock") { perform("app.clock.cancel") } | 242 | Button("Clock Out") { perform("app.clock.out") } |
| 243 | Button("Go to Clocked Entry") { perform("app.clock.goto") } | 243 | Button("Cancel Clock") { perform("app.clock.cancel") } |
| 244 | Divider() | 244 | Button("Go to Clocked Entry") { perform("app.clock.goto") } |
| 245 | Button("Clock In to Recent Entry…") { perform("app.clock.in-recent") } | 245 | Divider() |
| 246 | Button("Go to Recent Clocked Entry…") { perform("app.clock.goto-recent") } | 246 | Button("Clock In to Recent Entry…") { perform("app.clock.in-recent") } |
| 247 | RecentClocks(clock: clock) { perform($0) } | 247 | Button("Go to Recent Clocked Entry…") { perform("app.clock.goto-recent") } |
| 248 | } label: { | 248 | RecentClocks(clock: clock) { perform($0) } |
| 249 | TimelineView(.periodic(from: .now, by: 30)) { context in | 249 | } label: { |
| 250 | Text("⏱ \(running.heading) \(clockElapsed(running, now: context.date))").lineLimit(1) | 250 | Label { |
| 251 | Text(verbatim: "\(running.heading) \(clockElapsed(running, now: context.date))").lineLimit(1) | ||
| 252 | } icon: { | ||
| 253 | Image(systemName: "clock") | ||
| 254 | } | ||
| 251 | } | 255 | } |
| 256 | .labelStyle(.titleAndIcon) | ||
| 252 | } | 257 | } |
| 253 | .help("Clocked in since \(running.startedAt.formatted(date: .omitted, time: .shortened))") | 258 | .help("Clocked in since \(running.startedAt.formatted(date: .omitted, time: .shortened))") |
| 254 | } | 259 | } |
Sources/Orgstar/EditorWindowView.swift +1 −2 · view
| @@ -6,7 +6,6 @@ import SwiftUI | |||
| 6 | struct EditorWindowView: View { | 6 | struct EditorWindowView: View { |
| 7 | let session: DocumentSession | 7 | let session: DocumentSession |
| 8 | let commands: AppCommands | 8 | let commands: AppCommands |
| 9 | let clock: ClockModel | ||
| 10 | @AppStorage("showTabBar") private var showTabBar = false | 9 | @AppStorage("showTabBar") private var showTabBar = false |
| 11 | @State private var window: WindowModel? | 10 | @State private var window: WindowModel? |
| 12 | @Environment(\.openWindow) private var openWindow | 11 | @Environment(\.openWindow) private var openWindow |
| @@ -25,7 +24,7 @@ struct EditorWindowView: View { | |||
| 25 | } | 24 | } |
| 26 | .safeAreaInset(edge: .bottom, spacing: 0) { | 25 | .safeAreaInset(edge: .bottom, spacing: 0) { |
| 27 | VStack(spacing: 0) { | 26 | VStack(spacing: 0) { |
| 28 | ModeLine(session: session, commands: commands, clock: clock) { run($0) } | 27 | ModeLine(session: session, commands: commands) |
| 29 | EchoArea(commands: commands) | 28 | EchoArea(commands: commands) |
| 30 | } | 29 | } |
| 31 | } | 30 | } |
Sources/Orgstar/ModeLine.swift +1 −21 · view
| @@ -4,14 +4,11 @@ import OrgPresentation | |||
| 4 | import SwiftUI | 4 | import SwiftUI |
| 5 | 5 | ||
| 6 | /// The line under the editor: evil state, unsaved mark and the headings around the caret on | 6 | /// 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, |
| 8 | /// anything unusual about its encoding and the git branch on the right. | 8 | /// anything unusual about its encoding and the git branch on the right. |
| 9 | struct ModeLine: View { | 9 | struct ModeLine: View { |
| 10 | let session: DocumentSession | 10 | let session: DocumentSession |
| 11 | let commands: AppCommands | 11 | let commands: AppCommands |
| 12 | let clock: ClockModel | ||
| 13 | /// Runs an app command (clock out, go to the clocked entry). | ||
| 14 | let perform: (String) -> Void | ||
| 15 | @Environment(\.orgTheme) private var theme | 12 | @Environment(\.orgTheme) private var theme |
| 16 | @Environment(\.colorScheme) private var colorScheme | 13 | @Environment(\.colorScheme) private var colorScheme |
| 17 | @Environment(\.appearsActive) private var appearsActive | 14 | @Environment(\.appearsActive) private var appearsActive |
| @@ -34,23 +31,6 @@ struct ModeLine: View { | |||
| 34 | } | 31 | } |
| 35 | breadcrumb(at: selection.location) | 32 | breadcrumb(at: selection.location) |
| 36 | Spacer(minLength: 12) | 33 | 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 | } | ||
| 54 | if let timer = TimerModel.shared.timer { | 34 | if let timer = TimerModel.shared.timer { |
| 55 | Menu { | 35 | Menu { |
| 56 | Button(timer.paused == nil ? "Pause Timer" : "Continue Timer") { commands.editor?.run("org.timer.pause") } | 36 | 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 { | |||
| 435 | .defaultSize(width: 1280, height: 860) | 435 | .defaultSize(width: 1280, height: 860) |
| 436 | WindowGroup("Editor", id: "editor") { | 436 | WindowGroup("Editor", id: "editor") { |
| 437 | if case .success = workspace { | 437 | if case .success = workspace { |
| 438 | EditorWindowView(session: session, commands: commands, clock: clock) | 438 | EditorWindowView(session: session, commands: commands) |
| 439 | .environment(\.orgTheme, ConfigSync.shared.theme) | 439 | .environment(\.orgTheme, ConfigSync.shared.theme) |
| 440 | .tint(ConfigSync.shared.theme.color("accent")) | 440 | .tint(ConfigSync.shared.theme.color("accent")) |
| 441 | } | 441 | } |
docs/manual/guide/02-the-editor.org +1 −2 · view
| @@ -195,7 +195,6 @@ The line under the editor shows, from the left: | |||
| 195 | | Evil state | Doom preset | =NORMAL=, =INSERT=, =VISUAL=, =V-LINE= or =V-BLOCK=, on a coloured tag | | 195 | | Evil state | Doom preset | =NORMAL=, =INSERT=, =VISUAL=, =V-LINE= or =V-BLOCK=, on a coloured tag | |
| 196 | | Unsaved dot | the buffer has unsaved edits | a small dot | | 196 | | Unsaved dot | the buffer has unsaved edits | a small dot | |
| 197 | | Outline path | the caret is under a heading | the headings containing the caret, outermost first, as =Projects › House › Roof= | | 197 | | 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 | | ||
| 199 | | Selection counts | text is selected | lines, words and characters in the selection, as =count-words-region= | | 198 | | Selection counts | text is selected | lines, words and characters in the selection, as =count-words-region= | |
| 200 | | Line and column | always | =LINE:COLUMN= of the caret (the end of the selection) | | 199 | | Line and column | always | =LINE:COLUMN= of the caret (the end of the selection) | |
| 201 | | Word count | always | words in the whole file, as =count-words=; click for the characters and reading time of the file and the selection | | 200 | | 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: | |||
| 206 | 205 | ||
| 207 | The 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. | 206 | The 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. |
| 208 | 207 | ||
| 209 | The 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]]. | 208 | The 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]]. |
| 210 | 209 | ||
| 211 | * The echo area | 210 | * The echo area |
| 212 | 211 | ||
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. | |||
| 312 | 312 | ||
| 313 | ** The running clock | 313 | ** The running clock |
| 314 | 314 | ||
| 315 | While a clock runs, orgstar shows it in three places, refreshed every 30 seconds: | 315 | While a clock runs, orgstar shows it in two places, refreshed every 30 seconds: |
| 316 | 316 | ||
| 317 | - the mode line under the editor: =⏱ 0:42 Write the report=; | 317 | - the main window's toolbar, with a clock symbol, the heading and the elapsed time: =Write the report 0:42=; |
| 318 | - the window's toolbar; | ||
| 319 | - the macOS menu bar, with the elapsed time. | 318 | - the macOS menu bar, with the elapsed time. |
| 320 | 319 | ||
| 321 | The 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. | 320 | The 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 | |||
| 797 | | =sidebar-header= | folder names there | | 797 | | =sidebar-header= | folder names there | |
| 798 | | =modeline-background= | the modeline and message line | | 798 | | =modeline-background= | the modeline and message line | |
| 799 | | =modeline-foreground= | modeline text | | 799 | | =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 | |
| 801 | | =state-normal= | the NORMAL tag (Doom keys) | | 801 | | =state-normal= | the NORMAL tag (Doom keys) | |
| 802 | | =state-insert= | the INSERT tag | | 802 | | =state-insert= | the INSERT tag | |
| 803 | | =state-visual= | the VISUAL and V-LINE tags | | 803 | | =state-visual= | the VISUAL and V-LINE tags | |
l10n/Localizable.xcstrings −11 · view
| @@ -41155,17 +41155,6 @@ | |||
| 41155 | } | 41155 | } |
| 41156 | } | 41156 | } |
| 41157 | } | 41157 | } |
| 41158 | }, | ||
| 41159 | "⏱ %@ %@": { | ||
| 41160 | "localizations": { | ||
| 41161 | "en": { | ||
| 41162 | "stringUnit": { | ||
| 41163 | "state": "new", | ||
| 41164 | "value": "⏱ %1$@ %2$@" | ||
| 41165 | } | ||
| 41166 | } | ||
| 41167 | }, | ||
| 41168 | "shouldTranslate": false | ||
| 41169 | } | 41158 | } |
| 41170 | }, | 41159 | }, |
| 41171 | "version": "1.1" | 41160 | "version": "1.1" |