workspaceid.go RawHistoryFolder

1// Package workspaceid names workspaces for programs outside the compositor:
2// the `id` of ext_workspace_handle_v1 and the `workspace_id` of the state
3// file are the same string.
4//
5// Core keeps numeric workspace IDs, unique for the life of the process. A
6// workspace declared in the configuration is named after its configured name
7// ("name:<configured name>"), so its ID survives restarts; any other
8// workspace is "<prefix>-<core ID>", where the prefix is drawn once per
9// compositor launch, so such an ID is unique within a launch and never
10// repeats across launches.
11package workspaceid
12
13import (
14	"crypto/rand"
15	"encoding/hex"
16	"strconv"
17)
18
19// IDs builds workspace ID strings for one compositor launch.
20type IDs struct{ prefix string }
21
22// New draws the launch prefix: 8 lowercase hex characters from crypto/rand.
23func New() *IDs {
24	var b [4]byte
25	// rand.Read never returns an error (Go 1.24+): it stops the program
26	// instead of returning weak randomness.
27	_, _ = rand.Read(b[:])
28	return &IDs{prefix: hex.EncodeToString(b[:])}
29}
30
31// WithPrefix uses a fixed launch prefix (tests).
32func WithPrefix(prefix string) *IDs { return &IDs{prefix: prefix} }
33
34// ID is the string of the workspace with this core ID and configured name
35// (empty for a numbered or dynamic workspace).
36func (i *IDs) ID(id uint64, configured string) string {
37	if configured != "" {
38		return "name:" + configured
39	}
40	return i.prefix + "-" + strconv.FormatUint(id, 10)
41}

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 25

Tags 10

↑↓ moveenter openesc close