main 5041353

webui_config.go RawHistoryFolder

1package dto
2
3import "github.com/bnema/dumber/internal/domain/entity"
4
5// WebUIConfig represents the subset of configuration editable in dumb://config.
6type WebUIConfig struct {
7	Appearance          WebUIAppearanceConfig     `json:"appearance"`
8	Performance         WebUIPerformanceConfig    `json:"performance"`
9	DefaultUIScale      float64                   `json:"default_ui_scale"`
10	DefaultSearchEngine string                    `json:"default_search_engine"`
11	SearchShortcuts     map[string]SearchShortcut `json:"search_shortcuts"`
12}
13
14// SystemviewCustomPerformancePayload is the editable custom performance profile shape.
15type SystemviewCustomPerformancePayload = WebUICustomPerformanceConfig
16
17// SystemviewResolvedPerformancePayload is the resolved effective performance shape.
18type SystemviewResolvedPerformancePayload struct {
19	SkiaCPUThreads         int     `json:"skia_cpu_threads"`
20	SkiaGPUThreads         int     `json:"skia_gpu_threads"`
21	WebProcessMemoryMB     int     `json:"web_process_memory_mb"`
22	NetworkProcessMemoryMB int     `json:"network_process_memory_mb"`
23	WebViewPoolPrewarm     int     `json:"webview_pool_prewarm"`
24	ConservativeThreshold  float64 `json:"conservative_threshold"`
25	StrictThreshold        float64 `json:"strict_threshold"`
26}
27
28// SystemviewHardwarePayload exposes detected hardware to the settings UI.
29type SystemviewHardwarePayload struct {
30	CPUCores   int    `json:"cpu_cores"`
31	CPUThreads int    `json:"cpu_threads"`
32	TotalRAMMB int    `json:"total_ram_mb"`
33	GPUVendor  string `json:"gpu_vendor"`
34	GPUName    string `json:"gpu_name"`
35	VRAMMB     int    `json:"vram_mb"`
36}
37
38// SystemviewPerformancePayload is the performance tab payload expected by the UI.
39type SystemviewPerformancePayload struct {
40	Profile  string                               `json:"profile"`
41	Custom   SystemviewCustomPerformancePayload   `json:"custom"`
42	Resolved SystemviewResolvedPerformancePayload `json:"resolved"`
43	Hardware SystemviewHardwarePayload            `json:"hardware"`
44}
45
46// SystemviewConfigPayload is the full JSON shape expected by dumb://config.
47type SystemviewConfigPayload struct {
48	// Appearance is the editable config snapshot.
49	Appearance WebUIAppearanceConfig `json:"appearance"`
50	// ResolvedAppearance is optional, display-only appearance resolved from config
51	// plus external theme sources. Forms must save Appearance, never this field.
52	ResolvedAppearance  *WebUIAppearanceConfig       `json:"resolved_appearance,omitempty"`
53	Performance         SystemviewPerformancePayload `json:"performance"`
54	DefaultUIScale      float64                      `json:"default_ui_scale"`
55	DefaultSearchEngine string                       `json:"default_search_engine"`
56	SearchShortcuts     map[string]SearchShortcut    `json:"search_shortcuts"`
57	EngineType          string                       `json:"engine_type"`
58}
59
60// WebUIPerformanceConfig represents performance settings editable in dumb://config.
61type WebUIPerformanceConfig struct {
62	Profile string                       `json:"profile"`
63	Custom  WebUICustomPerformanceConfig `json:"custom"`
64}
65
66// WebUICustomPerformanceConfig holds user-editable fields for custom profile.
67type WebUICustomPerformanceConfig struct {
68	SkiaCPUThreads         int `json:"skia_cpu_threads"`
69	SkiaGPUThreads         int `json:"skia_gpu_threads"`
70	WebProcessMemoryMB     int `json:"web_process_memory_mb"`
71	NetworkProcessMemoryMB int `json:"network_process_memory_mb"`
72	WebViewPoolPrewarm     int `json:"webview_pool_prewarm"`
73}
74
75type WebUIAppearanceConfig = entity.AppearanceConfig
76
77type WebUIExternalThemeConfig = entity.ExternalThemeConfig
78
79type ColorPalette = entity.ColorPalette
80
81type SearchShortcut struct {
82	URL         string `json:"url"`
83	Description string `json:"description"`
84}
85
86// WebUIAppearanceWithResolvedTheme builds a display-only appearance payload from
87// resolved theme values while preserving fields that are not theme-resolution
88// outputs, such as ColorScheme and ExternalTheme.
89func WebUIAppearanceWithResolvedTheme(base WebUIAppearanceConfig, resolved entity.ResolvedTheme) WebUIAppearanceConfig {
90	base.SansFont = resolved.Fonts.SansFont
91	base.SerifFont = resolved.Fonts.SerifFont
92	base.MonospaceFont = resolved.Fonts.MonospaceFont
93	base.GtkFont = resolved.Fonts.GtkFont
94	base.DefaultFontSize = resolved.Fonts.DefaultSize
95	base.LightPalette = resolved.LightPalette
96	base.DarkPalette = resolved.DarkPalette
97	return base
98}

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