v0.1.0 d9218d6

session.go RawHistoryFolder

1package launcher
2
3import (
4	"context"
5	"os/exec"
6	"time"
7
8	"github.com/bnema/zerowrap"
9)
10
11// sessionVars are the displays D-Bus and systemd user services (portals,
12// notification daemons) need to reach the session.
13var sessionVars = []string{"WAYLAND_DISPLAY", "DISPLAY", "XDG_CURRENT_DESKTOP", "XDG_SESSION_TYPE"}
14
15// ExportSession shares the session's displays with D-Bus and systemd user
16// services, and waits for it: clients started next may activate them.
17func ExportSession(ctx context.Context, env []string, log zerowrap.Logger) {
18	ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
19	defer cancel()
20	runSessionCommand(ctx, env, log, append([]string{"--systemd"}, sessionVars...), "session exported")
21}
22
23// UnexportSession withdraws the displays from the systemd user manager on
24// exit, so services started after logout do not reach a dead display.
25func UnexportSession(env []string, log zerowrap.Logger) {
26	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
27	defer cancel()
28	path, err := childLookPath("systemctl", env)
29	if err != nil {
30		return
31	}
32	cmd := exec.CommandContext(ctx, path, append([]string{"--user", "unset-environment"}, sessionVars...)...)
33	cmd.Env = env
34	if err := cmd.Run(); err != nil {
35		log.Warn().Err(err).Msg("session unexport failed")
36	}
37}
38
39func runSessionCommand(ctx context.Context, env []string, log zerowrap.Logger, args []string, done string) {
40	path, err := childLookPath("dbus-update-activation-environment", env)
41	if err != nil {
42		log.Warn().Err(err).Msg("session export skipped: dbus-update-activation-environment not found")
43		return
44	}
45	cmd := exec.CommandContext(ctx, path, args...)
46	cmd.Env = env
47	if err := cmd.Run(); err != nil {
48		log.Warn().Err(err).Msg("session export failed")
49		return
50	}
51	log.Info().Strs("vars", sessionVars).Msg(done)
52}

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