v0.22.0 a85da87

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

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