v0.3.0 da0887c

snapshot.go RawHistoryFolder

1package tray
2
3import "sync"
4
5// Target is what a click on the tray line reaches: one visible item and the
6// columns of its icon in the printed line.
7type Target struct {
8	Dest   string // where to send calls: the owner's unique name, else the registered name
9	Path   string // the object path of the StatusNotifierItem
10	Menu   string // the object path of its dbusmenu, "" when it has none
11	IsMenu bool   // the item only offers a menu: Activate means "open it"
12	Start  int    // first column of the icon in the line
13	Width  int    // cells the icon takes
14	// TipTitle and TipBody are the item's tooltip as it sent it, markup
15	// included; the title falls back to the item's Title.
16	TipTitle, TipBody string
17}
18
19// snapshot is the list of targets of the last line printed. The main loop
20// writes it; the control goroutine reads it.
21type snapshot struct {
22	mu      sync.Mutex
23	targets []Target
24}
25
26// publish replaces the targets with a copy of ts.
27func (s *snapshot) publish(ts []Target) {
28	s.mu.Lock()
29	s.targets = append(s.targets[:0], ts...)
30	s.mu.Unlock()
31}
32
33// at returns the target whose icon covers col.
34func (s *snapshot) at(col int) (Target, bool) {
35	s.mu.Lock()
36	defer s.mu.Unlock()
37	for _, t := range s.targets {
38		if col >= t.Start && col < t.Start+t.Width {
39			return t, true
40		}
41	}
42	return Target{}, false
43}
44
45// target returns the visible item whose icon covers column col of the line.
46func (t *Tray) target(col int) (Target, bool) { return t.snap.at(col) }

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 5

Tags 4

↑↓ moveenter openesc close