detached aa7c5e4

refactor(daemon): recentSessions and paletteResults read snapshotView

commit
aa7c5e4b262bb0542bce0ff908c459623d4720b7
author
brice · · 2026-07-29 19:36 UTC
parent
5090cbb
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +6 -21
M internal/usecase/daemon/palette.go +3 -6
@@ -74,12 +74,9 @@ func (d *Daemon) paletteResults(current *session, commands []command.Command) []
7474 if candidate == current {
7575 continue
7676 }
77- candidate.mu.Lock()
78- name, createdAt, ephemeral := candidate.name, candidate.createdAt, candidate.ephemeral
79- id := candidate.id
80- candidate.mu.Unlock()
81- if name != "" && !ephemeral {
82- active = append(active, palette.NewActiveSessionResult(name, time.Unix(0, createdAt), id))
77+ snap := candidate.snapshotView(viewOptions{})
78+ if snap.name != "" && !snap.ephemeral {
79+ active = append(active, palette.NewActiveSessionResult(snap.name, time.Unix(0, snap.createdAt), snap.id))
8380 }
8481 }
8582 sort.Slice(active, func(i, j int) bool {
@@ -74,12 +74,9 @@ func (d *Daemon) paletteResults(current *session, commands []command.Command) []
74 if candidate == current {74 if candidate == current {
75 continue75 continue
76 }76 }
77- candidate.mu.Lock()77+ snap := candidate.snapshotView(viewOptions{})
78- name, createdAt, ephemeral := candidate.name, candidate.createdAt, candidate.ephemeral78+ if snap.name != "" && !snap.ephemeral {
79- id := candidate.id79+ active = append(active, palette.NewActiveSessionResult(snap.name, time.Unix(0, snap.createdAt), snap.id))
80- candidate.mu.Unlock()
81- if name != "" && !ephemeral {
82- active = append(active, palette.NewActiveSessionResult(name, time.Unix(0, createdAt), id))
83 }80 }
84 }81 }
85 sort.Slice(active, func(i, j int) bool {82 sort.Slice(active, func(i, j int) bool {
M internal/usecase/daemon/recent_sessions.go +3 -15
@@ -27,23 +27,11 @@ func (d *Daemon) recentSessions(current *session) []recentSession {
2727 if sess == current {
2828 continue
2929 }
30- sess.mu.Lock()
31- if sess.ephemeral {
32- sess.mu.Unlock()
30+ snap := sess.snapshotView(viewOptions{})
31+ if snap.ephemeral {
3332 continue
3433 }
35- entry := recentSession{
36- id: sess.id,
37- name: sess.name,
38- mruAt: sess.mruAt.Load(),
39- }
40- for _, tb := range sess.tabs {
41- if tb.attention {
42- entry.attention = true
43- break
44- }
45- }
46- sess.mu.Unlock()
34+ entry := recentSession{id: snap.id, name: snap.name, mruAt: snap.mruAt, attention: snap.hasAttention}
4735 recent = append(recent, entry)
4836 }
4937 d.mu.Unlock()
@@ -27,23 +27,11 @@ func (d *Daemon) recentSessions(current *session) []recentSession {
27 if sess == current {27 if sess == current {
28 continue28 continue
29 }29 }
30- sess.mu.Lock()30+ snap := sess.snapshotView(viewOptions{})
31- if sess.ephemeral {31+ if snap.ephemeral {
32- sess.mu.Unlock()
33 continue32 continue
34 }33 }
35- entry := recentSession{34+ entry := recentSession{id: snap.id, name: snap.name, mruAt: snap.mruAt, attention: snap.hasAttention}
36- id: sess.id,
37- name: sess.name,
38- mruAt: sess.mruAt.Load(),
39- }
40- for _, tb := range sess.tabs {
41- if tb.attention {
42- entry.attention = true
43- break
44- }
45- }
46- sess.mu.Unlock()
47 recent = append(recent, entry)35 recent = append(recent, entry)
48 }36 }
49 d.mu.Unlock()37 d.mu.Unlock()

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 12

Tags 11

↑↓ moveenter openesc close