v0.23.0 d05d132

defaults.go RawHistoryFolder

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	defaultMaxHistoryDays = 30 // days
11
12	// Logging defaults
13	defaultMaxLogAgeDays = 7 // days
14
15	// Appearance defaults
16	defaultFontSize = 16 // points
17
18	// Workspace defaults
19	defaultNewPaneURL = "about:blank"
20
21	// Omnibox defaults
22	defaultOmniboxInitialBehavior   = "recent"
23	defaultOmniboxAutoOpenOnNewPane = false
24
25	// Workspace defaults
26	defaultPaneActivationShortcut    = "ctrl+p"
27	defaultPaneTimeoutMilliseconds   = 3000
28	defaultTabActivationShortcut     = "ctrl+t"
29	defaultTabTimeoutMilliseconds    = 3000
30	defaultResizeActivationShortcut  = "ctrl+n"
31	defaultResizeTimeoutMilliseconds = 3000
32	defaultResizeStepPercent         = 5.0
33	defaultResizeMinPanePercent      = 10.0
34	defaultTabBarPosition            = "bottom"
35	defaultPopupPlacement            = "right"
36
37	// Session defaults
38	defaultSessionActivationShortcut  = "ctrl+o"
39	defaultSessionTimeoutMilliseconds = 3000
40	defaultSnapshotIntervalMs         = 5000
41	defaultMaxExitedSessions          = 50
42	defaultMaxExitedSessionAgeDays    = 7
43
44	// Workspace styling defaults
45	// Active pane border (overlay)
46	defaultBorderWidth = 1
47	defaultBorderColor = "@theme_selected_bg_color"
48
49	// Mode border width (consolidated for all modes)
50	defaultModeBorderWidth = 4
51
52	// Mode colors (used for both borders and toaster)
53	defaultPaneModeColor    = "#4A90E2" // Blue for pane mode
54	defaultTabModeColor     = "#FFA500" // Orange for tab mode
55	defaultSessionModeColor = "#9B59B6" // Purple for session mode
56	defaultResizeModeColor  = "#00D4AA" // Cyan/teal for resize mode
57
58	// Mode indicator toaster
59	defaultModeIndicatorToasterEnabled = true
60
61	// Other styling
62	defaultTransitionDuration = 120
63	defaultUIScale            = 1.0 // UI scale multiplier (1.0 = 100%, 1.2 = 120%)
64
65	// Performance defaults
66	defaultZoomCacheSize           = 256 // domains to cache (~20KB memory)
67	defaultWebViewPoolPrewarmCount = 4   // WebViews to pre-create at startup
68
69	// Skia threading defaults (0 = unset, -1 = unset for GPU threads)
70	defaultSkiaCPUPaintingThreads = 0
71	defaultSkiaGPUPaintingThreads = -1 // -1 means unset; 0 would disable GPU tile painting
72)
73
74// getDefaultLogDir returns the default log directory, falls back to empty string on error
75func getDefaultLogDir() string {
76	logDir, err := GetLogDir()
77	if err != nil {
78		return ""
79	}
80	return logDir
81}
82
83// DefaultConfig returns the default configuration values for dumber.
84func DefaultConfig() *Config {
85	return &Config{
86		Database: DatabaseConfig{
87			// Path is set dynamically in config.Load()
88		},
89		History: HistoryConfig{
90			MaxEntries:          defaultMaxHistoryEntries,
91			RetentionPeriodDays: defaultRetentionDays, // 1 year
92			CleanupIntervalDays: 1,                    // daily cleanup
93		},
94		SearchShortcuts:     GetDefaultSearchShortcuts(),
95		DefaultSearchEngine: "https://duckduckgo.com/?q=%s",
96		Dmenu: DmenuConfig{
97			MaxHistoryDays:   defaultMaxHistoryDays,
98			ShowVisitCount:   true,
99			ShowLastVisited:  true,
100			HistoryPrefix:    "🕒",
101			ShortcutPrefix:   "🔍",
102			URLPrefix:        "🌐",
103			DateFormat:       "2006-01-02 15:04",
104			SortByVisitCount: true,
105		},
106		Logging: LoggingConfig{
107			Level:          "info",
108			Format:         "text", // text or json
109			MaxAge:         defaultMaxLogAgeDays,
110			LogDir:         getDefaultLogDir(),
111			EnableFileLog:  true,
112			CaptureConsole: false, // Disabled by default
113		},
114		Appearance: AppearanceConfig{
115			SansFont:        "Fira Sans",
116			SerifFont:       "Fira Sans",
117			MonospaceFont:   "Fira Code",
118			DefaultFontSize: defaultFontSize,
119			LightPalette: ColorPalette{
120				Background:     "#fafafa",
121				Surface:        "#f4f4f5",
122				SurfaceVariant: "#e4e4e7",
123				Text:           "#18181b",
124				Muted:          "#71717a",
125				Accent:         "#22c55e", // Green-500 - vibrant primary
126				Border:         "#d4d4d8",
127			},
128			DarkPalette: ColorPalette{
129				Background:     "#0a0a0b",
130				Surface:        "#18181b",
131				SurfaceVariant: "#27272a",
132				Text:           "#fafafa",
133				Muted:          "#a1a1aa",
134				Accent:         "#4ade80", // Green-400 - vibrant primary
135				Border:         "#3f3f46",
136			},
137			ColorScheme: "default", // default follows system theme
138		},
139		Debug: DebugConfig{
140			EnableDevTools: true,
141		},
142		Rendering: RenderingConfig{
143			Mode:                      RenderingModeGPU,
144			DisableDMABufRenderer:     false,
145			ForceCompositingMode:      false,
146			DisableCompositingMode:    false,
147			GSKRenderer:               GSKRendererAuto, // Let GTK choose - Vulkan can conflict with WebKit's DMA-BUF
148			DisableMipmaps:            false,
149			PreferGL:                  false,
150			DrawCompositingIndicators: false,
151			ShowFPS:                   false,
152			SampleMemory:              false,
153			DebugFrames:               false,
154		},
155		DefaultWebpageZoom: 1.2,            // 120% default zoom for better readability
156		DefaultUIScale:     defaultUIScale, // 1.0 = 100%, 2.0 = 200%
157		Workspace: WorkspaceConfig{
158			NewPaneURL:        defaultNewPaneURL,
159			SwitchToTabOnMove: true,
160			PaneMode: PaneModeConfig{
161				ActivationShortcut:  defaultPaneActivationShortcut,
162				TimeoutMilliseconds: defaultPaneTimeoutMilliseconds,
163				Actions: map[string][]string{
164					"split-right":           {"arrowright", "r"},
165					"split-left":            {"arrowleft", "l"},
166					"split-up":              {"arrowup", "u"},
167					"split-down":            {"arrowdown", "d"},
168					"stack-pane":            {"s"},
169					"close-pane":            {"x"},
170					"move-pane-to-tab":      {"m"},
171					"move-pane-to-next-tab": {"M", "shift+m"},
172
173					"consume-or-expel-left":  {"bracketleft", "["},
174					"consume-or-expel-right": {"bracketright", "]"},
175					"consume-or-expel-up":    {"shift+bracketleft", "braceleft", "{"},
176					"consume-or-expel-down":  {"shift+bracketright", "braceright", "}"},
177
178					"focus-right": {"shift+arrowright", "shift+l"},
179					"focus-left":  {"shift+arrowleft", "shift+h"},
180					"focus-up":    {"shift+arrowup", "shift+k"},
181					"focus-down":  {"shift+arrowdown", "shift+j"},
182					"confirm":     {"enter"},
183					"cancel":      {"escape"},
184				},
185			},
186			TabMode: TabModeConfig{
187				ActivationShortcut:  defaultTabActivationShortcut,
188				TimeoutMilliseconds: defaultTabTimeoutMilliseconds,
189				Actions: map[string][]string{
190					"new-tab":      {"n", "c"},
191					"close-tab":    {"x"},
192					"next-tab":     {"l", "tab"},
193					"previous-tab": {"h", "shift+tab"},
194					"rename-tab":   {"r"},
195					"confirm":      {"enter"},
196					"cancel":       {"escape"},
197				},
198			},
199			ResizeMode: ResizeModeConfig{
200				ActivationShortcut:  defaultResizeActivationShortcut,
201				TimeoutMilliseconds: defaultResizeTimeoutMilliseconds,
202				StepPercent:         defaultResizeStepPercent,
203				MinPanePercent:      defaultResizeMinPanePercent,
204				Actions: map[string][]string{
205					"resize-increase-left":  {"h", "arrowleft"},
206					"resize-increase-down":  {"j", "arrowdown"},
207					"resize-increase-up":    {"k", "arrowup"},
208					"resize-increase-right": {"l", "arrowright"},
209					"resize-decrease-left":  {"H"},
210					"resize-decrease-down":  {"J"},
211					"resize-decrease-up":    {"K"},
212					"resize-decrease-right": {"L"},
213					"resize-increase":       {"+", "="},
214					"resize-decrease":       {"-"},
215					"confirm":               {"enter"},
216					"cancel":                {"escape"},
217				},
218			},
219			Shortcuts: GlobalShortcutsConfig{
220				ClosePane:   "ctrl+w",
221				NextTab:     "ctrl+tab",
222				PreviousTab: "ctrl+shift+tab",
223
224				ConsumeOrExpelLeft:  "alt+bracketleft",
225				ConsumeOrExpelRight: "alt+bracketright",
226				ConsumeOrExpelUp:    "alt+shift+bracketleft",
227				ConsumeOrExpelDown:  "alt+shift+bracketright",
228			},
229			TabBarPosition:          defaultTabBarPosition,
230			HideTabBarWhenSingleTab: true,
231			Popups: PopupBehaviorConfig{
232				Behavior:             PopupBehaviorSplit, // Default: open JavaScript popups in split panes
233				Placement:            defaultPopupPlacement,
234				OpenInNewPane:        true,
235				FollowPaneContext:    true,
236				BlankTargetBehavior:  "stacked", // Default: open _blank links in stacked mode
237				EnableSmartDetection: true,      // Use WindowProperties to detect popup vs tab
238				OAuthAutoClose:       true,      // Auto-close OAuth popups on success
239			},
240			Styling: WorkspaceStylingConfig{
241				BorderWidth:                 defaultBorderWidth,
242				BorderColor:                 defaultBorderColor,
243				ModeBorderWidth:             defaultModeBorderWidth,
244				PaneModeColor:               defaultPaneModeColor,
245				TabModeColor:                defaultTabModeColor,
246				SessionModeColor:            defaultSessionModeColor,
247				ResizeModeColor:             defaultResizeModeColor,
248				ModeIndicatorToasterEnabled: defaultModeIndicatorToasterEnabled,
249				TransitionDuration:          defaultTransitionDuration,
250			},
251		},
252		ContentFiltering: ContentFilteringConfig{
253			Enabled:    true, // Ad blocking enabled by default
254			AutoUpdate: true, // Auto-update filters from GitHub releases
255		},
256		Omnibox: OmniboxConfig{
257			InitialBehavior:   defaultOmniboxInitialBehavior,
258			AutoOpenOnNewPane: defaultOmniboxAutoOpenOnNewPane,
259		},
260		Session: SessionConfig{
261			AutoRestore:             false,
262			SnapshotIntervalMs:      defaultSnapshotIntervalMs,
263			MaxExitedSessions:       defaultMaxExitedSessions,
264			MaxExitedSessionAgeDays: defaultMaxExitedSessionAgeDays,
265			SessionMode: SessionModeConfig{
266				ActivationShortcut:  defaultSessionActivationShortcut,
267				TimeoutMilliseconds: defaultSessionTimeoutMilliseconds,
268				Actions: map[string][]string{
269					"session-manager": {"s", "w"},
270					"confirm":         {"enter"},
271					"cancel":          {"escape"},
272				},
273			},
274		},
275		Media: MediaConfig{
276			HardwareDecodingMode:     HardwareDecodingAuto, // auto allows sw fallback
277			PreferAV1:                false,                // Don't force codec preference, let site choose
278			ShowDiagnosticsOnStartup: false,                // Disabled - diagnostics can be noisy
279			ForceVSync:               false,                // Let compositor handle VSync
280			GLRenderingMode:          GLRenderingModeAuto,  // GStreamer picks best GL API
281			GStreamerDebugLevel:      0,                    // Disabled by default
282			VideoBufferSizeMB:        0,                    // Not a valid GStreamer env var, removed
283			QueueBufferTimeSec:       0,                    // Not a valid GStreamer env var, removed
284		},
285		Runtime: RuntimeConfig{
286			Prefix: "",
287		},
288		Performance: PerformanceConfig{
289			Profile:                 ProfileDefault, // Use WebKit defaults, no tuning
290			ZoomCacheSize:           defaultZoomCacheSize,
291			WebViewPoolPrewarmCount: defaultWebViewPoolPrewarmCount,
292			// Skia threading - balanced defaults (unset = use WebKit defaults)
293			// These only apply when Profile is "custom"
294			SkiaCPUPaintingThreads: defaultSkiaCPUPaintingThreads,
295			SkiaGPUPaintingThreads: defaultSkiaGPUPaintingThreads,
296			SkiaEnableCPURendering: false,
297			// Web process memory pressure - all unset by default
298			WebProcessMemoryLimitMB:               0,
299			WebProcessMemoryPollIntervalSec:       0,
300			WebProcessMemoryConservativeThreshold: 0,
301			WebProcessMemoryStrictThreshold:       0,
302			// Network process memory pressure - all unset by default
303			NetworkProcessMemoryLimitMB:               0,
304			NetworkProcessMemoryPollIntervalSec:       0,
305			NetworkProcessMemoryConservativeThreshold: 0,
306			NetworkProcessMemoryStrictThreshold:       0,
307		},
308		Update: UpdateConfig{
309			EnableOnStartup:     true,  // Check for updates on startup by default
310			AutoDownload:        false, // Conservative: don't auto-download by default
311			NotifyOnNewSettings: true,  // Show toast when new config settings available
312		},
313	}
314}
315
316// GetDefaultSearchShortcuts returns the default search shortcuts.
317func GetDefaultSearchShortcuts() map[string]SearchShortcut {
318	return map[string]SearchShortcut{
319		"ddg": {
320			URL:         "https://duckduckgo.com/?q=%s",
321			Description: "DuckDuckGo search",
322		},
323		"g": {
324			URL:         "https://www.google.com/search?q=%s",
325			Description: "Google search",
326		},
327		"gi": {
328			URL:         "https://www.google.com/search?tbm=isch&q=%s",
329			Description: "Google Images search",
330		},
331		"gh": {
332			URL:         "https://github.com/search?q=%s",
333			Description: "GitHub search",
334		},
335		"go": {
336			URL:         "https://pkg.go.dev/search?q=%s",
337			Description: "Go package search",
338		},
339		"mdn": {
340			URL:         "https://developer.mozilla.org/en-US/search?q=%s",
341			Description: "MDN Web Docs search",
342		},
343		"npm": {
344			URL:         "https://www.npmjs.com/search?q=%s",
345			Description: "npm package search",
346		},
347		"r": {
348			URL:         "https://www.reddit.com/search?q=%s",
349			Description: "Reddit search",
350		},
351		"so": {
352			URL:         "https://stackoverflow.com/search?q=%s",
353			Description: "Stack Overflow search",
354		},
355		"w": {
356			URL:         "https://en.wikipedia.org/wiki/%s",
357			Description: "Wikipedia search",
358		},
359		"yt": {
360			URL:         "https://www.youtube.com/results?search_query=%s",
361			Description: "YouTube search",
362		},
363	}
364}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close