nandi/jolt-nativepublic Fork 0
e39a374fff23521a6ce39b160b2fe55bbd1090e1
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

README.md · 46 lines · 2.2 KBmarkdown Blame HistoryRaw
wayland-bar-compositor: a wlroots compositor in jolt, for panels on X11 1d16366 nandi 8d ago1# wayland-bar-compositor
2
3A Wayland compositor written in jolt directly on wlroots, for putting a Wayland
4panel (such as `cosmic-panel`) onto an X11 desktop.
5
6There is no shared object here: `jolt.ffi` binds libwlroots, libwayland-server,
7libxkbcommon, libX11, libXext and libXi directly. The compositor opens one
8wlroots X11 output, draws layer-shell and xdg-shell clients through the wlroots
9scene graph, and forwards pointer and keyboard input to them.
10
11Because it owns the scene, it shapes its own X11 window: the bar strip plus
12the outline of whatever popups are mapped, traced from the rendered frame so
13rounded corners show the desktop behind them. XInput2 raw button presses on the
14root window let a click on an X11 app close open popups.
15
16 wayland-bar-compositor the compositor
17 build generates offsets.edn from the installed headers
18 gen-offsets.c the offsetof dump build compiles
19 offsets.edn wlroots struct layout facts, read at startup
20 protocol/ wlr-layer-shell XML for the header wlroots omits
21
22## Running
23
24```bash
25./build # after any wlroots update
26WLR_BACKENDS=x11 WLR_RENDERER=pixman \
27 ./wayland-bar-compositor --size 1920x640 --strip 0,0,1920,40 --title my-bar -- cosmic-panel
28```
29
30`--size` is the whole output, bar plus room for popups; `--strip` is the part
31always shown; `--title` names the X11 window so a launcher can find it and dock
32it (`_NET_WM_WINDOW_TYPE_DOCK` plus a strut). Set `WBC_DEBUG=1` to log input,
33popups and shape changes.
34
35## Why a compositor in jolt works
36
37Every wlroots listener shares one native callback that dispatches on the
38listener's address, and listeners come from a free list, so surfaces that come
39and go don't leak callbacks. The event loop is `wl_event_loop_dispatch` called
40from jolt's own thread, so every callback arrives on that thread — nothing
41blocks the collector. wlroots changes struct layouts between minor versions,
42which is why the offsets are generated from the headers rather than written by
43hand.
44
45Written for wlroots 0.20 on x86_64. On a native Wayland desktop — COSMIC with
46cosmic-comp, for one — none of this is needed: the panel runs directly.