main 5041353

color_scheme.go RawHistoryFolder

1package port
2
3// ColorSchemePreference represents the resolved color scheme preference.
4type ColorSchemePreference struct {
5	// PrefersDark indicates whether dark mode is preferred.
6	PrefersDark bool
7
8	// Source identifies which detector provided this preference.
9	// Empty string means fallback was used.
10	Source string
11}
12
13// ColorSchemeDetector detects the system's color scheme preference.
14// Multiple detectors can be registered with different priorities.
15type ColorSchemeDetector interface {
16	// Name returns a human-readable name for this detector.
17	Name() string
18
19	// Priority returns the detector's priority.
20	// Higher values = higher priority (checked first).
21	// Recommended ranges:
22	//   - 100+: Runtime detectors (libadwaita, GTK Settings)
23	//   -  50+: Config file detectors
24	//   -  10+: Fallback detectors (gsettings, env vars)
25	Priority() int
26
27	// Available returns true if this detector can be used.
28	// For example, libadwaita detector returns false before adw.Init().
29	Available() bool
30
31	// Detect returns the detected preference and whether detection succeeded.
32	// Returns (preference, true) on success, (_, false) if unavailable or detection failed.
33	Detect() (prefersDark bool, ok bool)
34}
35
36// ToolkitAvailabilityNotifier signals that a toolkit (e.g., GTK/Adwaita) is available.
37type ToolkitAvailabilityNotifier interface {
38	MarkAvailable()
39}
40
41// ColorSchemeResolver resolves the effective color scheme preference.
42// It manages multiple detectors and respects config overrides.
43type ColorSchemeResolver interface {
44	// Resolve returns the current color scheme preference.
45	// It checks config for explicit overrides, then queries detectors by priority.
46	// If all detectors fail, defaults to dark mode.
47	Resolve() ColorSchemePreference
48
49	// RegisterDetector adds a detector to the resolver.
50	// Safe to call at any time; the resolver re-evaluates on next Resolve().
51	RegisterDetector(detector ColorSchemeDetector)
52
53	// Refresh forces re-evaluation of the color scheme.
54	// Call this after registering new detectors or when system preferences change.
55	// Returns the new preference.
56	Refresh() ColorSchemePreference
57
58	// OnChange registers a callback for color scheme changes.
59	// The callback is invoked when Refresh() results in a different preference.
60	// Returns a function to unregister the callback.
61	OnChange(callback func(ColorSchemePreference)) func()
62}

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