Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
thinkoidPublic

About

Single-file tiling Wayland compositor on wlroots, with no helper clients

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

64 Commits

Folders and files

Repository files navigation

Tyler

Tyler is derivative work and all thanks go to suckless, and to dwl!

This is the Wayland reincarnation of tyler, whose X11 parent now lives on as tyler-classic. The lineage repeats itself one platform up: where tyler-classic used dwm as a template, debugging reference, and learning tutorial, this tyler uses dwl the same way — a compact, hackable compositor built on wlroots, with the window management written from scratch rather than forked.

The porthole defoggers are factory-installed.

What it is

A single-file tiling compositor, ~3,200 lines of C against wlroots 0.20, rendered through SceneFX's wlr_scene, configured by recompiling config.h. One binary, one config, every machine: nothing machine-specific lives in the config — output placement is decided by policy (internal panel leftmost, externals to the right), never by output name.

The design stance is that everything the desktop needs lives in the compositor. There is no layer-shell and there are no helper clients:

  • The bar is compositor-drawn pixels — fcft text, per-screen tags (viewed = background, occupied = underline, urgent = swap), window title, and a status field fed by a child process on a pipe. The status speaks color escapes (^#RRGGBBAA sets, ^#! restores).
  • The launcher (Mod+p) is an integrated dmenu: the compositor owns the keyboard, so there are no grabs and no focus games — a flag reroutes key events into the filter loop and the drawing rides the bar path.
  • Screenshots (PrtSc, or Mod+Shift+s on a keyboard without one) render the scene into a buffer and write a PNG with a hand-rolled writer — no screencopy protocol, no external grabber, zero added dependencies.

The rest of the roster: master/stack tiling with per-screen tags, a global MRU focus stack with motion-driven sloppy focus, mouse move/resize (Alt+drag) that tears tiles out into floats, fullscreen, urgency from both xdg-activation and the xdg system bell, clipboard and primary selection, server-side decorations, VT switching, keyboard repeat and libinput knobs (tap, natural scroll, adaptive accel) applied per-device the moment hardware appears, XF86 volume/brightness keys, pointer lock and confinement with relative motion for the games and emulators that ask (dosbox's Ctrl+F10), and screen memories — per-output state keyed by name that survives the output dying and returning, so a hibernate/resume cycle with a lid closed does not shred the layout.

Deliberately absent: Xwayland (the X11 sibling is the fallback for stragglers), layer-shell (nothing external draws on this desktop), and drag-and-drop (middle-click paste covers it).

Building

meson setup build
ninja -C build

Dependencies: wlroots 0.20, SceneFX 0.5, wayland-server, wayland-protocols, xkbcommon, fcft, pixman, libdrm, libinput. SceneFX is always the bundled copy: meson downloads the release pinned in subprojects/scenefx.wrap, applies subprojects/packagefiles/scenefx-0.5-corners.patch (its effect shaders at high precision, symmetric anti-aliasing on every rounded edge; the comment in meson.build says why) and links it statically; install with meson install -C build --skip-subprojects, or the bundled copy's headers and archive go in too. An installed SceneFX is not used, because it lacks the patch. The build also produces vkbd and vptr, protocol-level input injectors used by the test harness, and lockptr, the client that locks the pointer for the lock oracle; none of them is installed. tools/tyler-status is installed alongside the compositor — config.h names it by PATH.

Link-time is only half the story. The default config spawns foot and drives volume and backlight through pactl and light; the bundled status feeder reads iw, BAT0, wlan0, and coretemp, and the bar's glyphs want a Nerd font. All of it is swappable in config.h and the feeder script — these are this fleet's tools, not requirements of the compositor.

Running

Type tyler at a VT login shell (libseat/seatd session). Configuration is config.h, one compilation away; the key table is dwm's shape with Alt as the modifier. A keyboard backlight the kernel exposes as a bare kbd_backlight LED, Apple's, lights on a key press and goes out fifteen seconds after the last one; a vendor-prefixed LED is its firmware's and is left alone. Level, timeout and the step the XF86KbdBrightness keys take are config.h's. The status feeder is tools/tyler-status -o — swap in anything that prints a line per update. Its accent colors are Solarized unless ~/.config/tyler/status-colors reassigns them (C_VOL="^#7fbbb3ff", and likewise C_NET, C_CPU, C_TMP, C_BAT, C_CHG, C_RED).

The six bar and border colors are config.h's unless ~/.config/tyler/colors names them, one per line, #rrggbb or #rrggbbaa; a name the file leaves out keeps its compiled color:

# comment
normal_border #666666
normal_bg     #222222
normal_fg     #c2c2b0
select_border #78824b
select_bg     #383838
select_fg     #c2c2b0ff

Tyler rereads the file on SIGUSR1 (kill -USR1 <pid of the compositor>), with no restart, and repaints. It also restarts the status feeder, so status-colors takes effect at the same time.

Three toggles control window placement:

Binding Action
Alt+t Toggle the selected window between tiled and floating
Alt+f Toggle fullscreen for the selected window
Alt+m Toggle monocle for the current monitor

Monocle gives every visible tiled window the same area: the monitor's work area inside the configured outer gap. The bar and borders remain. Focus cycling raises the selected tile; floating windows keep their own geometry above the tiles. A second Alt+m restores master/stack tiling. The layout belongs to the monitor, follows tag changes, and is saved with the monitor's other state when an output disappears and returns.

Alt+t leaves a newly floating window at its current geometry. Pressing it again returns that window to the monitor's layout. It has no effect while the selected window is fullscreen; Alt+f restores the window's prior tiled or floating state. Alt+m can change the underlying layout while a window is fullscreen, without changing that window's fullscreen state.

Fullscreen owns focus on its monitor and visible tags. Alt+Tab and the focus-cycle keys cannot select a covered window, and a newly opened window stays underneath. A fullscreen application's dialogs are raised above it; the top dialog owns keyboard and pointer input on that monitor until it closes. Other monitors and tag views remain accessible. Closing the top fullscreen window restores focus to the fullscreen window below it, or to an ordinary window if none remains.

Testing

The compositor is verified headless: WLR_BACKENDS=headless WLR_RENDERER_ALLOW_SOFTWARE=1 (SceneFX renders only through GLES2; this lets EGL settle for a software driver), clients driven by vkbd and vptr, geometry read back from WAYLAND_DEBUG traces, bar pixels dumped via TYLER_BAR_DUMP, and screenshots via the internal PNG path. Most features landed with an oracle run proving them before they ever touched real hardware.

Some of those oracles are now wired into the build:

meson test -C build

tests/teardown-oracle.sh gates the shutdown path — a clean quit with N outputs up must exit 0 — and runs at one, two and three outputs. Two is the one that matters: a single-output quit stays clean even when the teardown ordering is wrong, because the last output leaves no surviving screen to draw, so a one-output gate never bites. That blindness is how a segfault on every multi-monitor quit went unnoticed on single-display machines.

tests/lock-oracle.sh gates pointer locking: lockptr maps a toplevel and locks on the pointer's first entry, vptr then moves the pointer, and the client must be told it is locked, must read every move as relative motion, and must see no absolute motion and no leave; the compositor must still quit clean with the lock alive. Two harness traps are written up in tools/lockptr.c: the seat's capabilities arrive after the registry roundtrip, and a buffer smaller than the tile never gets an enter.

tests/colors-oracle.sh gates the colors file: with HOME in a scratch directory and a colors file in place before the start, the dumped bar must show the file's background, not the compiled one. A rewrite of the file alone must change nothing; SIGUSR1 must then produce a new dump in the new background and replace the status feeder, a stub on PATH that logs each start. The compositor must then quit clean.

tests/fullscreen-oracle.sh runs real xdg-shell clients on two isolated headless outputs. It checks keyboard and pointer focus, fullscreen entry, blocked focus changes, pointer lock, dialogs, monitor and tag changes, fullscreen exit, and closing windows. It never uses the running desktop's Wayland socket.

The same oracle with --monocle checks all three placement toggles, client geometry, visible stacking, floating windows, fullscreen restoration, and independent layouts on two monitors. Meson runs it as monocle.

New oracles belong here. Perturb the subject and watch the gate go red before trusting it.

Pictures

Coming soon.

Provenance

Built from an empty repository to a daily driver. The overwhelming majority of the code was written by Claude (Anthropic), with design direction, taste, and live-hardware verdicts from a human; the commit trailers carry the flags of the crew.

License: WTFPL.

About

Single-file tiling Wayland compositor on wlroots, with no helper clients

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages