cont8nuum: the compositor (src/) #
The compositor, binary c8 (wlroots 0.20), and c8-panorama (libexec: decodes the glasses' background for it).
Depends on: c8-protocols, c8ui-core (icons), libinput, gdk-pixbuf (c8-panorama).
Second screen, XR and everything of the glasses (output.c's roles,
glasses.c, hologram.c, tracker.c, imu.c, slatebar.c,
placement.c, stereo.c, panorama.c, xdgoutput.c, and for VR
games lease.c, xrruntime.c, xrclient.c, glassesmode.c) is in XR.md
beside this file: read it before touching any of those, or anything
that behaves differently in XR (c8_xr_active). Headless testing is
in the root CLAUDE.md.
main.cstartup order;server.hholds every shared struct and the cross-file API, grouped by source file. Listeners are hooked up withc8_listen(&listener, &signal, fn)(server.h), not by hand.config.creads~/.config/cont8nuum/config.ini(documented sample indata/config.ini; keep it in sync when adding keys), including[appearance](moved there fromstart.inion first run).start.ini(tiles and groups) belongs to c8-shell.c8_config_patchedits config.ini in place, preserving comments.c8_ini_parseis the one ini reader (placement.c's too).c8_config_reload+apply_reload(settings.c) diff-apply live, also when config.ini is edited by hand (inotify on its folder, 200 ms after the last write; text equal to the last applied is let be, so our own patches don't apply twice).- Small shared pieces:
math3d.hhaspose_point,quat_yaw_pitch,vec3_yaw_pitchfor the holograms' arithmetic;c8_view_raise(focus unless already in front; a click, never a summon),c8_shell_osd_shown,c8_output_is_sink(mirror or glasses),c8_cross_path(the close cross of chrome, the slate bar and snip). settings.cservescont8nuum-settings-v1. Only c8-settings may use it: the compositor spawns c8-settings itself over a socketpair (WAYLAND_SOCKET) and a global filter hides the global from every other client. Launchingc8-settingsfrom anywhere routes throughc8_settings_launch. Snapshot model: all entries +done, resent on every change. The one other client isc8-sync(settings sync, in c8-settings):c8_sync_startspawns it the same private way for the session (not nested, unlessC8_SYNCis set), and again 30 s after it exits, five times at most.output.cimplements wlr-output-management (works with wlr-randr, kanshi, PC settings) and applies[output NAME]sections on hotplug.input.clibinput config (tap, natural scroll, …), bindings, and keyboard-shortcuts-inhibit (so PC settings can record Super+Q etc.). Media keys are bound by default to actions (volume-up,brightness-up,play-pause, …) that go to the shell, which does them. Clipboard: data-device, primary selection and ext/wlr data-control. Implicit grab: while a button is held the pointer stays with the surface it went down on (server->press,c8_pointer_motion), so the release reaches the same client; a seat grab (drag and drop) is left to move between surfaces. c8ui drops a held press onleave. Clock:[general] clock=auto(as LC_TIME does),12or24, sent to the shell as theclockappearance key and read from config.ini by c8-lock and c8-widget themselves;clock.h(c8-base) formats the time from it; the shell and lockersetlocale(LC_TIME, "")for it. PC settings' General page sets it. Pointer theme:[general] cursor_theme/cursor_size(PC settings' General page);c8_cursor_theme_changedswaps the xcursor manager live (the cursor first, it keeps a pointer to it), resets Xwayland's root cursor and passesXCURSOR_THEME/XCURSOR_SIZEon to systemd + D-Bus.- Stealth mode (c8-base's
stealth.h, which c8 links for it):c8_view_titleis the title scrubbed withc8_stealth_textwhile it's on (titles in the chrome, switcher, shell protocol and XR all come through it), cached per view againstserver->stealth_gen; apply_reload'sc8_stealth_reloadbumps that and restyles every view (c8_views_stealth_changed). Untested: titles by eye, XR. view.carranges the apps: one fills the usable area, or two share it with a snapped one (server->snapped,snap_left,snap_fraction) beside the primary and the black divider between. With two,focus_border(four accent-coloured rects, recoloured on every arrange, so an accent change re-arranges) is drawn along the focused one's edge inlayers.border, a tree above the views thatnode_at(input.c) never looks at, so the app keeps its full size and the pointer at the edge still reaches it.split-left/split-right(Super+Shift+Left/Right,c8_view_split_step) move the split to the next quarter of the width; at 0 or 4 quarters the app left with all of it is alone, asunsnap.tween.canimates every change of that layout that involves a snap (a step, a swap, snapping, unsnapping, one taking the whole screen, one of the pair closing, an app dropped by its title bar): arrange hands it the tiled apps' boxes (c8_tween_layout). Each app that was on screen before is shown by a frame (a scene buffer of the buffer it last showed, intween.treeover the apps; the lock keeps the app's next frames out of it) stretched from its old box (or where it is mid-move; a drop: the card,c8_tween_drop) to the new one, while the app itself and its dialogs are hidden (c8_tween_restack, end of arrange) and redraw at the new size. The move holds at its end until each has drawn that size, orWAIT_MS; then the apps are shown under their frames, which fade (FADE_MS). An app with no buffer is cropped live instead (wlr_scene_subsurface_tree_set_clip, held against the edge that stays). An app leaving the layout stays under the others as a frame till the move ends; one that closed fades meanwhile (c8_tween_view_gone, while its buffer is still there). Going to one app arranges twice (snap_to, then focus): a move already running isn't stopped by the second, nor a fade by a re-arrange to the same layout. The focus border waits. Not while the divider is dragged, Start is up or in XR (c8_tween_stop). Frames aren't surfaces, so a click during a move hits nothing. While the shell's pick is open beside the snapped app (picking_over), the app that would be there is hidden (hiddento the tween: no frame), so it doesn't show past the pick as that follows the split;pick_donearranges it back. Arranging ends withc8_cursor_rebase: after Alt+Tab a still pointer's click or scroll went to the app it was last over (and focused it again) until the pointer moved. Not while the pointer is on a shell surface (a toast mid-swipe must keep it), nor while the chrome grabs it (c8_chrome_grabbing): dragging the divider arranges from the chrome's motion, whose rebase moved it again, and so on till the stack overflowed (crashed the session, 2026-12-06; the fix is untested by hand, wlrctl can't hold a button). Tested headless (click after Alt+Tab stays with the new app); not tested: the old build reproducing it. Tried and dropped (2026-12-03): covers of the app's colour and icon (Windows 8's way; the user found them disorienting: don't go back), then cropping the live apps alone (jumped as they redrew). Tested headless with foot (2026-12-03): steps, the step to the whole screen (the second arrange used to cancel it), closing the snapped one (its picture fades as the other stretches over), the pick through a step and Escape. Untested: dropping by the title bar (wlrctl can't hold a button; reasoned fromend_drag), apps with a scaled or viewported buffer (the frame's source box assumes the buffer/surface size ratio), popups.drag.cdrag and drop: a drag starts only from a valid pointer or touch grab serial (not while locked); the icon goes inlayers.drag(over everything but the lock screen); a touch drag moves the finger's focus to the surface under it (c8_drag_touch_motion).touch.ctouchscreen and pen, mapped to the built-in panel (eDP). Apps that bound wl_touch get real touch; elsewhere (Start, panels, chrome) the first finger drives the pointer (c8_pointer_button/motion). The pen is a pointer too (no tablet-v2 yet). Edge swipes: a first finger landing withinEDGE_SIZEof the built-in screen's edge is held back; swiping in from the left opens the switcher (switcher0, 0: stays until dismissed), from the right the charms, from the top pulls the title bar down pinned (chrome.pinned, until a press elsewhere) and pulling on pastEDGE_PULLturns the finger into the pointer carrying the app. Taps, slides along the edge and rests are replayed as a normal touch. One finger on the screen is two on the touchpad, so two are three: two landing withinSWIPE_GATHERms stay touches until they moveSWIPE_STARTpx together (the gap changing first is a pinch, left to the app); then their touches are cancelled, the pointer goes where they landed and the app there gets a 3-finger pointer-gestures swipe (the first finger up ends it; the rest are ignored until lifted).session.cthe desktop session: imports the environment into systemd + D-Bus (SESSION_VARS;XDG_DATA_DIRStoo, so a release tarball's/opt/cont8nuum/share, put there by its launcher, reaches D-Bus activated apps) and startscont8nuum-session.target(binds graphical-session.target, pulls XDG autostart andcont8nuum-polkit-agent.service); stops it on exit. It runssystemctl --user daemon-reloadfirst so XDG autostart is regenerated (the user has lingering on, so the user manager outlives logins). Also idle: screens off / sleep after[power] screen_off_after/sleep_afterminutes, honouring idle-inhibit, plus ext-idle-notify. All of this is skipped when nested (server->session == NULL). A real session also setsSUDO_ASKPASS/SSH_ASKPASStoc8-askpassfrom$PATHunless already set, and with noSSH_AUTH_SOCKfrom the login points it atcont8nuum-ssh-agent.service(PartOf graphical-session, so logging out forgets the keys), which it starts with the target.- Units/scripts live in
compositor/data/(systemd/,c8-polkit-agent,cont8nuum-portals.conf). Decorations are always the server's: xdg-decoration, plus KDE'sorg_kde_kwin_server_decoration(view.c) for GTK3, which drops its title bar but keeps an app's own header bar. GTK4 always draws its own, socont8nuum-gtk.service(oneshot,c8-gtk-settings) sets GTK's button layout to:(none) in GSettings and both GTK settings.ini files at session start (C8_GTK_BUTTONSoverrides, empty = leave alone); Plasma's kde-gtk-config writes its own back when Plasma starts. Screen sharing and screenshots go through xdg-desktop-portal-wlr (a package the user installs); its settings ship asdata/xdg-desktop-portal-wlr.conf, installed to/etc/xdg/xdg-desktop-portal-wlr/cont8nuum(it reads only ~/.config and /etc/xdg;xdpw_diroption),chooser_type=simplewithchooser_cmd=c8-share(c8-shell: the picker),force_mod_linear=1(Intel's CCS buffers reached OBS black). Sharing one window (protocols.ccapture_request): wlroots' scene-node source renders the whole scene over the node's box (what covers the window was in the picture, a hidden window gave nothing), so each window shared gets a privatewlr_sceneholding only a subsurface tree of its surface (view->listed.capture_scene/capture, one per window, dropped on unmap; popups aren't in it), which also keeps it drawing while hidden. nightlight.cNight light,[nightlight]in config.ini (enabled,temperature1500-6000 K,schedule= times (from..to), sunset (sunset to sunrise atplace= "lat, lon", worked out here by NOAA's short form and logged once; no place: the times) or always). Each display's gamma ramps (wlr_color_transform_init_lut_3x1dof the output's gamma size, committed as its colour transform) are scaled towards that white bynl.shown, which eases to the schedule's strength (RAMP_MIN, 30 minutes, at its ends; a second when switched).ticklooks at the clock every 30 s. The shell's tile and thenight-lightaction are "warm now" (c8_nightlight_set): against the schedule that'sforced, dropped when the schedule next turns or[nightlight]changes; with it off (oralways) they flipenabled. The shell hearsnight_lighton/off as an appearance key and asks withset_appearance("night_light", ...). A gamma-control client (gammastep) setting a display's ramps has it until it lets go (output->gamma_client). Displays without ramps (headless, nested) are skipped.C8_NIGHT_NOW=HH:MMfakes the clock for tests. Tested headless: the schedule and ramp by the log, sunset for a test city to the minute, the tile forcing it off and on, PC settings. Untested: on a real screen (what it looks like, the fade, the glasses, a display turned off and on again keeping it).lock.cext-session-lock: c8 spawns the locker ([power] locker, defaultc8-lock) privately like the shell; only it sees the global.@lock(launch /c8 -s) locks; the default[power] lockcommand. While locked (c8_locked) only thelayers.locktree gets input and only media bindings run. A locker that dies leaves it locked and is respawned (5 tries).lockedis sent once every output drew the cover. The shell protocol tells the shell (lockedevent).screenshot.cPrint (screenshot: screens to the clipboard), Alt+Print (screenshot-window: the app in front) and Super+Print (screenshot-save: dims, thenPictures/Screenshots/Screenshot (N).png). Each output's scene is built once more (read back byc8_buffer_read, the glasses' dumps and screenshots too) into a swapchain of its own and read back; a forked child encodes the PNG (per paste for the clipboard source) and posts the notification withnotify-send, waiting on the saved one's click toxdg-openthe file or folder. In XR (c8_xr_screenshot, glasses.c) the picture is the glasses' view (draw_spaceonce more into their swapchain, the left eye in 3D), Alt+Print the front window flat (c8_view_capture), no flash. With Monado holding the glasses the lease destroys their output (blank pictures, 2026-12-02): Print asks Monado for one frame of what it shows, games included (c8_xr_runtime_share('1'); the picture comes back throughc8_xr_share_frame→c8_screenshot_finish, XR.md's XR-VIEW), and after 1 s with none (shot_timer) falls back to our own drawing in a buffer of ours (c8_capture_buffer, no game). Tested nested: Monado's picture, right colours. Snip still works on the shell's screen only.snip.cSuper+Shift+S (snip, also@snip): one capture shown frozen inlayers.snip(above drag, below lock; first innode_at, so a finger is the pointer), dimmed by four scene rects round the selection, a bar at the top of the pointer's screen: rectangle, freeform (drawn in pieces of 32 segments, cut out with alpha), window (layers.viewshit-test,view->geo), full screen, close. While up it takes the pointer and key presses (releases still go to the app); Escape ends it, so does locking. The result goes throughc8_screenshot_snipped: clipboard, and a toast whose click saves it to Screenshots. The mode is remembered for the session.protocols.cxdg-activation (needs a shell token, or a seat serial newer than the last focus change,focus_serial: Electron apps call window.focus() on blur and would otherwise come straight back), xdg-foreign, gamma control, ext/wlr foreign toplevel lists, ext-image-copy-capture (outputs and windows), drm-syncobj, alpha modifier, xdg-dialog. xdg popups (view.c, layer.c) are fitted to the primary output on their first commit and again on everyreposition(GTK moves a popup that grows that way: LibreWolf's add-on prompt).pointer.crelative pointer, constraints, gestures, tablet-v2 (the pen goes to apps that bound it, else it is the pointer).im.ctext-input-v3 ↔ input-method-v2 relay; a keyboard grab gets keys only while a text input is enabled on the focused surface (grab_takes_keys), or any client asking for one would read every key. Sandboxed clients (wp_security_context_v1, which Flatpak uses when it's there) aren't shown the globals that reach past a sandbox: virtual keyboard and pointer, input method, data control, screencopy and the capture managers, the toplevel lists, layer shell, output management, gamma (sandbox_hiddenin settings.c'sglobal_filter; add any new such global to its list). An exclusive layer surface keeps the keyboard from X11 override-redirect windows, and of several the topmost layer's newest has it (layer.c). Untested: a real Flatpak app.lease.cserves wp_drm_lease_device_v1 (also sandbox-hidden): headsets that say non-desktop are offered at once and kept out of the layout, as sway does; the XR glasses only on the Monado path (XR.md).shell.crunsc8-shellthe same private way as c8-settings (sharedc8_spawn_client, same global filter) and restarts it with backoff when it exits. It servescont8nuum-shell-v1: shell surfaces (start inlayers.start, panels inlayers.shell, splash inlayers.splash), the Start mode (server->start_visible, owned here:c8_start_show), window objects (MRU viafocused;capture:c8_view_capturein screenshot.c draws the window's own surfaces from their textures into the shell's memfd, so what covers it isn't in the picture, unlike wlroots' scene node capture, which renders the screen over the window's box). A shell surface that moves (set_rect; toasts slide in that way) rebases the cursor when it comes under the pointer, so one sliding under a still pointer gets the click (it went to Start's account menu before; tested headless again 2026-12-03). One moving away doesn't: a toast swiped off on the touchpad slid out from under the pointer, lost it, and so the rest of the swipe and its end, and stopped where it was. Bindings, Super tap and hot corners becomeaction/switcherevents. Window chrome (chrome.c) stays here and draws the colour/icon the shell sets per window. The icon loads in the background (c8ui_icon_requestthrough the loader's fd);icon_arrivedredraws the chrome, the slate bar and the beacon, which draw without it meanwhile (the bar leaves no gap). A restyle or the view going cancels the request; an icon theme change asks again.