1package config
2
3// Default configuration constants
4const (
5 // History defaults
6 defaultMaxHistoryEntries = 10000 // entries
7 defaultRetentionDays = 365 // 1 year
8
9 // Dmenu defaults
10 defaultMaxHistoryItems = 20 // items
11
12 // Logging defaults
13 defaultMaxLogAgeDays = 7 // days
14
15 // Appearance defaults
16 defaultFontSize = 16 // points
17
18 // Omnibox defaults
19 defaultOmniboxInitialBehavior = "recent"
20
21 // Workspace defaults
22 defaultPaneActivationShortcut = "ctrl+p"
23 defaultPaneTimeoutMilliseconds = 3000
24 defaultTabActivationShortcut = "ctrl+t"
25 defaultTabTimeoutMilliseconds = 3000
26 defaultTabBarPosition = "bottom"
27 defaultPopupPlacement = "right"
28
29 // Workspace styling defaults
30 // Active pane border (overlay)
31 defaultBorderWidth = 1
32 defaultBorderColor = "@theme_selected_bg_color"
33
34 // Pane mode border (Ctrl+P N - overlay)
35 defaultPaneModeBorderWidth = 4
36 defaultPaneModeBorderColor = "#4A90E2" // Blue for pane mode indicator
37
38 // Tab mode border (Ctrl+P T - overlay)
39 defaultTabModeBorderWidth = 4
40 defaultTabModeBorderColor = "#FFA500" // Orange for tab mode indicator
41
42 // Other styling
43 defaultTransitionDuration = 120
44 defaultUIScale = 1.0 // UI scale multiplier (1.0 = 100%, 1.2 = 120%)
45
46 // Performance defaults
47 defaultZoomCacheSize = 256 // domains to cache (~20KB memory)
48 defaultWebViewPoolPrewarmCount = 4 // WebViews to pre-create at startup
49)
50
51// getDefaultLogDir returns the default log directory, falls back to empty string on error
52func getDefaultLogDir() string {
53 logDir, err := GetLogDir()
54 if err != nil {
55 return ""
56 }
57 return logDir
58}
59
60// DefaultConfig returns the default configuration values for dumber.
61func DefaultConfig() *Config {
62 return &Config{
63 Database: DatabaseConfig{
64 // Path is set dynamically in config.Load()
65 },
66 History: HistoryConfig{
67 MaxEntries: defaultMaxHistoryEntries,
68 RetentionPeriodDays: defaultRetentionDays, // 1 year
69 CleanupIntervalDays: 1, // daily cleanup
70 },
71 SearchShortcuts: GetDefaultSearchShortcuts(),
72 DefaultSearchEngine: "https://duckduckgo.com/?q=%s",
73 Dmenu: DmenuConfig{
74 MaxHistoryItems: defaultMaxHistoryItems,
75 ShowVisitCount: true,
76 ShowLastVisited: true,
77 HistoryPrefix: "🕒",
78 ShortcutPrefix: "🔍",
79 URLPrefix: "🌐",
80 DateFormat: "2006-01-02 15:04",
81 SortByVisitCount: true,
82 },
83 Logging: LoggingConfig{
84 Level: "info",
85 Format: "text", // text or json
86 MaxAge: defaultMaxLogAgeDays,
87 LogDir: getDefaultLogDir(),
88 EnableFileLog: true,
89 CaptureConsole: false, // Disabled by default
90 },
91 Appearance: AppearanceConfig{
92 SansFont: "Fira Sans",
93 SerifFont: "Fira Sans",
94 MonospaceFont: "Fira Code",
95 DefaultFontSize: defaultFontSize,
96 LightPalette: ColorPalette{
97 Background: "#fafafa",
98 Surface: "#f4f4f5",
99 SurfaceVariant: "#e4e4e7",
100 Text: "#18181b",
101 Muted: "#71717a",
102 Accent: "#22c55e", // Green-500 - vibrant primary
103 Border: "#d4d4d8",
104 },
105 DarkPalette: ColorPalette{
106 Background: "#0a0a0b",
107 Surface: "#18181b",
108 SurfaceVariant: "#27272a",
109 Text: "#fafafa",
110 Muted: "#a1a1aa",
111 Accent: "#4ade80", // Green-400 - vibrant primary
112 Border: "#3f3f46",
113 },
114 ColorScheme: "default", // default follows system theme
115 },
116 Debug: DebugConfig{
117 EnableDevTools: true,
118 },
119 Rendering: RenderingConfig{
120 Mode: RenderingModeGPU,
121 DisableDMABufRenderer: false,
122 ForceCompositingMode: false,
123 DisableCompositingMode: false,
124 GSKRenderer: GSKRendererAuto, // Let GTK choose - Vulkan can conflict with WebKit's DMA-BUF
125 DisableMipmaps: false,
126 PreferGL: false,
127 DrawCompositingIndicators: false,
128 ShowFPS: false,
129 SampleMemory: false,
130 DebugFrames: false,
131 },
132 DefaultWebpageZoom: 1.2, // 120% default zoom for better readability
133 DefaultUIScale: defaultUIScale, // 1.0 = 100%, 2.0 = 200%
134 Workspace: WorkspaceConfig{
135 PaneMode: PaneModeConfig{
136 ActivationShortcut: defaultPaneActivationShortcut,
137 TimeoutMilliseconds: defaultPaneTimeoutMilliseconds,
138 Actions: map[string][]string{
139 "split-right": {"arrowright", "r"},
140 "split-left": {"arrowleft", "l"},
141 "split-up": {"arrowup", "u"},
142 "split-down": {"arrowdown", "d"},
143 "stack-pane": {"s"},
144 "close-pane": {"x"},
145 "focus-right": {"shift+arrowright", "shift+l"},
146 "focus-left": {"shift+arrowleft", "shift+h"},
147 "focus-up": {"shift+arrowup", "shift+k"},
148 "focus-down": {"shift+arrowdown", "shift+j"},
149 "confirm": {"enter"},
150 "cancel": {"escape"},
151 },
152 },
153 TabMode: TabModeConfig{
154 ActivationShortcut: defaultTabActivationShortcut,
155 TimeoutMilliseconds: defaultTabTimeoutMilliseconds,
156 Actions: map[string][]string{
157 "new-tab": {"n", "c"},
158 "close-tab": {"x"},
159 "next-tab": {"l", "tab"},
160 "previous-tab": {"h", "shift+tab"},
161 "rename-tab": {"r"},
162 "confirm": {"enter"},
163 "cancel": {"escape"},
164 },
165 },
166 Shortcuts: GlobalShortcutsConfig{
167 ClosePane: "ctrl+w",
168 NextTab: "ctrl+tab",
169 PreviousTab: "ctrl+shift+tab",
170 },
171 TabBarPosition: defaultTabBarPosition,
172 HideTabBarWhenSingleTab: true,
173 Popups: PopupBehaviorConfig{
174 Behavior: PopupBehaviorSplit, // Default: open JavaScript popups in split panes
175 Placement: defaultPopupPlacement,
176 OpenInNewPane: true,
177 FollowPaneContext: true,
178 BlankTargetBehavior: "stacked", // Default: open _blank links in stacked mode
179 EnableSmartDetection: true, // Use WindowProperties to detect popup vs tab
180 OAuthAutoClose: true, // Auto-close OAuth popups on success
181 },
182 Styling: WorkspaceStylingConfig{
183 BorderWidth: defaultBorderWidth,
184 BorderColor: defaultBorderColor,
185 PaneModeBorderWidth: defaultPaneModeBorderWidth,
186 PaneModeBorderColor: defaultPaneModeBorderColor,
187 TabModeBorderWidth: defaultTabModeBorderWidth,
188 TabModeBorderColor: defaultTabModeBorderColor,
189 TransitionDuration: defaultTransitionDuration,
190 },
191 },
192 ContentFiltering: ContentFilteringConfig{
193 Enabled: true, // Ad blocking enabled by default
194 AutoUpdate: true, // Auto-update filters from GitHub releases
195 },
196 Omnibox: OmniboxConfig{
197 InitialBehavior: defaultOmniboxInitialBehavior,
198 },
199 Media: MediaConfig{
200 HardwareDecodingMode: HardwareDecodingAuto, // auto allows sw fallback
201 PreferAV1: false, // Don't force codec preference, let site choose
202 ShowDiagnosticsOnStartup: false, // Disabled - diagnostics can be noisy
203 ForceVSync: false, // Let compositor handle VSync
204 GLRenderingMode: GLRenderingModeAuto, // GStreamer picks best GL API
205 GStreamerDebugLevel: 0, // Disabled by default
206 VideoBufferSizeMB: 0, // Not a valid GStreamer env var, removed
207 QueueBufferTimeSec: 0, // Not a valid GStreamer env var, removed
208 },
209 Runtime: RuntimeConfig{
210 Prefix: "",
211 },
212 Performance: PerformanceConfig{
213 ZoomCacheSize: defaultZoomCacheSize,
214 WebViewPoolPrewarmCount: defaultWebViewPoolPrewarmCount,
215 },
216 }
217}
218
219// GetDefaultSearchShortcuts returns the default search shortcuts.
220func GetDefaultSearchShortcuts() map[string]SearchShortcut {
221 return map[string]SearchShortcut{
222 "ddg": {
223 URL: "https://duckduckgo.com/?q=%s",
224 Description: "DuckDuckGo search",
225 },
226 "g": {
227 URL: "https://www.google.com/search?q=%s",
228 Description: "Google search",
229 },
230 "gi": {
231 URL: "https://www.google.com/search?tbm=isch&q=%s",
232 Description: "Google Images search",
233 },
234 "gh": {
235 URL: "https://github.com/search?q=%s",
236 Description: "GitHub search",
237 },
238 "go": {
239 URL: "https://pkg.go.dev/search?q=%s",
240 Description: "Go package search",
241 },
242 "mdn": {
243 URL: "https://developer.mozilla.org/en-US/search?q=%s",
244 Description: "MDN Web Docs search",
245 },
246 "npm": {
247 URL: "https://www.npmjs.com/search?q=%s",
248 Description: "npm package search",
249 },
250 "r": {
251 URL: "https://www.reddit.com/search?q=%s",
252 Description: "Reddit search",
253 },
254 "so": {
255 URL: "https://stackoverflow.com/search?q=%s",
256 Description: "Stack Overflow search",
257 },
258 "w": {
259 URL: "https://en.wikipedia.org/wiki/%s",
260 Description: "Wikipedia search",
261 },
262 "yt": {
263 URL: "https://www.youtube.com/results?search_query=%s",
264 Description: "YouTube search",
265 },
266 }
267}