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 }
65}
66
67// GetDefaultSearchShortcuts returns the default search shortcuts.
68func GetDefaultSearchShortcuts() map[string]SearchShortcut {
69 return map[string]SearchShortcut{
70 "g": {
71 URL: "https://www.google.com/search?q=%s",
72 Description: "Google search",
73 },
74 "gh": {
75 URL: "https://github.com/search?q=%s",
76 Description: "GitHub search",
77 },
78 "yt": {
79 URL: "https://www.youtube.com/results?search_query=%s",
80 Description: "YouTube search",
81 },
82 "w": {
83 URL: "https://en.wikipedia.org/wiki/%s",
84 Description: "Wikipedia search",
85 },
86 "ddg": {
87 URL: "https://duckduckgo.com/?q=%s",
88 Description: "DuckDuckGo search",
89 },
90 "so": {
91 URL: "https://stackoverflow.com/search?q=%s",
92 Description: "Stack Overflow search",
93 },
94 "r": {
95 URL: "https://www.reddit.com/search?q=%s",
96 Description: "Reddit search",
97 },
98 "npm": {
99 URL: "https://www.npmjs.com/search?q=%s",
100 Description: "npm package search",
101 },
102 "go": {
103 URL: "https://pkg.go.dev/search?q=%s",
104 Description: "Go package search",
105 },
106 "mdn": {
107 URL: "https://developer.mozilla.org/en-US/search?q=%s",
108 Description: "MDN Web Docs search",
109 },
110 }
111}
112
113// Note: We build our own browser, so no external browser commands needed