Sources/Orgstar/Preferences.swift

e4d9b52b0ed18dbbe6402e33315f0e989b737988
orgstar/Sources/Orgstar/Preferences.swift

33 lines · 1724 bytes

 1import Foundation
 2import OrgApp
 3import OrgCore
 4
 5/// Org preferences, stored in user defaults by the Settings window.
 6enum Preferences {
 7    static let defaultTodoKeywords = "TODO(t) PROJ(p) LOOP(r) STRT(s) WAIT(w) HOLD(h) IDEA(i) | DONE(d) KILL(k)"
 8
 9    /// TODO keywords for files without `#+TODO`, read at launch.
10    @MainActor
11    static var orgSettings: OrgSettings {
12        // config.toml applies before anything reads settings.
13        ConfigSync.shared.start()
14        let line = UserDefaults.standard.string(forKey: "todoKeywords") ?? defaultTodoKeywords
15        return OrgSettings.default.withTodoKeywords(line) ?? .default
16    }
17
18    static func options(
19        tagsColumn: Int, headingAfterSubtree: Bool, splitLine: Bool, alphabeticalLists: Bool, fillColumn: Int,
20        hiddenMarkers: Bool, prettyEntities: Bool, logDone: String, logIntoDrawer: String,
21        hideDrawerStartup: Bool, hideBlockStartup: Bool, logReschedule: String, logRedeadline: String, useSpeedCommands: Bool
22    ) -> EditingOptions {
23        EditingOptions(
24            tagsColumn: tagsColumn, insertHeadingRespectContent: headingAfterSubtree,
25            metaReturnMaySplitLine: splitLine, listAllowAlphabetical: alphabeticalLists, fillColumn: fillColumn,
26            hideEmphasisMarkers: hiddenMarkers, prettyEntities: prettyEntities, subSuperscriptsNeedBraces: true,
27            logDone: LogHow(rawValue: logDone), logIntoDrawer: logIntoDrawer.isEmpty ? nil : logIntoDrawer,
28            hideDrawerStartup: hideDrawerStartup, hideBlockStartup: hideBlockStartup,
29            logReschedule: LogHow(rawValue: logReschedule), logRedeadline: LogHow(rawValue: logRedeadline),
30            useSpeedCommands: useSpeedCommands
31        )
32    }
33}
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