v0.33.2 57f21d6

webui_gateway.go RawHistoryFolder

1package config
2
3import (
4	"context"
5	"fmt"
6
7	"github.com/bnema/dumber/internal/application/dto"
8)
9
10type WebUIConfigGateway struct {
11	mgr *Manager
12}
13
14func NewWebUIConfigGateway(mgr *Manager) *WebUIConfigGateway {
15	return &WebUIConfigGateway{mgr: mgr}
16}
17
18// SaveWebUIConfig maps an already validated and normalized WebUI config onto
19// the stored config and saves it. Policy lives in SaveWebUIConfigUseCase.
20func (g *WebUIConfigGateway) SaveWebUIConfig(ctx context.Context, cfg dto.WebUIConfig) error {
21	_ = ctx
22	if g == nil || g.mgr == nil {
23		return fmt.Errorf("config manager not initialized")
24	}
25
26	current := Get()
27	current.Appearance.SansFont = cfg.Appearance.SansFont
28	current.Appearance.SerifFont = cfg.Appearance.SerifFont
29	current.Appearance.MonospaceFont = cfg.Appearance.MonospaceFont
30	current.Appearance.GtkFont = cfg.Appearance.GtkFont
31	current.Appearance.DefaultFontSize = cfg.Appearance.DefaultFontSize
32	current.Appearance.ColorScheme = cfg.Appearance.ColorScheme
33	current.Appearance.LightPalette = ColorPalette{
34		Background:     cfg.Appearance.LightPalette.Background,
35		Surface:        cfg.Appearance.LightPalette.Surface,
36		SurfaceVariant: cfg.Appearance.LightPalette.SurfaceVariant,
37		Text:           cfg.Appearance.LightPalette.Text,
38		Muted:          cfg.Appearance.LightPalette.Muted,
39		Accent:         cfg.Appearance.LightPalette.Accent,
40		Border:         cfg.Appearance.LightPalette.Border,
41	}
42	current.Appearance.DarkPalette = ColorPalette{
43		Background:     cfg.Appearance.DarkPalette.Background,
44		Surface:        cfg.Appearance.DarkPalette.Surface,
45		SurfaceVariant: cfg.Appearance.DarkPalette.SurfaceVariant,
46		Text:           cfg.Appearance.DarkPalette.Text,
47		Muted:          cfg.Appearance.DarkPalette.Muted,
48		Accent:         cfg.Appearance.DarkPalette.Accent,
49		Border:         cfg.Appearance.DarkPalette.Border,
50	}
51	current.Appearance.ExternalTheme = cfg.Appearance.ExternalTheme
52	current.DefaultUIScale = cfg.DefaultUIScale
53	current.DefaultSearchEngine = cfg.DefaultSearchEngine
54	if len(cfg.SearchShortcuts) == 0 {
55		current.SearchShortcuts = nil
56	} else {
57		shortcuts := make(map[string]SearchShortcut, len(cfg.SearchShortcuts))
58		for key, shortcut := range cfg.SearchShortcuts {
59			shortcuts[key] = SearchShortcut{
60				URL:         shortcut.URL,
61				Description: shortcut.Description,
62			}
63		}
64		current.SearchShortcuts = shortcuts
65	}
66
67	// Performance profile (requires restart to take effect)
68	if cfg.Performance.Profile != "" {
69		current.Engine.Profile = PerformanceProfile(cfg.Performance.Profile)
70	}
71
72	// Custom performance fields (only used when profile is "custom")
73	if cfg.Performance.Profile == string(ProfileCustom) {
74		custom := cfg.Performance.Custom
75		current.Engine.WebKit.SkiaCPUPaintingThreads = custom.SkiaCPUThreads
76		current.Engine.WebKit.SkiaGPUPaintingThreads = custom.SkiaGPUThreads
77		current.Engine.WebKit.WebProcessMemoryLimitMB = custom.WebProcessMemoryMB
78		current.Engine.WebKit.NetworkProcessMemoryLimitMB = custom.NetworkProcessMemoryMB
79		current.Engine.PoolPrewarmCount = custom.WebViewPoolPrewarm
80	}
81
82	return g.mgr.Save(current)
83}

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