1// Package config provides default configuration values for dumber.
2package config
3
4import (
5 "time"
6)
7
8// DefaultConfig returns the default configuration values for dumber.
9func DefaultConfig() *Config {
10 return &Config{
11 Database: DatabaseConfig{
12 MaxConnections: 1,
13 MaxIdleTime: time.Minute * 5,
14 QueryTimeout: time.Second * 30,
15 },
16 History: HistoryConfig{
17 MaxEntries: 10000,
18 RetentionPeriodDays: 365, // 1 year
19 CleanupIntervalDays: 1, // daily cleanup
20 },
21 SearchShortcuts: map[string]SearchShortcut{
22 "g": {
23 URL: "https://www.google.com/search?q=%s",
24 Description: "Google search",
25 },
26 "gh": {
27 URL: "https://github.com/search?q=%s",
28 Description: "GitHub search",
29 },
30 "yt": {
31 URL: "https://www.youtube.com/results?search_query=%s",
32 Description: "YouTube search",
33 },
34 "w": {
35 URL: "https://en.wikipedia.org/wiki/%s",
36 Description: "Wikipedia search",
37 },
38 },
39 Dmenu: DmenuConfig{
40 MaxHistoryItems: 20,
41 ShowVisitCount: true,
42 ShowLastVisited: true,
43 HistoryPrefix: "🕒",
44 ShortcutPrefix: "🔍",
45 URLPrefix: "🌐",
46 DateFormat: "2006-01-02 15:04",
47 SortByVisitCount: true,
48 },
49 Logging: LoggingConfig{
50 Level: "info",
51 Format: "text", // text or json
52 Filename: "", // empty means stdout
53 MaxSize: 100, // MB
54 MaxBackups: 3,
55 MaxAge: 7, // days
56 Compress: true,
57 },
58 Appearance: AppearanceConfig{
59 SansFont: "Fira Sans",
60 SerifFont: "Fira Sans",
61 MonospaceFont: "Fira Code",
62 DefaultFontSize: 16,
63 },
64 RenderingMode: RenderingModeAuto,
65 }
66}
67
68// GetDefaultSearchShortcuts returns the default search shortcuts.
69func GetDefaultSearchShortcuts() map[string]SearchShortcut {
70 return map[string]SearchShortcut{
71 "g": {
72 URL: "https://www.google.com/search?q=%s",
73 Description: "Google search",
74 },
75 "gh": {
76 URL: "https://github.com/search?q=%s",
77 Description: "GitHub search",
78 },
79 "yt": {
80 URL: "https://www.youtube.com/results?search_query=%s",
81 Description: "YouTube search",
82 },
83 "w": {
84 URL: "https://en.wikipedia.org/wiki/%s",
85 Description: "Wikipedia search",
86 },
87 "ddg": {
88 URL: "https://duckduckgo.com/?q=%s",
89 Description: "DuckDuckGo search",
90 },
91 "so": {
92 URL: "https://stackoverflow.com/search?q=%s",
93 Description: "Stack Overflow search",
94 },
95 "r": {
96 URL: "https://www.reddit.com/search?q=%s",
97 Description: "Reddit search",
98 },
99 "npm": {
100 URL: "https://www.npmjs.com/search?q=%s",
101 Description: "npm package search",
102 },
103 "go": {
104 URL: "https://pkg.go.dev/search?q=%s",
105 Description: "Go package search",
106 },
107 "mdn": {
108 URL: "https://developer.mozilla.org/en-US/search?q=%s",
109 Description: "MDN Web Docs search",
110 },
111 }
112}
113
114// Note: We build our own browser, so no external browser commands needed