sysadmin · online

Thomas

Sysadmin. Linux tinkerer. Drum & bass head.

I keep the machines behind tuttifrutti.top alive, and I spend the nights teaching five World of Warcraft clients to press the same key at the same moment, in C++, on X11, with no room for a dropped input.

  • 5clients mirrored
  • ~30msper key, in-process
  • 174BPM, on repeat
Thomas
thomas

01about

The short version

I fix things that other people have given up on. Most days that means keeping a couple of boxes and their services breathing; some nights it means arguing with X11 until it agrees to let five game clients share one keyboard.

I have been on Linux long enough that tiling window managers feel like the default and everything else feels like a workaround. I write small, sharp C++ tools that solve exactly one problem, and I keep the receipts: every project here has a log of what broke, why, and what it cost.

The rest of the time it is drum & bass: loud, fast, and the only thing that makes a 3 a.m. rebuild go faster.

02featured build

Vineyard

A multiboxing suite for World of Warcraft on Linux, written from scratch, because nothing on the market ever cared about X11.

  • daily driver
  • 5-man verified
  • private build

One character is easy. Five is a logistics problem: five windows, five clients under Wine, one keyboard, and a game that only ever listens to the window holding focus. Vineyard picks up to five clients, mirrors the keys you allow it to mirror, and leaves everything else alone, so you play on one window and the other four follow.

Full application: GLFW + Dear ImGui interface, X11 input capture, a Win32 DLL injected into each client, a host relay, a monitor-aware layout designer, and a remote-control socket. Eight logged development sessions from first broadcast to a daily driver.

how it works

  1. 01

    Capture

    An X11 listener watches the focused window. Only keys on your whitelist, or a mapped key, are even considered.

  2. 02

    Decide

    Key maps resolve the press into steps and actions: plain keystroke, per-slot variable keystroke, nested mapped key, key-map toggle, or focus a slot.

  3. 03

    Deliver

    Each target slot gets the input through whichever pipeline it supports: in-process first, X11 as the fallback.

primary

In-process delivery

A small DLL lives inside each running client. It identifies itself to a local host relay by its Wine pid and delivers input by posting messages into the game's own windows. No focus change, no synthetic X events, no window dance.

  • ~30 ms per key
  • 0 focus switches
  • modifier combos included
fallback

X11 focus pipeline

For any slot without the injected DLL: focus the target, confirm it actually took focus, inject through XTest, retry with tunable timing when Wine is slow, then hand focus back to the window you were playing on.

  • ~180 ms per window
  • focus confirmed + retried
  • source focus restored
Vineyard in a live session: five World of Warcraft clients tiled across one monitor, with the control window on the right showing slot assignment, focus timings, a colour-coded layout canvas and the debug log.
Five clients, one keyboard. The window on the right is the whole suite: slots and timings, the canvas that placed those five windows, and a log that names every write it makes.
The Vineyard control window: a global toggle, five game slots with include checkboxes, whitelist and focus timing controls, a monitor-aware layout canvas with one rectangle per client, and a detailed debug log.

What you are looking at

  • Five slotsEach window can be pulled into or out of the rotation without touching the others.
  • TimingsFocus settle, inter delay and retries, because Wine does not hand over focus on cue.
  • The canvasOne coloured rectangle per client, dragged onto the geometry of a real monitor.
  • The logThe engine saying what it did: five windows initialised, layout written, relay listening.

what's inside

01

Toolkit-style key maps

Mapped keys with steps that advance press by press. Five action types, five action targets including round-robin, and per-slot bindings for the same logical keystroke.

02

Profile importer

Reads XML profiles exported from a commercial multiboxing toolkit. A 253 KB profile lands as 8 key maps, 174 mapped keys and 25 variable keystrokes. Anything it can't translate is named, never dropped silently.

03

Multi-monitor layout designer

Define each client's rectangle per monitor on a drag-and-resize canvas, edit it numerically, snap it to a grid, then push the layout onto the live windows.

04

Region-gated mouse repeat

The mouse surface is mirrored in-process too, fenced by editable repeater regions: your cursor stays yours, followers get a synthetic one, and vendor panels click on all five clients at once.

05

Per-window HUD

A thin strip inside every client shows state pips and key flashes, so you can see what the engine believes about each slot without leaving the game.

06

Remote control socket

A line protocol for status, injection, key maps and mouse state, built because driving a UI by clicking is a lie on a tiling window manager.

engineering notes

The crash trilogy

Three concurrency bugs died in one session: a logger that deadlocked on itself, caught by reading mutex ownership; shared state with no lock at all; and an X property double-free that only ASAN could see. A quiet X error handler now turns stale window ids into a clean "dead" instead of an abort.

Eight bytes of honesty

Faking modifier state used to mean patching code. Wine already forwards its key-state functions through jump stubs, so the hook became a single validated pointer swap, with a pattern check, and a safe failure if the bytes don't match.

Batching the fan

Broadcasting one key at a time cost 276 ms across five clients. Reordering the work into phases brought a full fan-out down to 99 ms, verified on a live five-man session.

Honest limits

  • X11 only. No Wayland, and it wants xdotool, wmctrl and access to /dev/uinput.
  • Layouts live in memory, with no save or load yet.
  • Picture-in-picture is configuration and preview, not rendered live content.
  • Mouse-look camera sync is designed on paper, not shipped.
  • An intermittent UI repaint livelock under i3 still has no root cause.

Source is private. This page describes the architecture; it doesn't publish the code.

Stack

  • C++17
  • Dear ImGui
  • GLFW + OpenGL
  • Xlib / XKB
  • XTest
  • /dev/uinput
  • Win32 via Wine
  • MinGW DLL
  • Unix socket
  • hand-rolled XML

03second build

Onikuma G69

A native Linux configurator for a keyboard whose only official software is a Windows web page.

  • daily driver
  • hardware verified
  • private build

The G69 is a 68-key Hall-effect board. Its vendor configurator is a minified Vue app that reaches the keyboard through WebHID, which on Linux means a browser tab at best and nothing at all at worst. This replaces the whole stack: a Rust daemon that speaks the vendor HID protocol directly, plus a desktop window that owns the keyboard.

The protocol was pulled apart from the shipped web app, written down as a spec, then confirmed against the real board until every read and write matched. Nine logged sessions took it from a packet dump to the thing I configure the keyboard with.

how it works

  1. 01

    Read the wire

    The vendor web app was taken apart until the packet framing, command table and per-key encoding were documented, then every finding was checked on hardware.

  2. 02

    Own the device

    One Rust daemon holds the hidraw handle and speaks the vendor protocol. Nothing else touches the keyboard, so writes can't race.

  3. 03

    Show the truth

    The interface attaches to the daemon over a local socket and renders what the device reports. Every write is followed by a fresh read, not an echo.

The Onikuma G69 configurator overview: a mirror of the 68-key deck, device status, key mapping, lighting and rapid trigger panels, and a read-only list of the nine configuration arrays.
Overview page, live. The deck mirrors the physical board; the panel on the right is the device itself reporting its nine configuration arrays.

what's inside

01

Key mapping

Remap any of the 68 keys on the base layer and on the Fn layer, on a deck that mirrors the physical board instead of listing rows in a table.

02

Lighting

All 20 onboard effects with per-effect colour, brightness, speed and direction, plus per-key colour, written straight to the board.

03

Actuation and rapid trigger

Per-key actuation point and rapid-trigger sensitivity in 0.01 mm units, stored as per-key records the device reads back like any other setting.

04

Live device mirror

The nine configuration arrays are re-read on connect and after every write, so the window can only ever show device state, never a guess.

05

Daemon and socket

One process owns the keyboard. The interface, and anything else later, attaches over a runtime socket speaking JSON lines.

06

Nothing risky

Firmware flashing commands are deliberately not implemented. A failed write drops the session rather than letting the next one build on stale state.

engineering notes

Reverse engineering a shop page

The protocol lived inside a minified single-page app. The work was reading the bundle until the report layout, packet framing and internal scales made sense, then writing them down as a spec and testing each claim on the board.

Verify, never echo

A write that "succeeded" means nothing if the device rejected it silently. Every command returns a result and then a fresh state event, because the daemon re-reads the keyboard before answering.

One owner

Two processes writing the same hidraw handle is how you get half-applied settings. A single systemd user unit holds the device, and the UI is just a client of it.

Honest limits

  • Linux only, and it needs a udev rule so your user can reach the hidraw node.
  • Built and verified against firmware 1.06 on one board.
  • A future vendor firmware could change the protocol and break it.
  • No macro engine: remapping and per-key records, nothing more.
  • The shipped web configurator still exists; this one is just mine.

Source is private. This page describes the architecture; it doesn't publish the code.

Stack

  • Rust
  • hidapi / hidraw
  • Unix socket
  • JSON lines
  • C++17
  • Dear ImGui
  • GLFW + OpenGL 3
  • CMake
  • systemd user unit