| 1 | package config |
| 2 | |
| 3 | import "strings" |
| 4 | |
| 5 | // DesktopConfig controls desktop-only UI preferences. It is intentionally |
| 6 | // separate from top-level language and [ui] so desktop choices do not affect CLI |
| 7 | // language, terminal colours, or provider-visible prompt/request data. |
| 8 | type DesktopConfig struct { |
| 9 | Language string `toml:"language"` // auto|en|zh; empty/auto = browser/OS auto-detect |
| 10 | Currency string `toml:"currency"` // legacy display currency; migrated to [billing].display_currency |
| 11 | LayoutStyle string `toml:"layout_style"` // workbench|creation; legacy classic is migrated on startup |
| 12 | Theme string `toml:"theme"` // auto|dark|light; empty resolves to auto |
| 13 | ThemeStyle string `toml:"theme_style"` // graphite|aurora|slate|carbon|nocturne|amber and legacy aliases |
| 14 | TerminalTheme string `toml:"terminal_theme"` // auto|dark|light; auto follows the desktop app theme |
| 15 | ExternalOpener string `toml:"external_opener"` // preferred installed app used by the desktop Open control |
| 16 | CloseBehavior string `toml:"close_behavior"` // quit|background; desktop window close behavior |
| 17 | DisplayMode string `toml:"display_mode"` // standard|compact (legacy "minimal" maps to compact); transcript display mode |
| 18 | StatusBarStyle string `toml:"status_bar_style"` // icon|text; desktop status bar metric labels |
| 19 | StatusBarStyleInitialized bool `toml:"status_bar_style_initialized"` // one-time icon default upgrade; later choices are user-owned |
| 20 | StatusBarItems []string `toml:"status_bar_items"` // ordered visible desktop status bar items |
| 21 | DefaultToolApprovalMode string `toml:"default_tool_approval_mode"` // read-only|workspace-write|danger-full-access; defaults to workspace-write |
| 22 | CheckUpdates *bool `toml:"check_updates"` // startup update checks; nil keeps the default enabled |
| 23 | // UpdateChannel is a legacy compatibility field. It is accepted on read but |
| 24 | // ignored and omitted from future canonical writes. |
| 25 | UpdateChannel string `toml:"update_channel"` |
| 26 | Telemetry *bool `toml:"telemetry"` // anonymous launch ping plus scrubbed next-launch native crash diagnostics; nil keeps the default enabled |
| 27 | Metrics *bool `toml:"metrics"` // aggregate desktop metrics (anonymous signal/bucket counts, including lifecycle health; no content); nil keeps the default enabled |
| 28 | ProviderAccess []string `toml:"provider_access"` // desktop-only list of provider entries shown in Settings > Model > Access |
| 29 | SessionExperience string `toml:"session_experience"` // standard|deep; canonical desktop transcript experience |
| 30 | ExpandThinking bool `toml:"expand_thinking"` // deprecated compatibility alias: true maps to auto |
| 31 | ReasoningDisplayMode string `toml:"reasoning_display_mode"` |
| 32 | ConversationWidth string `toml:"conversation_width"` // standard|full; max transcript width; empty = standard |
| 33 | } |
| 34 | |
| 35 | // DesktopExternalOpener returns the selected opener id; unavailable ids fall |
| 36 | // back to the platform file manager in the desktop shell. |
| 37 | func (c *Config) DesktopExternalOpener() string { |
| 38 | if c == nil { |
| 39 | return "" |
| 40 | } |
| 41 | return strings.ToLower(strings.TrimSpace(c.Desktop.ExternalOpener)) |
| 42 | } |
| 43 |