Documentation
¶
Overview ¶
Package prefs holds the desktop app's preferences and small state (ADR-0021; docs/specs/ui.md#settings-batch-2): one versioned JSON file per device, whose defaults are Obsidian's. A stored value that is not one a preference takes falls back to its default, so an older or newer file never breaks the window. It ports app/src/data/prefs.ts.
Index ¶
Constants ¶
const MaxRecentCommands = 10
MaxRecentCommands is how many commands the palette remembers.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Prefs ¶
type Prefs struct {
DefaultView string `json:"defaultView"` // edit, read
EditingMode string `json:"editingMode"` // live, source
InlineTitle bool `json:"inlineTitle"`
ViewHeader bool `json:"viewHeader"`
ReadableLineLength bool `json:"readableLineLength"`
Properties string `json:"properties"` // visible, hidden, source
LineNumbers bool `json:"lineNumbers"`
IndentGuides bool `json:"indentGuides"`
FoldHeadings bool `json:"foldHeadings"`
FoldIndent bool `json:"foldIndent"`
AutoPairBrackets bool `json:"autoPairBrackets"`
AutoPairMarkdown bool `json:"autoPairMarkdown"`
SmartLists bool `json:"smartLists"`
IndentWithTabs bool `json:"indentWithTabs"`
TabSize int `json:"tabSize"`
ConfirmDelete bool `json:"confirmDelete"`
LoadRemoteImages bool `json:"loadRemoteImages"`
ShowUnsupported bool `json:"showUnsupported"`
Theme string `json:"theme"` // system, light, dark
FontSize int `json:"fontSize"`
Zoom float64 `json:"zoom"`
LastVault string `json:"lastVault"`
}
Prefs are the app's preferences.
type State ¶
type State struct {
Pending []WorkspaceEvent `json:"pending,omitzero"`
PendingSeq int64 `json:"pendingSeq,omitzero"`
Seq int64 `json:"seq"`
RecentCommands []string `json:"recentCommands"`
}
State is what the app keeps between runs that is no preference: the event resume point and the commands run lately.
func (*State) RanCommand ¶
RanCommand puts id first among the recent commands.
type WorkspaceEvent ¶
type WorkspaceEvent struct {
VaultID int64 `json:"vaultId"`
From string `json:"from"`
To string `json:"to,omitzero"`
}
WorkspaceEvent is a move or removal held until the vault list is available. To is empty for a removal; paths remain relative to VaultID.