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// KeymapPreset selects how workspace modes are activated.
82type KeymapPreset string
83
84const (
85 // KeymapZellij activates each mode with its own shortcut (Ctrl+P, Ctrl+T, ...).
86 KeymapZellij KeymapPreset = "zellij"
87 // KeymapTmux activates a single one-shot prefix key; mode shortcuts are unbound.
88 KeymapTmux KeymapPreset = "tmux"
89)
90
91// PrefixModeConfig holds the tmux-style one-shot prefix configuration.
92type PrefixModeConfig struct {
93 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
94 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
95 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
96}
97
98// GetKeyBindings returns a map from key string to action name.
99func (p *PrefixModeConfig) GetKeyBindings() map[string]string {
100 return keyBindingsFromActions(p.Actions)
101}
102
103// VimModeConfig holds vim scroll mode shortcut configuration.
104type VimModeConfig struct {
105 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
106 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
107 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
108 PreloadAccessibility bool `mapstructure:"preload_accessibility" yaml:"preload_accessibility" toml:"preload_accessibility" json:"preload_accessibility"` //nolint:lll // struct tags must stay on one line
109 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
110}
111
112// GetKeyBindings returns a map from key string to action name.
113func (p *VimModeConfig) GetKeyBindings() map[string]string {
114 return keyBindingsFromActions(p.Actions)
115}
116
117// ResizeModeConfig holds resize mode shortcut configuration.
118type ResizeModeConfig struct {
119 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
120 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
121 StepPercent float64 `mapstructure:"step_percent" yaml:"step_percent" toml:"step_percent" json:"step_percent"`
122 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
123 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
124}
125
126// GetKeyBindings returns a map from key string to action name.
127func (r *ResizeModeConfig) GetKeyBindings() map[string]string {
128 return keyBindingsFromActions(r.Actions)
129}
130
131// SessionModeConfig holds session mode shortcut configuration.
132type SessionModeConfig struct {
133 ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" toml:"activation_shortcut" json:"activation_shortcut"` //nolint:lll // struct tags must stay on one line
134 TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" toml:"timeout_ms" json:"timeout_ms"`
135 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
136}
137
138// GetKeyBindings returns a map from key string to action name.
139func (s *SessionModeConfig) GetKeyBindings() map[string]string {
140 return keyBindingsFromActions(s.Actions)
141}
142
143// SessionConfig holds session persistence and restoration settings.
144type SessionConfig struct {
145 AutoRestore bool `mapstructure:"auto_restore" yaml:"auto_restore" toml:"auto_restore" json:"auto_restore"`
146
147 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
148
149 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
150
151 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
152
153 SessionMode SessionModeConfig `mapstructure:"session_mode" yaml:"session_mode" toml:"session_mode" json:"session_mode"`
154}
155
156// GlobalShortcutsConfig holds workspace-level global shortcut bindings.
157type GlobalShortcutsConfig struct {
158 Actions map[string]ActionBinding `mapstructure:"actions" yaml:"actions" toml:"actions" json:"actions"`
159}
160
161// GetKeyBindings returns a map from key string to action name.
162func (g *GlobalShortcutsConfig) GetKeyBindings() map[string]string {
163 return keyBindingsFromActions(g.Actions)
164}
165
166// FloatingPaneProfile defines a named floating pane preset.
167type FloatingPaneProfile struct {
168 Keys []string `mapstructure:"keys" yaml:"keys" toml:"keys" json:"keys"`
169 URL string `mapstructure:"url" yaml:"url" toml:"url" json:"url"`
170 Desc string `mapstructure:"desc" yaml:"desc" toml:"desc" json:"desc,omitempty"`
171}
172
173// FloatingPaneConfig holds floating pane layout and profile settings.
174type FloatingPaneConfig struct {
175 WidthPct float64 `mapstructure:"width_pct" yaml:"width_pct" toml:"width_pct" json:"width_pct"`
176 HeightPct float64 `mapstructure:"height_pct" yaml:"height_pct" toml:"height_pct" json:"height_pct"`
177 Profiles map[string]FloatingPaneProfile `mapstructure:"profiles" yaml:"profiles" toml:"profiles" json:"profiles"`
178}
179
180// WorkspaceStylingConfig defines visual styling for workspace elements.
181type WorkspaceStylingConfig struct {
182 BorderWidth int `mapstructure:"border_width" yaml:"border_width" toml:"border_width" json:"border_width"`
183 BorderColor string `mapstructure:"border_color" yaml:"border_color" toml:"border_color" json:"border_color"`
184 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
185
186 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
187 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
188 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
189 VimModeColor string `mapstructure:"vim_mode_color" yaml:"vim_mode_color" toml:"vim_mode_color" json:"vim_mode_color"` //nolint:lll // struct tags must stay on one line
190 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
191
192 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
193 ModeLegend string `mapstructure:"mode_legend" yaml:"mode_legend" toml:"mode_legend" json:"mode_legend"`
194 ModeLegendDelayMs int `mapstructure:"mode_legend_delay_ms" yaml:"mode_legend_delay_ms" toml:"mode_legend_delay_ms" json:"mode_legend_delay_ms"` //nolint:lll // struct tags must stay on one line
195 ModeLegendLinger bool `mapstructure:"mode_legend_linger" yaml:"mode_legend_linger" toml:"mode_legend_linger" json:"mode_legend_linger"` //nolint:lll // struct tags must stay on one line
196 ModeLegendAnimations bool `mapstructure:"mode_legend_animations" yaml:"mode_legend_animations" toml:"mode_legend_animations" json:"mode_legend_animations"` //nolint:lll // struct tags must stay on one line
197 ModeLegendCollapsed bool `mapstructure:"mode_legend_collapsed" yaml:"mode_legend_collapsed" toml:"mode_legend_collapsed" json:"mode_legend_collapsed"` //nolint:lll // struct tags must stay on one line
198
199 TransitionDuration int `mapstructure:"transition_duration" yaml:"transition_duration" toml:"transition_duration" json:"transition_duration"` //nolint:lll // struct tags must stay on one line
200}
201
202// PopupBehavior defines how a popup is placed in the workspace.
203type PopupBehavior string
204
205const (
206 PopupBehaviorSplit PopupBehavior = "split"
207 PopupBehaviorStacked PopupBehavior = "stacked"
208 PopupBehaviorTabbed PopupBehavior = "tabbed"
209 PopupBehaviorWindowed PopupBehavior = "windowed"
210)
211
212// OmniboxInitialBehavior controls what the omnibox shows for empty input.
213type OmniboxInitialBehavior string
214
215const (
216 OmniboxInitialBehaviorRecent OmniboxInitialBehavior = "recent"
217 OmniboxInitialBehaviorMostVisited OmniboxInitialBehavior = "most_visited"
218 OmniboxInitialBehaviorNone OmniboxInitialBehavior = "none"
219)
220
221// BrowsingContextConfig controls how browsing contexts (popups, tabs, new windows) are handled.
222// This is the canonical config type; PopupBehaviorConfig is a compatibility alias.
223type BrowsingContextConfig struct {
224 Behavior PopupBehavior `mapstructure:"behavior" yaml:"behavior" toml:"behavior" json:"behavior"`
225
226 Placement string `mapstructure:"placement" yaml:"placement" toml:"placement" json:"placement"`
227
228 OpenInNewPane bool `mapstructure:"open_in_new_pane" yaml:"open_in_new_pane" toml:"open_in_new_pane" json:"open_in_new_pane"`
229
230 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
231
232 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
233
234 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
235
236 OAuthAutoClose bool `mapstructure:"oauth_auto_close" yaml:"oauth_auto_close" toml:"oauth_auto_close" json:"oauth_auto_close"`
237}
238
239// Deprecated: PopupBehaviorConfig is a compatibility alias for BrowsingContextConfig.
240type PopupBehaviorConfig = BrowsingContextConfig
241
242// ExternalLinkBehavior defines how externally opened URLs are placed in the workspace.
243type ExternalLinkBehavior string
244
245const (
246 ExternalLinkBehaviorWindowed ExternalLinkBehavior = "windowed"
247 ExternalLinkBehaviorTabbed ExternalLinkBehavior = "tabbed"
248 ExternalLinkBehaviorSplit ExternalLinkBehavior = "split"
249 ExternalLinkBehaviorStacked ExternalLinkBehavior = "stacked"
250)
251
252// ExternalLinkPlacement defines the direction used when splitting for an external URL.
253type ExternalLinkPlacement string
254
255const (
256 ExternalLinkPlacementRight ExternalLinkPlacement = "right"
257 ExternalLinkPlacementLeft ExternalLinkPlacement = "left"
258 ExternalLinkPlacementTop ExternalLinkPlacement = "top"
259 ExternalLinkPlacementBottom ExternalLinkPlacement = "bottom"
260)
261
262// ExternalLinksConfig controls how externally opened URLs are placed in the workspace.
263type ExternalLinksConfig struct {
264 Behavior ExternalLinkBehavior `mapstructure:"behavior" yaml:"behavior" toml:"behavior" json:"behavior"`
265 Placement ExternalLinkPlacement `mapstructure:"placement" yaml:"placement" toml:"placement" json:"placement"`
266}
267
268// WorkspaceConfig holds all workspace layout and behavior settings.
269type WorkspaceConfig struct {
270 NewPaneURL string `mapstructure:"new_pane_url" yaml:"new_pane_url" toml:"new_pane_url" json:"new_pane_url"`
271 Keymap KeymapPreset `mapstructure:"keymap" yaml:"keymap" toml:"keymap" json:"keymap"`
272 PrefixMode PrefixModeConfig `mapstructure:"prefix_mode" yaml:"prefix_mode" toml:"prefix_mode" json:"prefix_mode"`
273 PaneMode PaneModeConfig `mapstructure:"pane_mode" yaml:"pane_mode" toml:"pane_mode" json:"pane_mode"`
274 TabMode TabModeConfig `mapstructure:"tab_mode" yaml:"tab_mode" toml:"tab_mode" json:"tab_mode"`
275 VimMode VimModeConfig `mapstructure:"vim_mode" yaml:"vim_mode" toml:"vim_mode" json:"vim_mode"`
276 ResizeMode ResizeModeConfig `mapstructure:"resize_mode" yaml:"resize_mode" toml:"resize_mode" json:"resize_mode"`
277 Shortcuts GlobalShortcutsConfig `mapstructure:"shortcuts" yaml:"shortcuts" toml:"shortcuts" json:"shortcuts"`
278 FloatingPane FloatingPaneConfig `mapstructure:"floating_pane" yaml:"floating_pane" toml:"floating_pane" json:"floating_pane"`
279 ExternalLinks ExternalLinksConfig `mapstructure:"external_links" yaml:"external_links" toml:"external_links" json:"external_links"`
280
281 TabBarPosition string `mapstructure:"tab_bar_position" yaml:"tab_bar_position" toml:"tab_bar_position" json:"tab_bar_position"`
282 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
283 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
284
285 // BrowsingContexts is the canonical field for browsing context behavior.
286 // It replaces the legacy popups configuration.
287 BrowsingContexts BrowsingContextConfig `mapstructure:"browsing_contexts" yaml:"browsing_contexts" toml:"browsing_contexts" json:"browsing_contexts"` //nolint:lll // struct tags must stay on one line
288
289 // Popups is a runtime compatibility alias synced from BrowsingContexts during normalization.
290 // It is not serialized or deserialized from config files.
291 Popups BrowsingContextConfig `mapstructure:"-" yaml:"-" toml:"-" json:"-"`
292
293 Styling WorkspaceStylingConfig `mapstructure:"styling" yaml:"styling" toml:"styling" json:"styling"`
294}
295
296// UpdateConfig holds auto-update behavior settings.
297type UpdateConfig struct {
298 EnableOnStartup bool `mapstructure:"enable_on_startup" yaml:"enable_on_startup" toml:"enable_on_startup"`
299 AutoDownload bool `mapstructure:"auto_download" yaml:"auto_download" toml:"auto_download"`
300 NotifyOnNewSettings bool `mapstructure:"notify_on_new_settings" yaml:"notify_on_new_settings" toml:"notify_on_new_settings"`
301}