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// ResizeModeConfig holds resize mode shortcut configuration.
82type ResizeModeConfig 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 StepPercent float64 `mapstructure:"step_percent" yaml:"step_percent" toml:"step_percent" json:"step_percent"`
86 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
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 (r *ResizeModeConfig) GetKeyBindings() map[string]string {
92 return keyBindingsFromActions(r.Actions)
93}
94
95// SessionModeConfig holds session mode shortcut configuration.
96type SessionModeConfig 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 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
100}
101
102// GetKeyBindings returns a map from key string to action name.
103func (s *SessionModeConfig) GetKeyBindings() map[string]string {
104 return keyBindingsFromActions(s.Actions)
105}
106
107// SessionConfig holds session persistence and restoration settings.
108type SessionConfig struct {
109 AutoRestore bool `mapstructure:"auto_restore" yaml:"auto_restore" toml:"auto_restore" json:"auto_restore"`
110
111 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
112
113 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
114
115 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
116
117 SessionMode SessionModeConfig `mapstructure:"session_mode" yaml:"session_mode" toml:"session_mode" json:"session_mode"`
118}
119
120// GlobalShortcutsConfig holds workspace-level global shortcut bindings.
121type GlobalShortcutsConfig struct {
122 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
123}
124
125// GetKeyBindings returns a map from key string to action name.
126func (g *GlobalShortcutsConfig) GetKeyBindings() map[string]string {
127 return keyBindingsFromActions(g.Actions)
128}
129
130// FloatingPaneProfile defines a named floating pane preset.
131type FloatingPaneProfile struct {
132 Keys []string `mapstructure:"keys" yaml:"keys" toml:"keys" json:"keys"`
133 URL string `mapstructure:"url" yaml:"url" toml:"url" json:"url"`
134 Desc string `mapstructure:"desc" yaml:"desc" toml:"desc" json:"desc,omitempty"`
135}
136
137// FloatingPaneConfig holds floating pane layout and profile settings.
138type FloatingPaneConfig struct {
139 WidthPct float64 `mapstructure:"width_pct" yaml:"width_pct" toml:"width_pct" json:"width_pct"`
140 HeightPct float64 `mapstructure:"height_pct" yaml:"height_pct" toml:"height_pct" json:"height_pct"`
141 Profiles map[string]FloatingPaneProfile `mapstructure:"profiles" yaml:"profiles" toml:"profiles" json:"profiles"`
142}
143
144// WorkspaceStylingConfig defines visual styling for workspace elements.
145type WorkspaceStylingConfig struct {
146 BorderWidth int `mapstructure:"border_width" yaml:"border_width" toml:"border_width" json:"border_width"`
147 BorderColor string `mapstructure:"border_color" yaml:"border_color" toml:"border_color" json:"border_color"`
148 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
149
150 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
151 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
152 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
153 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
154
155 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
156
157 TransitionDuration int `mapstructure:"transition_duration" yaml:"transition_duration" toml:"transition_duration" json:"transition_duration"` //nolint:lll // struct tags must stay on one line
158}
159
160// PopupBehavior defines how a popup is placed in the workspace.
161type PopupBehavior string
162
163const (
164 PopupBehaviorSplit PopupBehavior = "split"
165 PopupBehaviorStacked PopupBehavior = "stacked"
166 PopupBehaviorTabbed PopupBehavior = "tabbed"
167 PopupBehaviorWindowed PopupBehavior = "windowed"
168)
169
170// OmniboxInitialBehavior controls what the omnibox shows for empty input.
171type OmniboxInitialBehavior string
172
173const (
174 OmniboxInitialBehaviorRecent OmniboxInitialBehavior = "recent"
175 OmniboxInitialBehaviorMostVisited OmniboxInitialBehavior = "most_visited"
176 OmniboxInitialBehaviorNone OmniboxInitialBehavior = "none"
177)
178
179// BrowsingContextConfig controls how browsing contexts (popups, tabs, new windows) are handled.
180// This is the canonical config type; PopupBehaviorConfig is a compatibility alias.
181type BrowsingContextConfig struct {
182 Behavior PopupBehavior `mapstructure:"behavior" yaml:"behavior" toml:"behavior" json:"behavior"`
183
184 Placement string `mapstructure:"placement" yaml:"placement" toml:"placement" json:"placement"`
185
186 OpenInNewPane bool `mapstructure:"open_in_new_pane" yaml:"open_in_new_pane" toml:"open_in_new_pane" json:"open_in_new_pane"`
187
188 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
189
190 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
191
192 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
193
194 OAuthAutoClose bool `mapstructure:"oauth_auto_close" yaml:"oauth_auto_close" toml:"oauth_auto_close" json:"oauth_auto_close"`
195}
196
197// Deprecated: PopupBehaviorConfig is a compatibility alias for BrowsingContextConfig.
198type PopupBehaviorConfig = BrowsingContextConfig
199
200// WorkspaceConfig holds all workspace layout and behavior settings.
201type WorkspaceConfig struct {
202 NewPaneURL string `mapstructure:"new_pane_url" yaml:"new_pane_url" toml:"new_pane_url" json:"new_pane_url"`
203 PaneMode PaneModeConfig `mapstructure:"pane_mode" yaml:"pane_mode" toml:"pane_mode" json:"pane_mode"`
204 TabMode TabModeConfig `mapstructure:"tab_mode" yaml:"tab_mode" toml:"tab_mode" json:"tab_mode"`
205 ResizeMode ResizeModeConfig `mapstructure:"resize_mode" yaml:"resize_mode" toml:"resize_mode" json:"resize_mode"`
206 Shortcuts GlobalShortcutsConfig `mapstructure:"shortcuts" yaml:"shortcuts" toml:"shortcuts" json:"shortcuts"`
207 FloatingPane FloatingPaneConfig `mapstructure:"floating_pane" yaml:"floating_pane" toml:"floating_pane" json:"floating_pane"`
208
209 TabBarPosition string `mapstructure:"tab_bar_position" yaml:"tab_bar_position" toml:"tab_bar_position" json:"tab_bar_position"`
210 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
211 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
212
213 // BrowsingContexts is the canonical field for browsing context behavior.
214 // It replaces the legacy popups configuration.
215 BrowsingContexts BrowsingContextConfig `mapstructure:"browsing_contexts" yaml:"browsing_contexts" toml:"browsing_contexts" json:"browsing_contexts"` //nolint:lll // struct tags must stay on one line
216
217 // Popups is a runtime compatibility alias synced from BrowsingContexts during normalization.
218 // It is not serialized or deserialized from config files.
219 Popups BrowsingContextConfig `mapstructure:"-" yaml:"-" toml:"-" json:"-"`
220
221 Styling WorkspaceStylingConfig `mapstructure:"styling" yaml:"styling" toml:"styling" json:"styling"`
222}
223
224// UpdateConfig holds auto-update behavior settings.
225type UpdateConfig struct {
226 EnableOnStartup bool `mapstructure:"enable_on_startup" yaml:"enable_on_startup" toml:"enable_on_startup"`
227 AutoDownload bool `mapstructure:"auto_download" yaml:"auto_download" toml:"auto_download"`
228 NotifyOnNewSettings bool `mapstructure:"notify_on_new_settings" yaml:"notify_on_new_settings" toml:"notify_on_new_settings"`
229}