v0.5.0 131f96f

requirements.go RawHistoryFolder

1package app
2
3import (
4	"fmt"
5	"strings"
6
7	"github.com/bnema/neferafk/internal/ports"
8)
9
10// Requirements derives what the daemon needs from its startup config. Idle
11// notification/input-wake and lock/visual protocols are always required: a
12// daemon that cannot observe activity or lock is unsupported, and manual lock
13// (logind Lock, control socket) needs the lock protocols even with lock.after
14// off. Output power and sleep support are required only when enabled; enabling
15// them later by live reload needs a restart (a warning is logged).
16func Requirements(cfg ports.Config) (ports.WaylandRequirements, ports.SystemRequirements) {
17	return ports.WaylandRequirements{Idle: true, InputWake: true, OutputPower: cfg.OffAfter > 0, Lock: true, Visual: true},
18		ports.SystemRequirements{Session: true, Sleep: cfg.SleepAfter > 0 || cfg.LockAfter > 0}
19}
20
21// UnsupportedError lists every missing capability, one per line.
22type UnsupportedError struct{ Missing []string }
23
24func (e *UnsupportedError) Error() string {
25	return "unsupported environment:\n  - " + strings.Join(e.Missing, "\n  - ")
26}
27
28const suspendMissing = "non-interactive suspend"
29
30// unsupported merges adapter reports. Missing non-interactive suspend never
31// blocks startup: fade, lock and output-off still run and only the sleep
32// action is skipped (suspendWarning). The sleep delay inhibitor stays required
33// because before-sleep locking depends on it.
34func unsupported(wl *ports.Capabilities, sys *ports.SystemCapabilities) []string {
35	var missing []string
36	if wl != nil {
37		for _, m := range wl.Missing {
38			missing = append(missing, "wayland: "+m)
39		}
40	}
41	if sys != nil {
42		if !sys.Session {
43			missing = append(missing, "logind: current session")
44		}
45		for _, m := range sys.Missing {
46			if strings.HasPrefix(m, suspendMissing) {
47				continue // degrades only the sleep action, see suspendWarning
48			}
49			missing = append(missing, "logind: "+m)
50		}
51	}
52	return missing
53}
54
55// suspendWarning reports why an enabled sleep action cannot suspend, or "".
56func suspendWarning(cfg ports.Config, sys *ports.SystemCapabilities) string {
57	if cfg.SleepAfter == 0 || sys == nil || sys.Suspend {
58		return ""
59	}
60	return fmt.Sprintf("suspend unavailable (%s); sleep.after is skipped", sys.SuspendAuthorization)
61}

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 2

Tags 9

↑↓ moveenter openesc close