detached 6563395

refactor(infra): rename blocked to error in scheme handler + expose shortcuts

commit
656339537b046e91a3a82fb28bff743ebd906176
author
bnema · · 2025-12-21 13:53 UTC
parent
d567e75
signature
unsigned
1 file · +16 -12
M internal/infrastructure/webkit/scheme_handler.go +16 -12
@@ -23,10 +23,10 @@ import (
2323
2424 // Scheme path constants
2525 const (
26- HomePath = "home"
27- ConfigPath = "config"
28- BlockedPath = "blocked"
29- IndexHTML = "index.html"
26+ HomePath = "home"
27+ ConfigPath = "config"
28+ ErrorPath = "error"
29+ IndexHTML = "index.html"
3030 )
3131
3232 // SchemeRequest represents a request to a custom URI scheme.
@@ -120,9 +120,11 @@ func (h *DumbSchemeHandler) registerDefaults() {
120120 } `json:"appearance"`
121121 DefaultUIScale float64 `json:"default_ui_scale"`
122122 DefaultSearchEngine string `json:"default_search_engine"`
123+ SearchShortcuts map[string]config.SearchShortcut `json:"search_shortcuts"`
123124 }{
124125 DefaultUIScale: cfg.DefaultUIScale,
125126 DefaultSearchEngine: cfg.DefaultSearchEngine,
127+ SearchShortcuts: cfg.SearchShortcuts,
126128 }
127129 resp.Appearance.SansFont = cfg.Appearance.SansFont
128130 resp.Appearance.SerifFont = cfg.Appearance.SerifFont
@@ -166,9 +168,11 @@ func (h *DumbSchemeHandler) registerDefaults() {
166168 } `json:"appearance"`
167169 DefaultUIScale float64 `json:"default_ui_scale"`
168170 DefaultSearchEngine string `json:"default_search_engine"`
171+ SearchShortcuts map[string]config.SearchShortcut `json:"search_shortcuts"`
169172 }{
170173 DefaultUIScale: defaults.DefaultUIScale,
171174 DefaultSearchEngine: defaults.DefaultSearchEngine,
175+ SearchShortcuts: defaults.SearchShortcuts,
172176 }
173177 resp.Appearance.SansFont = defaults.Appearance.SansFont
174178 resp.Appearance.SerifFont = defaults.Appearance.SerifFont
@@ -309,18 +313,18 @@ func (h *DumbSchemeHandler) handleAsset(u *url.URL) *SchemeResponse {
309313 // dumb://config/<asset> → serve asset
310314 case host == ConfigPath && path != "":
311315 relPath = path
312- // dumb://blocked or dumb://blocked/ → blocked.html
313- case host == BlockedPath && (path == "" || path == "/"):
314- relPath = "blocked.html"
315- // dumb://blocked/<asset> → serve asset
316- case host == BlockedPath && path != "":
316+ // dumb://error or dumb://error/ → error.html
317+ case host == ErrorPath && (path == "" || path == "/"):
318+ relPath = "error.html"
319+ // dumb://error/<asset> → serve asset
320+ case host == ErrorPath && path != "":
317321 relPath = path
318322 // dumb:home (opaque form) → index.html
319323 case u.Opaque == HomePath:
320324 relPath = IndexHTML
321- // dumb:blocked (opaque form) → blocked.html
322- case u.Opaque == BlockedPath:
323- relPath = "blocked.html"
325+ // dumb:error (opaque form) → error.html
326+ case u.Opaque == ErrorPath:
327+ relPath = "error.html"
324328 default:
325329 // Not a recognized asset path
326330 return nil
@@ -23,10 +23,10 @@ import (
23 23
24 // Scheme path constants24 // Scheme path constants
25 const (25 const (
26- HomePath = "home"26+ HomePath = "home"
27- ConfigPath = "config"27+ ConfigPath = "config"
28- BlockedPath = "blocked"28+ ErrorPath = "error"
29- IndexHTML = "index.html"29+ IndexHTML = "index.html"
30 )30 )
31 31
32 // SchemeRequest represents a request to a custom URI scheme.32 // SchemeRequest represents a request to a custom URI scheme.
@@ -120,9 +120,11 @@ func (h *DumbSchemeHandler) registerDefaults() {
120 } `json:"appearance"`120 } `json:"appearance"`
121 DefaultUIScale float64 `json:"default_ui_scale"`121 DefaultUIScale float64 `json:"default_ui_scale"`
122 DefaultSearchEngine string `json:"default_search_engine"`122 DefaultSearchEngine string `json:"default_search_engine"`
123+ SearchShortcuts map[string]config.SearchShortcut `json:"search_shortcuts"`
123 }{124 }{
124 DefaultUIScale: cfg.DefaultUIScale,125 DefaultUIScale: cfg.DefaultUIScale,
125 DefaultSearchEngine: cfg.DefaultSearchEngine,126 DefaultSearchEngine: cfg.DefaultSearchEngine,
127+ SearchShortcuts: cfg.SearchShortcuts,
126 }128 }
127 resp.Appearance.SansFont = cfg.Appearance.SansFont129 resp.Appearance.SansFont = cfg.Appearance.SansFont
128 resp.Appearance.SerifFont = cfg.Appearance.SerifFont130 resp.Appearance.SerifFont = cfg.Appearance.SerifFont
@@ -166,9 +168,11 @@ func (h *DumbSchemeHandler) registerDefaults() {
166 } `json:"appearance"`168 } `json:"appearance"`
167 DefaultUIScale float64 `json:"default_ui_scale"`169 DefaultUIScale float64 `json:"default_ui_scale"`
168 DefaultSearchEngine string `json:"default_search_engine"`170 DefaultSearchEngine string `json:"default_search_engine"`
171+ SearchShortcuts map[string]config.SearchShortcut `json:"search_shortcuts"`
169 }{172 }{
170 DefaultUIScale: defaults.DefaultUIScale,173 DefaultUIScale: defaults.DefaultUIScale,
171 DefaultSearchEngine: defaults.DefaultSearchEngine,174 DefaultSearchEngine: defaults.DefaultSearchEngine,
175+ SearchShortcuts: defaults.SearchShortcuts,
172 }176 }
173 resp.Appearance.SansFont = defaults.Appearance.SansFont177 resp.Appearance.SansFont = defaults.Appearance.SansFont
174 resp.Appearance.SerifFont = defaults.Appearance.SerifFont178 resp.Appearance.SerifFont = defaults.Appearance.SerifFont
@@ -309,18 +313,18 @@ func (h *DumbSchemeHandler) handleAsset(u *url.URL) *SchemeResponse {
309 // dumb://config/<asset> → serve asset313 // dumb://config/<asset> → serve asset
310 case host == ConfigPath && path != "":314 case host == ConfigPath && path != "":
311 relPath = path315 relPath = path
312- // dumb://blocked or dumb://blocked/ → blocked.html316+ // dumb://error or dumb://error/ → error.html
313- case host == BlockedPath && (path == "" || path == "/"):317+ case host == ErrorPath && (path == "" || path == "/"):
314- relPath = "blocked.html"318+ relPath = "error.html"
315- // dumb://blocked/<asset> → serve asset319+ // dumb://error/<asset> → serve asset
316- case host == BlockedPath && path != "":320+ case host == ErrorPath && path != "":
317 relPath = path321 relPath = path
318 // dumb:home (opaque form) → index.html322 // dumb:home (opaque form) → index.html
319 case u.Opaque == HomePath:323 case u.Opaque == HomePath:
320 relPath = IndexHTML324 relPath = IndexHTML
321- // dumb:blocked (opaque form) → blocked.html325+ // dumb:error (opaque form) → error.html
322- case u.Opaque == BlockedPath:326+ case u.Opaque == ErrorPath:
323- relPath = "blocked.html"327+ relPath = "error.html"
324 default:328 default:
325 // Not a recognized asset path329 // Not a recognized asset path
326 return nil330 return nil

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