config.go RawHistoryFolder

1package ports
2
3import (
4	"image"
5	"regexp"
6	"strings"
7	"time"
8)
9
10// DefaultSDRBrightness is the BT.2408 SDR reference white in HDR, in nits.
11const DefaultSDRBrightness = 203
12
13// OutputConfig configures one connector. Name is the connector (e.g. "DP-2").
14// Mode is "WxH" (highest refresh) or "WxH@Hz" (closest refresh); empty picks the
15// monitor's preferred mode. Off disables the connector.
16// Every connected output that is not off is used.
17// Placement, by precedence: Pos (set at runtime by wlr-output-management),
18// then Anchor against another connected output, then automatic: right of
19// everything placed so far (never left of 0), at y=0, in config order, then in
20// connection order.
21// Scale is the output scale (0 means 1); layout works in logical pixels,
22// physical = logical × Scale. Placement and offsets use the transformed
23// logical size.
24// Primary gets the focus and the pointer at startup, wherever it is placed.
25// ScaleOnly marks an entry set only by output.<name> subkeys: it
26// does not select the connector.
27type OutputConfig struct {
28	Name  string
29	Mode  string
30	Off   bool
31	Scale float64
32	// Transform is output.<name>.transform; logical size swaps for 90/270.
33	Transform BufferTransform
34	// Pos is an explicit logical placement set at runtime; nil uses Anchor, else automatic layout.
35	Pos *image.Point
36	// Anchor places the output against another connected one.
37	Anchor        OutputAnchor // RelationNone: automatic
38	Primary       bool
39	HDR           bool // opt-in to HDR10 on capable outputs
40	SDRBrightness int  // nits; default DefaultSDRBrightness
41	ScaleOnly     bool
42}
43
44// OutputRelation is the side of another output where an output is placed.
45type OutputRelation uint8
46
47const (
48	RelationNone OutputRelation = iota
49	RelationRightOf
50	RelationLeftOf
51	RelationAbove
52	RelationBelow
53)
54
55// OutputAnchor places an output against another connected one, named by To.
56// Offset is in logical pixels, along the shared edge: y for right-of and
57// left-of (positive is down), x for above and below (positive is right).
58type OutputAnchor struct {
59	Relation OutputRelation
60	To       string
61	Offset   int
62}
63
64// LayoutRules are the layout settings shared by the defaults, screens and
65// named workspaces. Zero MaxColumns and an empty Overflow inherit.
66type LayoutRules struct {
67	// MaxColumns is how many columns share the screen at once.
68	MaxColumns int
69	// Overflow is "scroll" (horizontal scrolling), "fixed" (spiral splits),
70	// or "cascade" (vertically scrolling bands of columns).
71	Overflow string
72}
73
74// Over fills the unset rules of r from base.
75func (r LayoutRules) Over(base LayoutRules) LayoutRules {
76	if r.MaxColumns == 0 {
77		r.MaxColumns = base.MaxColumns
78	}
79	if r.Overflow == "" {
80		r.Overflow = base.Overflow
81	}
82	return r
83}
84
85// OutputLayout is the layout of one screen, matched by connector (DP-2) or
86// monitor key.
87type OutputLayout struct {
88	Output string
89	LayoutRules
90}
91
92// Config is the parsed compositor configuration (see the config adapter for keys).
93type Config struct {
94	Keyboard struct {
95		Layout, Variant, Options string
96		RepeatRate               int
97		RepeatDelay              int
98		CmdKey                   string
99	}
100	Terminal struct {
101		Command  []string
102		AutoOpen string
103	}
104	// Xwayland selects the X11 launcher.
105	Xwayland XwaylandConfig
106	// Startup are commands run once when the session starts, in order.
107	// One startup line may hold several, split by SplitCommands.
108	Startup    [][]string
109	Background struct{ Color string }
110	Floating   struct{ Dim float64 }
111	// Stash is the strip of windows set aside by toggle-window-stash:
112	// Width is the width of its selected window (10 to 90) and Gap the
113	// space between it and its neighbors (0 to 10), in percent of the
114	// usable width; Dim darkens the neighbors, 0 to 1. Capture puts new
115	// windows in the stash while it is shown. SpawnTerminal makes
116	// toggle-stash-visible on an empty stash open the terminal in it.
117	Stash struct {
118		Width, Gap    int
119		Dim           float64
120		Capture       bool
121		SpawnTerminal bool
122	}
123	// Border is drawn inside the window edge; Width 0 disables it. Radius is
124	// in logical pixels, >= 0 (at most 64 from the file): it rounds floats
125	// always and tiles when gaps > 0; the renderer uses SceneWindow.Radius.
126	Border struct {
127		Radius   int
128		Width    int
129		Active   string
130		Inactive string
131	}
132	Layout struct {
133		Gaps int
134		// LayoutRules are the defaults; Outputs override them per screen and
135		// named workspaces override them again.
136		LayoutRules
137		Outputs []OutputLayout
138	}
139	// InputDevicesConfig holds Touchpad and Mouse, promoted.
140	InputDevicesConfig
141	// Cursor.HideAfter hides the pointer cursor after this long without
142	// motion; the next motion shows it. 0 never hides it.
143	Cursor struct{ HideAfter time.Duration }
144	// Animations: On enables motion (off lands everything instantly);
145	// Slowdown scales every spring's duration, 0.1 to
146	// 10 (the config's animations.speed maps to it).
147	Animations struct {
148		On       bool
149		Slowdown float64
150	}
151	Focus struct {
152		// FollowMove shows the target workspace after a column or window
153		// moves to it.
154		FollowMove bool
155		// Flash briefly draws an inner border on the entity an action changed
156		// (window, column, output). FlashWidth is in logical pixels (1 to 8),
157		// FlashOpacity the starting opacity (0.1 to 1), FlashDuration the fade
158		// (50ms to 1s, not scaled by Animations.Slowdown), FlashColor #rrggbb or
159		// empty for Border.Active.
160		PositionHint  bool
161		Flash         bool
162		FlashWidth    int
163		FlashOpacity  float64
164		FlashDuration time.Duration
165		FlashColor    string
166	}
167	// Hint configures keyboard hint mode (action hint).
168	Hint struct {
169		// Enable turns the experimental hint mode on (hint.enable). It is
170		// read at startup: a reload keeps the startup value.
171		Enable bool
172		// LinksOnly limits the targets to links and URLs; false also
173		// includes buttons (hint.targets = clickable).
174		LinksOnly bool
175		// TextClick are the modifiers held for a click on a link found by
176		// OCR (hint.text-click); zero sends a plain click.
177		TextClick Mods
178		// Capture shows the labels in the captures requested by Wayland
179		// clients (hint.capture); the compositor's own scans never see them.
180		Capture                bool
181		Size                   float64 // logical pixels; zero selects automatic density sizing
182		Background, Foreground string  // empty derives from Border.Active
183	}
184	// Workspaces are declared with workspace.<name>.* keys, in first-seen order.
185	Workspaces []WorkspaceConfig
186	// Rules are the window rules (rule.<name>.* keys), in first-seen order.
187	Rules []WindowRule
188	// Outputs selects and configures physical displays (drm backend).
189	Outputs []OutputConfig
190	Binds   map[string]string
191	Render  struct {
192		DirectScanout bool
193		// Tearing honours wp_tearing_control_v1 in direct scanout; VRR
194		// turns variable refresh on while a buffer is scanned out.
195		Tearing, VRR bool
196		// VRRFlipGap is the minimum time between a game frame's flip and
197		// the next frame commit under VRR (0: off). It works around
198		// flips that land at the panel's slowest refresh.
199		VRRFlipGap time.Duration
200	}
201	Performance struct{ Realtime bool }
202	Log         struct {
203		Level string
204		Debug []string
205	}
206}
207
208// PointerConfig holds the settings mice and touchpads share. NaturalScroll
209// moves the content with the fingers or the wheel instead of against them.
210// AccelSpeed (-1 to 1) and AccelProfile (AccelAdaptive or AccelFlat) set the
211// pointer speed. LeftHanded swaps the left and right buttons.
212type PointerConfig struct {
213	NaturalScroll bool
214	AccelSpeed    float64
215	AccelProfile  string
216	LeftHanded    bool
217}
218
219// TouchpadConfig configures touchpads: the shared pointer settings
220// (NaturalScroll also applies to two-finger scroll and swipes), plus Tap,
221// which clicks on a tap (one finger left, two right, three middle), and
222// ScrollFactor, which multiplies two-finger scroll.
223type TouchpadConfig struct {
224	PointerConfig
225	Tap          bool
226	ScrollFactor float64
227}
228
229// InputDevicesConfig is the live configuration of the input devices, sent to
230// the input adapter as one value. It is comparable.
231type InputDevicesConfig struct {
232	Touchpad TouchpadConfig
233	Mouse    PointerConfig
234}
235
236// Pointer acceleration profiles, for mice and touchpads.
237const (
238	AccelAdaptive = "adaptive"
239	AccelFlat     = "flat"
240)
241
242// WorkspaceConfig declares a bind-only named workspace, outside the numbered list.
243// Zero MaxColumns and an empty Overflow use the layout.* defaults.
244type WorkspaceConfig struct {
245	Name string
246	// Monitor is the home monitor: a connector name (DP-2) or a monitor key
247	// ("make model serial"); empty follows the focused output when shown.
248	Monitor string
249	// Size overrides the workspace's logical width and height. Zero inherits
250	// the monitor; its scale is always inherited.
251	Size [2]int
252	// Slots are the declared columns (workspace.<name>.column.N), by N.
253	Slots []SlotConfig
254	LayoutRules
255}
256
257// CommandSeparator separates commands in config values that run programs
258// (startup, spawn binds): "waybar; mako" starts both, without waiting.
259const CommandSeparator = ";"
260
261// SplitCommands splits v on CommandSeparator, then each command on
262// whitespace. Empty commands are skipped; no shell is involved.
263func SplitCommands(v string) [][]string {
264	var commands [][]string
265	for part := range strings.SplitSeq(v, CommandSeparator) {
266		if argv := strings.Fields(part); len(argv) > 0 {
267			commands = append(commands, argv)
268		}
269	}
270	return commands
271}
272
273// SlotConfig reserves column N of a workspace for the window of one command.
274// neferwl spawns the command at startup; the window it opens goes to the
275// slot. Cells is its width in cells, a cell being one max-columns-th of
276// the usable width (1 to 16; 0 shares the width with the other columns).
277type SlotConfig struct {
278	Index int
279	Cells int
280	Argv  []string
281}
282
283// WindowRule places the windows whose app ID it matches when they first map.
284// Matching rules merge in config order, a later rule winning per field.
285type WindowRule struct {
286	Name string
287	// AppID matches the whole app ID (the config anchors it).
288	AppID *regexp.Regexp
289	// Floating forces a window to float (true) or to tile (false); nil leaves it.
290	Floating *bool
291	// Workspace is a 1-based number of a numbered workspace or the name of a
292	// declared one; empty leaves it.
293	Workspace string
294	// Monitor is a connector (DP-2) or a monitor key ("make model serial").
295	Monitor string
296	// Cells is the width in cells of the new column of a tiled window
297	// (1 to 16; 0 leaves it automatic).
298	Cells int
299}
300
301// XwaylandBackend selects how X11 clients are served.
302type XwaylandBackend uint8
303
304const (
305	XwaylandOff XwaylandBackend = iota
306	XwaylandSatellite
307	XwaylandBuiltin
308)
309
310// XwaylandConfig selects the launcher and its executable.
311type XwaylandConfig struct {
312	Backend XwaylandBackend
313	Binary  string
314	// XSettings (xwayland.xsettings) turns the XSETTINGS manager of the
315	// built-in XWM on.
316	XSettings bool
317}
318
319// XwaylandSettings is the plain data the built-in XWM publishes to X11
320// clients; the app fills it from the config and the environment.
321type XwaylandSettings struct {
322	// XSettings turns the XSETTINGS manager on.
323	XSettings bool
324	// CursorTheme and CursorSize are XCURSOR_THEME and XCURSOR_SIZE
325	// (published as Gtk/CursorThemeName and Gtk/CursorThemeSize).
326	CursorTheme string
327	CursorSize  int
328	// RootCursor sets a cursor on the X root window. Cursor is its image
329	// (premultiplied ARGB8888, little-endian); empty uses the X "left_ptr" glyph.
330	RootCursor bool
331	Cursor     CursorImage
332}

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