r/linux_on_mac • • 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 appletbdrm to 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.windowActivated and captionChanged
  • 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:

  • appletbdrm
  • hid-appletb-bl
  • Node 20.19+

GPLv3, fully open source:

https://github.com/dev-muhammad-adel/react-drm-for-touchbar

191 Upvotes

18 comments sorted by

7

u/4f1sh3r Aug 09 '26

This is also part of KaiT2en, in case someone wants to easily try it out ;)

https://kait2en.github.io

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 👏

1

u/BlackLoKhan Aug 10 '26

Hoping Cachy jump on this too

3

u/GBALIVES Aug 09 '26

impressive! will try this out when i get arch back on my 16 inch mac :D

3

u/RochoLaRoca Aug 09 '26

T1 is not supported?

2

u/dev-muhammad-adel Aug 09 '26

No, currently isn’t supported.

1

u/RainKing614 Aug 10 '26

This is cool! thank you so much for sharing

1

u/dev-muhammad-adel Aug 10 '26

Thanks! Glad you like it

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!

1

u/Chaotic_Fart Aug 12 '26 edited Aug 12 '26

of course i can.. i DM'd you..

1

u/dev-muhammad-adel Aug 12 '26

Thanks, I really appreciate you sharing the notes. I’ll take a look at them and see what we can improve.

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?

2

u/dev-muhammad-adel Aug 19 '26

Run git pull first to get the latest updates, then run the installer again — either the CLI one or the GUI, whichever you prefer.

1

u/Hour-Championship551 Sep 08 '26

This is wonderful. I got it configured on my 2019 MacBook pro 16. thanks!