detached 49445e1

build(examples): add examples-check target and README usage sketch

commit
49445e1865af0ee10b7ce272a3c8d9cdd838bed6
author
brice · · 2026-10-01 19:13 UTC
parent
543bef2
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +25 -1
M Makefile +3 -1
@@ -1,4 +1,4 @@
1-.PHONY: build clean-build test vet race mocks mocks-check fakes-check perf-check check
1+.PHONY: build clean-build test vet race mocks mocks-check fakes-check perf-check check examples-check
22
33 build:
44 CGO_ENABLED=0 go build ./...
@@ -20,5 +20,7 @@ fakes-check:
2020 [ $$rc -eq 1 ] || { [ $$rc -eq 0 ] && printf '%s\n' 'handwritten test double: generate with Mockery v3' >&2; exit 1; }
2121 perf-check:
2222 CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./...
23+examples-check:
24+ cd examples && CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./...
2325 check: build clean-build vet test fakes-check perf-check
2426 CGO_ENABLED=0 staticcheck ./...
@@ -1,4 +1,4 @@
1-.PHONY: build clean-build test vet race mocks mocks-check fakes-check perf-check check1+.PHONY: build clean-build test vet race mocks mocks-check fakes-check perf-check check examples-check
2 2
3 build:3 build:
4 CGO_ENABLED=0 go build ./...4 CGO_ENABLED=0 go build ./...
@@ -20,5 +20,7 @@ fakes-check:
20 [ $$rc -eq 1 ] || { [ $$rc -eq 0 ] && printf '%s\n' 'handwritten test double: generate with Mockery v3' >&2; exit 1; }20 [ $$rc -eq 1 ] || { [ $$rc -eq 0 ] && printf '%s\n' 'handwritten test double: generate with Mockery v3' >&2; exit 1; }
21 perf-check:21 perf-check:
22 CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./...22 CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./...
23+examples-check:
24+ cd examples && CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./...
23 check: build clean-build vet test fakes-check perf-check25 check: build clean-build vet test fakes-check perf-check
24 CGO_ENABLED=0 staticcheck ./...26 CGO_ENABLED=0 staticcheck ./...
M README.md +22 -0
@@ -11,6 +11,28 @@ A Wayland client toolkit library for Go: connection, outputs, surface roles, sea
1111 - A compositor advertising `zwp_linux_dmabuf_v1` (v4) and `wp_linux_drm_syncobj_manager_v1`.
1212 - `libxkbcommon` at runtime for keyboard input.
1313
14+## Usage
15+
16+The library does not render. The `examples` module pairs it with [NeferGUI](https://github.com/bnema/nefergui) (a pure graphics library with no Wayland code); the two never import each other, and the examples copy plain fields between them. The loop runs on one owner goroutine:
17+
18+```go
19+conn, _ := neferclient.Connect(ctx, "")
20+surf, _ := conn.NewLayerSurface(neferclient.LayerConfig{Level: neferclient.LayerTop, Width: 240, Height: 90})
21+for {
22+ select {
23+ case <-conn.Wake():
24+ conn.Dispatch(handler) // Configure, FeedbackDone, Frame, Pointer, Key, FDReady...
25+ }
26+ // render with NeferGUI, then:
27+ // surf.ImportBuffer / surf.ImportTimeline / surf.Present
28+}
29+```
30+
31+- [`examples/layer`](examples/layer): a layer surface with a counter button.
32+- [`examples/lock`](examples/lock): a session lock with a masked password field. It is a demo and authenticates nothing; read its header before running it.
33+
34+Run them against a compositor with `cd examples && go run ./layer`. `make examples-check` builds and vets them; the headless test needs a NeferWL binary: `NEFERCLIENT_HEADLESS=/usr/sbin/neferwl go test ./... -run Headless`.
35+
1436 ## License
1537
1638 MIT
@@ -11,6 +11,28 @@ A Wayland client toolkit library for Go: connection, outputs, surface roles, sea
11 - A compositor advertising `zwp_linux_dmabuf_v1` (v4) and `wp_linux_drm_syncobj_manager_v1`.11 - A compositor advertising `zwp_linux_dmabuf_v1` (v4) and `wp_linux_drm_syncobj_manager_v1`.
12 - `libxkbcommon` at runtime for keyboard input.12 - `libxkbcommon` at runtime for keyboard input.
13 13
14+## Usage
15+
16+The library does not render. The `examples` module pairs it with [NeferGUI](https://github.com/bnema/nefergui) (a pure graphics library with no Wayland code); the two never import each other, and the examples copy plain fields between them. The loop runs on one owner goroutine:
17+
18+```go
19+conn, _ := neferclient.Connect(ctx, "")
20+surf, _ := conn.NewLayerSurface(neferclient.LayerConfig{Level: neferclient.LayerTop, Width: 240, Height: 90})
21+for {
22+ select {
23+ case <-conn.Wake():
24+ conn.Dispatch(handler) // Configure, FeedbackDone, Frame, Pointer, Key, FDReady...
25+ }
26+ // render with NeferGUI, then:
27+ // surf.ImportBuffer / surf.ImportTimeline / surf.Present
28+}
29+```
30+
31+- [`examples/layer`](examples/layer): a layer surface with a counter button.
32+- [`examples/lock`](examples/lock): a session lock with a masked password field. It is a demo and authenticates nothing; read its header before running it.
33+
34+Run them against a compositor with `cd examples && go run ./layer`. `make examples-check` builds and vets them; the headless test needs a NeferWL binary: `NEFERCLIENT_HEADLESS=/usr/sbin/neferwl go test ./... -run Headless`.
35+
14 ## License36 ## License
15 37
16 MIT38 MIT

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 1

Tags 4

↑↓ moveenter openesc close