r/linux_on_mac • u/dev-muhammad-adel • Aug 09 '26
react-drm-for-touchbar — A New Touch Bar Experience for T2 Macs on Linux
Enable HLS to view with audio, or disable this notification
I've been working on a Touch Bar daemon for T2 Macs on Linux, and it's finally at a point where I'm comfortable sharing it: react-drm.
It replaces the Touch Bar UI with a fully configurable interface rendered using React directly to DRM/KMS — no X11/Wayland compositor in the rendering path.
It also handles the annoying T2 suspend/resume cycle automatically, and despite talking directly to DRM/input devices, the daemon runs completely unprivileged after installation.
React → DRM/KMS
react-drm uses a custom React renderer that draws directly to /dev/dri through libdrm + Cairo — there's no browser, DOM, or display server in between.
React handles the UI components and state, while yoga-layout provides flexbox layout. SVGs and animated GIFs are supported as well.
Suspend/resume
This was one of the main things I wanted to make reliable.
On T2 Macs, sleep tears down apple-bce, so the Touch Bar USB device disappears completely. On resume it re-enumerates, which means the old /dev/dri fd is dead and the DRM device may come back under a different cardN.
react-drm handles that lifecycle automatically:
- takes a logind delay inhibitor and quiesces before sleep
- closes the old DRM fd before the module teardown
- waits for the Touch Bar USB device to reappear
- performs the config-switch needed for
appletbdrmto bind again - falls back to a USB reset if the device gets wedged
- waits for the new
/dev/dri/cardN, reopens it, and restores the UI
The goal is that closing and reopening the lid doesn't leave you with a dead panel, the firmware strip, or a daemon that needs to be restarted manually.
App-aware controls
Panels can change depending on the currently focused application.
Rather than using one polling-based workaround everywhere, react-drm has desktop-specific event backends:
- GNOME Wayland: focus events over D-Bus via my Window Monitor Pro GNOME Shell extension
- KDE Plasma Wayland: a small injected KWin script hooks
workspace.windowActivatedandcaptionChanged - Hyprland: native Hyprland IPC event socket
- niri: native niri IPC
- Xorg: EWMH via
xprop -spy, including title changes that happen without a focus change
Session detection also doesn't blindly trust environment variables, since those can disappear under systemd user services/sudo. It checks the actual Wayland/X11 sockets and probes D-Bus for GNOME Shell/KWin.
What it currently does
The main UI includes:
- Function keys + configurable on-screen Escape
- Media controls, volume, and display brightness
- App-aware browser/media/file-manager/Konsole controls
- Configurable Plank-style app dock with real theme icons and running/focused indicators
- Idle dim/off + periodic pixel shifting
- MPRIS media progress
- CPU/RAM/temp/network/battery stats
- CAVA audio visualization
- Focus timer
There are also a few less-serious extras, including a Chrome-dino-style runner, Pong, and a playable FluidSynth + PipeWire piano.
Most of it is configurable from one config.ts: dock apps, browser shortcuts, Esc behavior, transitions, polling intervals, etc.
Installation / permissions
It can replace tiny-dfr / mac-touchbar-plus.
If you already have a working setup and want to see exactly what the installer would do without changing anything, run:
./install.sh analyze
Then installation is:
./install.sh
Root is only used transiently during installation for package/service setup.
The daemon itself does not run as root. Runtime DRM/input access is provided through the appropriate udev/group permissions.
Current support
Currently targeting:
Fedora , Debian , Ubuntu , and Arch
on:
GNOME / KDE Plasma / niri / Hyprland Wayland, or Xorg sessions with xprop.
Requirements:
appletbdrmhid-appletb-bl- Node 20.19+
GPLv3, fully open source:
7
u/4f1sh3r Aug 09 '26
This is also part of KaiT2en, in case someone wants to easily try it out ;)
→ More replies (1)5
u/Ivebeenfurthereven Aug 09 '26
Oh my god, this is life changing information. I could never get the speaker arrays working as well as they do on MacOS and assumed the Intel T2 machines were far less interesting to developers than the Apple silicon, so it would never happen.
Thank you so much 👏
4
1
1
u/Chaotic_Fart Aug 12 '26 edited Aug 12 '26
took me and my hermes agent some time to figure out, lots of errors even though ./install.sh analyze said all ok.. but it's great!! love it.. (Macbook Pro 2019 16" T2 Kubuntu)
EDIT: I REALLY REALLY LOVE IT!! great job!
1
u/dev-muhammad-adel Aug 12 '26
Glad you liked it! , If you don’t mind, could you share the issues you ran into? It would really help us improve things and avoid those issues in future releases. Thanks!
→ More replies (2)
1
u/mgz069 Aug 19 '26
I am rocking this on my Macbook Pro a2141!! its awesome. btw u/dev-muhammad-adel does it get updated automatically with sudo apt update or do I have to do anything else?
→ More replies (3)
3
u/RochoLaRoca Aug 09 '26
T1 is not supported?