config_types.go RawHistoryFolder
1package entity
2
3// Config value types shared between infrastructure/config and the UI layer.
4// Keeping these in domain/entity allows UI packages to use them without
5// importing infrastructure/config.
6
7// AppearanceConfig holds visual appearance settings.
8type AppearanceConfig struct {
9 SansFont string `mapstructure:"sans_font" yaml:"sans_font" toml:"sans_font" json:"sans_font"`
10 SerifFont string `mapstructure:"serif_font" yaml:"serif_font" toml:"serif_font" json:"serif_font"`
11 MonospaceFont string `mapstructure:"monospace_font" yaml:"monospace_font" toml:"monospace_font" json:"monospace_font"`
12 GtkFont string `mapstructure:"gtk_font" yaml:"gtk_font" toml:"gtk_font" json:"gtk_font"`
13 DefaultFontSize int `mapstructure:"default_font_size" yaml:"default_font_size" toml:"default_font_size" json:"default_font_size"` //nolint:lll // struct tags must stay on one line
14 LightPalette ColorPalette `mapstructure:"light_palette" yaml:"light_palette" toml:"light_palette" json:"light_palette"`
15 DarkPalette ColorPalette `mapstructure:"dark_palette" yaml:"dark_palette" toml:"dark_palette" json:"dark_palette"`
16 ColorScheme string `mapstructure:"color_scheme" yaml:"color_scheme" toml:"color_scheme" json:"color_scheme"`
17 ExternalTheme ExternalThemeConfig `mapstructure:"external_theme" yaml:"external_theme" toml:"external_theme" json:"external_theme"`
18}
19
20// ExternalThemeConfig controls optional external theme loading.
21type ExternalThemeConfig struct {
22 Enabled bool `mapstructure:"enabled" yaml:"enabled" toml:"enabled" json:"enabled"`
23 Provider string `mapstructure:"provider" yaml:"provider" toml:"provider" json:"provider"`
24 Format string `mapstructure:"format" yaml:"format" toml:"format" json:"format"`
25 Path string `mapstructure:"path" yaml:"path" toml:"path" json:"path"`
26}
27
28// ColorPalette defines the color scheme for a theme variant (light/dark).
29type ColorPalette struct {
30 Background string `mapstructure:"background" yaml:"background" toml:"background" json:"background"`
31 Surface string `mapstructure:"surface" yaml:"surface" toml:"surface" json:"surface"`
32 SurfaceVariant string `mapstructure:"surface_variant" yaml:"surface_variant" toml:"surface_variant" json:"surface_variant"`
33 Text string `mapstructure:"text" yaml:"text" toml:"text" json:"text"`
34 Muted string `mapstructure:"muted" yaml:"muted" toml:"muted" json:"muted"`
35 Accent string `mapstructure:"accent" yaml:"accent" toml:"accent" json:"accent"`
36 Border string `mapstructure:"border" yaml:"border" toml:"border" json:"border"`
37}
38
39// ActionBinding maps a config action name to key bindings.
40type ActionBinding struct {
41 Keys []string `mapstructure:"keys" yaml:"keys" toml:"keys" json:"keys"`
42 Desc string `mapstructure:"desc" yaml:"desc" toml:"desc" json:"desc,omitempty"`
43}
44
45// PaneModeConfig holds pane mode shortcut configuration.
46type PaneModeConfig struct {
47 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
48 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
49 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
50}
51
52// keyBindingsFromActions converts an action binding map to a key→action map.
53// This is the canonical implementation shared by all GetKeyBindings methods.
54func keyBindingsFromActions(actions map[string]ActionBinding) map[string]string {
55 keyToAction := make(map[string]string)
56 for action, binding := range actions {
57 for _, key := range binding.Keys {
58 keyToAction[key] = action
59 }
60 }
61 return keyToAction
62}
63
64// GetKeyBindings returns a map from key string to action name.
65func (p *PaneModeConfig) GetKeyBindings() map[string]string {
66 return keyBindingsFromActions(p.Actions)
67}
68
69// TabModeConfig holds tab mode shortcut configuration.
70type TabModeConfig struct {
71 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
72 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
73 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
74}
75
76// GetKeyBindings returns a map from key string to action name.
77func (t *TabModeConfig) GetKeyBindings() map[string]string {
78 return keyBindingsFromActions(t.Actions)
79}
80
81// VimModeConfig holds vim scroll mode shortcut configuration.
82type VimModeConfig struct {
83 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
84 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
85 SequenceTimeoutMilliseconds int `mapstructure:"sequence_timeout_ms" yaml:"sequence_timeout_ms" toml:"sequence_timeout_ms" json:"sequence_timeout_ms"` //nolint:lll // struct tags must stay on one line
86 PreloadAccessibility bool `mapstructure:"preload_accessibility" yaml:"preload_accessibility" toml:"preload_accessibility" json:"preload_accessibility"` //nolint:lll // struct tags must stay on one line
87 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
88}
89
90// GetKeyBindings returns a map from key string to action name.
91func (p *VimModeConfig) GetKeyBindings() map[string]string {
92 return keyBindingsFromActions(p.Actions)
93}
94
95// ResizeModeConfig holds resize mode shortcut configuration.
96type ResizeModeConfig struct {
97 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
98 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
99 StepPercent float64 `mapstructure:"step_percent" yaml:"step_percent" toml:"step_percent" json:"step_percent"`
100 MinPanePercent float64 `mapstructure:"min_pane_percent" yaml:"min_pane_percent" toml:"min_pane_percent" json:"min_pane_percent"` //nolint:lll // struct tags must stay on one line
101 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
102}
103
104// GetKeyBindings returns a map from key string to action name.
105func (r *ResizeModeConfig) GetKeyBindings() map[string]string {
106 return keyBindingsFromActions(r.Actions)
107}
108
109// SessionModeConfig holds session mode shortcut configuration.
110type SessionModeConfig struct {
111 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
112 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
113 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
114}
115
116// GetKeyBindings returns a map from key string to action name.
117func (s *SessionModeConfig) GetKeyBindings() map[string]string {
118 return keyBindingsFromActions(s.Actions)
119}
120
121// SessionConfig holds session persistence and restoration settings.
122type SessionConfig struct {
123 AutoRestore bool `mapstructure:"auto_restore" yaml:"auto_restore" toml:"auto_restore" json:"auto_restore"`
124
125 SnapshotIntervalMs int `mapstructure:"snapshot_interval_ms" yaml:"snapshot_interval_ms" toml:"snapshot_interval_ms" json:"snapshot_interval_ms"` //nolint:lll // struct tags must stay on one line
126
127 MaxExitedSessions int `mapstructure:"max_exited_sessions" yaml:"max_exited_sessions" toml:"max_exited_sessions" json:"max_exited_sessions"` //nolint:lll // struct tags must stay on one line
128
129 MaxExitedSessionAgeDays int `mapstructure:"max_exited_session_age_days" yaml:"max_exited_session_age_days" toml:"max_exited_session_age_days" json:"max_exited_session_age_days"` //nolint:lll // struct tags must stay on one line
130
131 SessionMode SessionModeConfig `mapstructure:"session_mode" yaml:"session_mode" toml:"session_mode" json:"session_mode"`
132}
133
134// GlobalShortcutsConfig holds workspace-level global shortcut bindings.
135type GlobalShortcutsConfig struct {
136 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
137}
138
139// GetKeyBindings returns a map from key string to action name.
140func (g *GlobalShortcutsConfig) GetKeyBindings() map[string]string {
141 return keyBindingsFromActions(g.Actions)
142}
143
144// FloatingPaneProfile defines a named floating pane preset.
145type FloatingPaneProfile struct {
146 Keys []string `mapstructure:"keys" yaml:"keys" toml:"keys" json:"keys"`
147 URL string `mapstructure:"url" yaml:"url" toml:"url" json:"url"`
148 Desc string `mapstructure:"desc" yaml:"desc" toml:"desc" json:"desc,omitempty"`
149}
150
151// FloatingPaneConfig holds floating pane layout and profile settings.
152type FloatingPaneConfig struct {
153 WidthPct float64 `mapstructure:"width_pct" yaml:"width_pct" toml:"width_pct" json:"width_pct"`
154 HeightPct float64 `mapstructure:"height_pct" yaml:"height_pct" toml:"height_pct" json:"height_pct"`
155 Profiles map[string]FloatingPaneProfile `mapstructure:"profiles" yaml:"profiles" toml:"profiles" json:"profiles"`
156}
157
158// WorkspaceStylingConfig defines visual styling for workspace elements.
159type WorkspaceStylingConfig struct {
160 BorderWidth int `mapstructure:"border_width" yaml:"border_width" toml:"border_width" json:"border_width"`
161 BorderColor string `mapstructure:"border_color" yaml:"border_color" toml:"border_color" json:"border_color"`
162 ModeBorderWidth int `mapstructure:"mode_border_width" yaml:"mode_border_width" toml:"mode_border_width" json:"mode_border_width"` //nolint:lll // struct tags must stay on one line
163
164 PaneModeColor string `mapstructure:"pane_mode_color" yaml:"pane_mode_color" toml:"pane_mode_color" json:"pane_mode_color"` //nolint:lll // struct tags must stay on one line
165 TabModeColor string `mapstructure:"tab_mode_color" yaml:"tab_mode_color" toml:"tab_mode_color" json:"tab_mode_color"` //nolint:lll // struct tags must stay on one line
166 SessionModeColor string `mapstructure:"session_mode_color" yaml:"session_mode_color" toml:"session_mode_color" json:"session_mode_color"` //nolint:lll // struct tags must stay on one line
167 ResizeModeColor string `mapstructure:"resize_mode_color" yaml:"resize_mode_color" toml:"resize_mode_color" json:"resize_mode_color"` //nolint:lll // struct tags must stay on one line
168
169 ModeIndicatorToasterEnabled bool `mapstructure:"mode_indicator_toaster_enabled" yaml:"mode_indicator_toaster_enabled" toml:"mode_indicator_toaster_enabled" json:"mode_indicator_toaster_enabled"` //nolint:lll // struct tags must stay on one line
170
171 TransitionDuration int `mapstructure:"transition_duration" yaml:"transition_duration" toml:"transition_duration" json:"transition_duration"` //nolint:lll // struct tags must stay on one line
172}
173
174// PopupBehavior defines how a popup is placed in the workspace.
175type PopupBehavior string
176
177const (
178 PopupBehaviorSplit PopupBehavior = "split"
179 PopupBehaviorStacked PopupBehavior = "stacked"
180 PopupBehaviorTabbed PopupBehavior = "tabbed"
181 PopupBehaviorWindowed PopupBehavior = "windowed"
182)
183
184// OmniboxInitialBehavior controls what the omnibox shows for empty input.
185type OmniboxInitialBehavior string
186
187const (
188 OmniboxInitialBehaviorRecent OmniboxInitialBehavior = "recent"
189 OmniboxInitialBehaviorMostVisited OmniboxInitialBehavior = "most_visited"
190 OmniboxInitialBehaviorNone OmniboxInitialBehavior = "none"
191)
192
193// BrowsingContextConfig controls how browsing contexts (popups, tabs, new windows) are handled.
194// This is the canonical config type; PopupBehaviorConfig is a compatibility alias.
195type BrowsingContextConfig struct {
196 Behavior PopupBehavior `mapstructure:"behavior" yaml:"behavior" toml:"behavior" json:"behavior"`
197
198 Placement string `mapstructure:"placement" yaml:"placement" toml:"placement" json:"placement"`
199
200 OpenInNewPane bool `mapstructure:"open_in_new_pane" yaml:"open_in_new_pane" toml:"open_in_new_pane" json:"open_in_new_pane"`
201
202 FollowPaneContext bool `mapstructure:"follow_pane_context" yaml:"follow_pane_context" toml:"follow_pane_context" json:"follow_pane_context"` //nolint:lll // struct tags must stay on one line
203
204 BlankTargetBehavior string `mapstructure:"blank_target_behavior" yaml:"blank_target_behavior" toml:"blank_target_behavior" json:"blank_target_behavior"` //nolint:lll // struct tags must stay on one line
205
206 EnableSmartDetection bool `mapstructure:"enable_smart_detection" yaml:"enable_smart_detection" toml:"enable_smart_detection" json:"enable_smart_detection"` //nolint:lll // struct tags must stay on one line
207
208 OAuthAutoClose bool `mapstructure:"oauth_auto_close" yaml:"oauth_auto_close" toml:"oauth_auto_close" json:"oauth_auto_close"`
209}
210
211// Deprecated: PopupBehaviorConfig is a compatibility alias for BrowsingContextConfig.
212type PopupBehaviorConfig = BrowsingContextConfig
213
214// ExternalLinkBehavior defines how externally opened URLs are placed in the workspace.
215type ExternalLinkBehavior string
216
217const (
218 ExternalLinkBehaviorWindowed ExternalLinkBehavior = "windowed"
219 ExternalLinkBehaviorTabbed ExternalLinkBehavior = "tabbed"
220 ExternalLinkBehaviorSplit ExternalLinkBehavior = "split"
221 ExternalLinkBehaviorStacked ExternalLinkBehavior = "stacked"
222)
223
224// ExternalLinkPlacement defines the direction used when splitting for an external URL.
225type ExternalLinkPlacement string
226
227const (
228 ExternalLinkPlacementRight ExternalLinkPlacement = "right"
229 ExternalLinkPlacementLeft ExternalLinkPlacement = "left"
230 ExternalLinkPlacementTop ExternalLinkPlacement = "top"
231 ExternalLinkPlacementBottom ExternalLinkPlacement = "bottom"
232)
233
234// ExternalLinksConfig controls how externally opened URLs are placed in the workspace.
235type ExternalLinksConfig struct {
236 Behavior ExternalLinkBehavior `mapstructure:"behavior" yaml:"behavior" toml:"behavior" json:"behavior"`
237 Placement ExternalLinkPlacement `mapstructure:"placement" yaml:"placement" toml:"placement" json:"placement"`
238}
239
240// WorkspaceConfig holds all workspace layout and behavior settings.
241type WorkspaceConfig struct {
242 NewPaneURL string `mapstructure:"new_pane_url" yaml:"new_pane_url" toml:"new_pane_url" json:"new_pane_url"`
243 PaneMode PaneModeConfig `mapstructure:"pane_mode" yaml:"pane_mode" toml:"pane_mode" json:"pane_mode"`
244 TabMode TabModeConfig `mapstructure:"tab_mode" yaml:"tab_mode" toml:"tab_mode" json:"tab_mode"`
245 VimMode VimModeConfig `mapstructure:"vim_mode" yaml:"vim_mode" toml:"vim_mode" json:"vim_mode"`
246 ResizeMode ResizeModeConfig `mapstructure:"resize_mode" yaml:"resize_mode" toml:"resize_mode" json:"resize_mode"`
247 Shortcuts GlobalShortcutsConfig `mapstructure:"shortcuts" yaml:"shortcuts" toml:"shortcuts" json:"shortcuts"`
248 FloatingPane FloatingPaneConfig `mapstructure:"floating_pane" yaml:"floating_pane" toml:"floating_pane" json:"floating_pane"`
249 ExternalLinks ExternalLinksConfig `mapstructure:"external_links" yaml:"external_links" toml:"external_links" json:"external_links"`
250
251 TabBarPosition string `mapstructure:"tab_bar_position" yaml:"tab_bar_position" toml:"tab_bar_position" json:"tab_bar_position"`
252 HideTabBarWhenSingleTab bool `mapstructure:"hide_tab_bar_when_single_tab" yaml:"hide_tab_bar_when_single_tab" toml:"hide_tab_bar_when_single_tab" json:"hide_tab_bar_when_single_tab"` //nolint:lll // struct tags must stay on one line
253 SwitchToTabOnMove bool `mapstructure:"switch_to_tab_on_move" yaml:"switch_to_tab_on_move" toml:"switch_to_tab_on_move" json:"switch_to_tab_on_move"` //nolint:lll // struct tags must stay on one line
254
255 // BrowsingContexts is the canonical field for browsing context behavior.
256 // It replaces the legacy popups configuration.
257 BrowsingContexts BrowsingContextConfig `mapstructure:"browsing_contexts" yaml:"browsing_contexts" toml:"browsing_contexts" json:"browsing_contexts"` //nolint:lll // struct tags must stay on one line
258
259 // Popups is a runtime compatibility alias synced from BrowsingContexts during normalization.
260 // It is not serialized or deserialized from config files.
261 Popups BrowsingContextConfig `mapstructure:"-" yaml:"-" toml:"-" json:"-"`
262
263 Styling WorkspaceStylingConfig `mapstructure:"styling" yaml:"styling" toml:"styling" json:"styling"`
264}
265
266// UpdateConfig holds auto-update behavior settings.
267type UpdateConfig struct {
268 EnableOnStartup bool `mapstructure:"enable_on_startup" yaml:"enable_on_startup" toml:"enable_on_startup"`
269 AutoDownload bool `mapstructure:"auto_download" yaml:"auto_download" toml:"auto_download"`
270 NotifyOnNewSettings bool `mapstructure:"notify_on_new_settings" yaml:"notify_on_new_settings" toml:"notify_on_new_settings"`
271}