v0.5.0 f906adb

defaults.go RawHistoryFolder

1// Package config provides default configuration values for dumber.
2package config
3
4import (
5	"time"
6)
7
8// Default configuration constants
9const (
10	// Database defaults
11	defaultMaxIdleTimeMin   = 5  // minutes
12	defaultQueryTimeoutSec  = 30 // seconds
13
14	// History defaults  
15	defaultMaxHistoryEntries = 10000 // entries
16	defaultRetentionDays     = 365   // 1 year
17
18	// Dmenu defaults
19	defaultMaxHistoryItems = 20 // items
20
21	// Logging defaults
22	defaultMaxLogSizeMB  = 100 // MB
23	defaultMaxBackups    = 3   // backup files
24	defaultMaxLogAgeDays = 7   // days
25
26	// Appearance defaults
27	defaultFontSize = 16 // points
28)
29
30// getDefaultLogDir returns the default log directory, falls back to empty string on error
31func getDefaultLogDir() string {
32	logDir, err := GetLogDir()
33	if err != nil {
34		return ""
35	}
36	return logDir
37}
38
39// DefaultConfig returns the default configuration values for dumber.
40func DefaultConfig() *Config {
41	return &Config{
42		Database: DatabaseConfig{
43			MaxConnections: 1,
44			MaxIdleTime:    time.Minute * defaultMaxIdleTimeMin,
45			QueryTimeout:   time.Second * defaultQueryTimeoutSec,
46		},
47		History: HistoryConfig{
48			MaxEntries:          defaultMaxHistoryEntries,
49			RetentionPeriodDays: defaultRetentionDays, // 1 year
50			CleanupIntervalDays: 1,                    // daily cleanup
51		},
52		SearchShortcuts: map[string]SearchShortcut{
53			"g": {
54				URL:         "https://www.google.com/search?q=%s",
55				Description: "Google search",
56			},
57			"gh": {
58				URL:         "https://github.com/search?q=%s",
59				Description: "GitHub search",
60			},
61			"yt": {
62				URL:         "https://www.youtube.com/results?search_query=%s",
63				Description: "YouTube search",
64			},
65			"w": {
66				URL:         "https://en.wikipedia.org/wiki/%s",
67				Description: "Wikipedia search",
68			},
69		},
70		Dmenu: DmenuConfig{
71			MaxHistoryItems:  defaultMaxHistoryItems,
72			ShowVisitCount:   true,
73			ShowLastVisited:  true,
74			HistoryPrefix:    "🕒",
75			ShortcutPrefix:   "🔍",
76			URLPrefix:        "🌐",
77			DateFormat:       "2006-01-02 15:04",
78			SortByVisitCount: true,
79		},
80		Logging: LoggingConfig{
81			Level:         "info",
82			Format:        "text", // text or json
83			Filename:      "",     // empty means stdout
84			MaxSize:       defaultMaxLogSizeMB, // MB
85			MaxBackups:    defaultMaxBackups,
86			MaxAge:        defaultMaxLogAgeDays, // days
87			Compress:      true,
88			LogDir:        getDefaultLogDir(),
89			EnableFileLog: true,
90			CaptureStdout: false,
91			CaptureStderr: false,
92			CaptureCOutput: false, // Disabled by default to avoid performance impact
93			DebugFile:     "debug.log",
94			VerboseWebKit: false,
95		},
96		Appearance: AppearanceConfig{
97			SansFont:        "Fira Sans",
98			SerifFont:       "Fira Sans",
99			MonospaceFont:   "Fira Code",
100			DefaultFontSize: defaultFontSize,
101		},
102		VideoAcceleration: VideoAccelerationConfig{
103			EnableVAAPI:      true,
104			AutoDetectGPU:    true,
105			VAAPIDriverName:  "", // Will be auto-detected
106			EnableAllDrivers: true,
107			LegacyVAAPI:      false,
108		},
109		RenderingMode: RenderingModeAuto,
110	}
111}
112
113// GetDefaultSearchShortcuts returns the default search shortcuts.
114func GetDefaultSearchShortcuts() map[string]SearchShortcut {
115	return map[string]SearchShortcut{
116		"g": {
117			URL:         "https://www.google.com/search?q=%s",
118			Description: "Google search",
119		},
120		"gh": {
121			URL:         "https://github.com/search?q=%s",
122			Description: "GitHub search",
123		},
124		"yt": {
125			URL:         "https://www.youtube.com/results?search_query=%s",
126			Description: "YouTube search",
127		},
128		"w": {
129			URL:         "https://en.wikipedia.org/wiki/%s",
130			Description: "Wikipedia search",
131		},
132		"ddg": {
133			URL:         "https://duckduckgo.com/?q=%s",
134			Description: "DuckDuckGo search",
135		},
136		"so": {
137			URL:         "https://stackoverflow.com/search?q=%s",
138			Description: "Stack Overflow search",
139		},
140		"r": {
141			URL:         "https://www.reddit.com/search?q=%s",
142			Description: "Reddit search",
143		},
144		"npm": {
145			URL:         "https://www.npmjs.com/search?q=%s",
146			Description: "npm package search",
147		},
148		"go": {
149			URL:         "https://pkg.go.dev/search?q=%s",
150			Description: "Go package search",
151		},
152		"mdn": {
153			URL:         "https://developer.mozilla.org/en-US/search?q=%s",
154			Description: "MDN Web Docs search",
155		},
156	}
157}
158
159// Note: We build our own browser, so no external browser commands needed

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