v0.22.0 a85da87

webui_gateway.go RawHistoryFolder

1package config
2
3import (
4	"context"
5	"fmt"
6
7	"github.com/bnema/dumber/internal/application/port"
8)
9
10type WebUIConfigGateway struct {
11	mgr *Manager
12}
13
14func NewWebUIConfigGateway(mgr *Manager) *WebUIConfigGateway {
15	return &WebUIConfigGateway{mgr: mgr}
16}
17
18func (g *WebUIConfigGateway) SaveWebUIConfig(ctx context.Context, cfg port.WebUIConfig) error {
19	_ = ctx
20	if g == nil || g.mgr == nil {
21		return fmt.Errorf("config manager not initialized")
22	}
23
24	current := Get()
25	current.Appearance.SansFont = cfg.Appearance.SansFont
26	current.Appearance.SerifFont = cfg.Appearance.SerifFont
27	current.Appearance.MonospaceFont = cfg.Appearance.MonospaceFont
28	current.Appearance.DefaultFontSize = cfg.Appearance.DefaultFontSize
29	current.Appearance.ColorScheme = cfg.Appearance.ColorScheme
30	current.Appearance.LightPalette = ColorPalette{
31		Background:     cfg.Appearance.LightPalette.Background,
32		Surface:        cfg.Appearance.LightPalette.Surface,
33		SurfaceVariant: cfg.Appearance.LightPalette.SurfaceVariant,
34		Text:           cfg.Appearance.LightPalette.Text,
35		Muted:          cfg.Appearance.LightPalette.Muted,
36		Accent:         cfg.Appearance.LightPalette.Accent,
37		Border:         cfg.Appearance.LightPalette.Border,
38	}
39	current.Appearance.DarkPalette = ColorPalette{
40		Background:     cfg.Appearance.DarkPalette.Background,
41		Surface:        cfg.Appearance.DarkPalette.Surface,
42		SurfaceVariant: cfg.Appearance.DarkPalette.SurfaceVariant,
43		Text:           cfg.Appearance.DarkPalette.Text,
44		Muted:          cfg.Appearance.DarkPalette.Muted,
45		Accent:         cfg.Appearance.DarkPalette.Accent,
46		Border:         cfg.Appearance.DarkPalette.Border,
47	}
48	current.DefaultUIScale = cfg.DefaultUIScale
49	current.DefaultSearchEngine = cfg.DefaultSearchEngine
50	if len(cfg.SearchShortcuts) == 0 {
51		current.SearchShortcuts = nil
52	} else {
53		shortcuts := make(map[string]SearchShortcut, len(cfg.SearchShortcuts))
54		for key, shortcut := range cfg.SearchShortcuts {
55			shortcuts[key] = SearchShortcut{
56				URL:         shortcut.URL,
57				Description: shortcut.Description,
58			}
59		}
60		current.SearchShortcuts = shortcuts
61	}
62
63	return g.mgr.Save(current)
64}

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