v0.10.0 d5d679d

hintdebug.go RawHistoryFolder

1package app
2
3import (
4	"context"
5	"os"
6	"path/filepath"
7
8	"github.com/bnema/neferwl/internal/adapters/atspi"
9	"github.com/bnema/neferwl/internal/adapters/hints"
10	"github.com/bnema/neferwl/internal/adapters/logging"
11)
12
13// hintOptions builds the hint worker options: the accessibility source, and,
14// when NEFERWL_HINT_DEBUG is "1", the dump directory of scanned frames,
15// $XDG_STATE_HOME/neferwl/hints. The accessibility bus is only contacted
16// by the first scan; without it the worker reads windows with OCR only.
17func hintOptions(ctx context.Context) hints.Options {
18	opts := hintDump(ctx)
19	// The source connects on its first scan, and again after a failure. The
20	// hints worker owns it and closes it when it returns.
21	src := atspi.New()
22	opts.Source = src
23	return opts
24}
25
26// hintDump reads NEFERWL_HINT_DEBUG once.
27func hintDump(ctx context.Context) hints.Options {
28	if os.Getenv("NEFERWL_HINT_DEBUG") != "1" {
29		return hints.Options{}
30	}
31	log := logging.For(ctx, "hints")
32	state := os.Getenv("XDG_STATE_HOME")
33	if state == "" {
34		home, err := os.UserHomeDir()
35		if err != nil {
36			log.Warn().Err(err).Msg("hint debug dumps disabled")
37			return hints.Options{}
38		}
39		state = filepath.Join(home, ".local", "state")
40	}
41	dir := filepath.Join(state, "neferwl", "hints")
42	log.Warn().Str("dir", dir).Msg("hint debug dumps enabled")
43	return hints.Options{DumpDir: dir}
44}
45
46// hintDisabledNote returns the once-only notice for a hint bind pressed while
47// hint mode is off. The logger is made now; nothing else of hint mode exists.
48func hintDisabledNote(ctx context.Context) func() {
49	log := logging.For(ctx, "core")
50	return func() { log.Info().Msg("hint mode is disabled; set hint.enable = on and restart") }
51}

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 23

Tags 10

↑↓ moveenter openesc close