v0.3.2 a514042

policy.go RawHistoryFolder

1package ports
2
3import "time"
4
5type Generation uint64
6type Action uint8
7
8const (
9	Lock Action = iota
10	Fade
11	OutputOff
12	Sleep
13)
14
15// Input contains no credentials. LockReleased is an authoritative visual-owner
16// lifecycle result, never an activity/reload request to unlock.
17type PolicyEvent interface{ policyEvent() }
18type IdleDue struct {
19	Generation Generation
20	// Notification identifies an existing proxy across unrelated reloads.
21	Notification uint64
22	After        time.Duration
23}
24type Activity struct{}
25type Reload struct{ Config Config }
26type LockConfirmed struct{ Generation Generation }
27type LockReleased struct{ Generation Generation }
28type BeforeSleep struct{}
29
30func (IdleDue) policyEvent()       {}
31func (Activity) policyEvent()      {}
32func (Reload) policyEvent()        {}
33func (LockConfirmed) policyEvent() {}
34func (LockReleased) policyEvent()  {}
35func (BeforeSleep) policyEvent()   {}
36
37// One notification per distinct timeout and registration origin; After is
38// relative to registration. Equal timeout values after a reload may have
39// different IDs: retaining an old origin must not rebase unchanged deadlines.
40// Actions sharing one notification dispatch in Lock/Fade/OutputOff/Sleep order.
41// Replacement destroys old proxies. Generation fences their queued events.
42type IdleNotification struct {
43	// ID is stable while this pending deadline is unchanged by reload.
44	// Adapters retain that proxy (and its old admitting Generation), avoiding
45	// recreation that would invent an exact current idle age.
46	ID    uint64
47	After time.Duration
48}
49type PolicyEffect interface{ policyEffect() }
50type ArmIdle struct {
51	Generation    Generation
52	Notifications []IdleNotification
53}
54type AcquireLock struct{ Generation Generation }
55type SetFade struct {
56	Black    bool
57	Duration time.Duration
58}
59type SetOutputPower struct{ On bool }
60type Suspend struct{}
61
62// SleepReady lets the system adapter release its delay inhibitor. No sleep is
63// induced by this response; it acknowledges a BeforeSleep already in progress.
64type SleepReady struct{}
65
66func (ArmIdle) policyEffect()        {}
67func (AcquireLock) policyEffect()    {}
68func (SetFade) policyEffect()        {}
69func (SetOutputPower) policyEffect() {}
70func (Suspend) policyEffect()        {}
71func (SleepReady) policyEffect()     {}
72
73// LockRequested asks policy to acquire the session lock now (logind Lock
74// signal or the private control socket). It is idempotent while a lock is
75// being acquired or held and never orders/forces any other action.
76type LockRequested struct{}
77
78func (LockRequested) policyEvent() {}

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