Touch Bar mini app: Now Playing (spectrum, track, transport buttons) - #337
Open
DataKnox wants to merge 3 commits into
Open
Touch Bar mini app: Now Playing (spectrum, track, transport buttons)#337DataKnox wants to merge 3 commits into
DataKnox wants to merge 3 commits into
Conversation
MacBook Pros with a Touch Bar run tiny-dfr on it for the F-keys, but the bar is also a small display with a digitizer. This adds a first mini app that draws a live audio spectrum (cava over PipeWire), the current track with album art (from the shell's media service, so Spotify web, cliamp, mpv and friends all work), and previous / play-pause / next buttons on it. The app borrows the bar from tiny-dfr through a root helper, omarchy-touchbar-handoff: "app" stops tiny-dfr and grants the user an ACL on the bar's DRM node and digitizer (ownership for the sysfs backlight), "keys" reverses that. A sudoers rule lets wheel run exactly those two invocations without a password, following the DNS and theme helpers, so the toggle can hang off a hotkey. The app runs "keys" on every exit, including a failed handoff, so the bar is never left dark and keyless. Also included: omarchy-hw-touchbar for detection, a Super+Ctrl+M toggle that only binds on Touch Bar Macs, a Trigger > Hardware menu row guarded the same way, an on-demand installer for cava, docs/touchbar.md, and a test covering detection and the helper's device discovery against fake sysfs trees for both the Apple Silicon and T2 device names. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tz9ekXeW8ijPdrDtHt4Rym
Numeric tests in (( )), explicit if blocks instead of && || chains and exec-in-one-branch flow, examples only where arguments need explaining, docs written as full lines, and the touchbar-* commands hidden from the CLI listing: users reach the app through toggle and install, so no new command group needs advertising. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tz9ekXeW8ijPdrDtHt4Rym
DataKnox
marked this pull request as ready for review
September 4, 2026 03:01
Member
|
The app handoff stops tiny-dfr before setfacl and chown, but the helper has no rollback if either step fails. Add a trap that restores any partial ACL or ownership change and restarts tiny-dfr, then cover the partial-failure paths. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A first Touch Bar mini app for Touch Bar MacBook Pros: a live audio spectrum, the current track with album art, and previous / play-pause / next buttons drawn straight onto the Touch Bar.
Super + Ctrl + Mtoggles it; tapping F1–F12 at the right end of the bar hands the function keys back.Track info comes from the shell's media service (
omarchy-shell media status), so it works for the Spotify web app this fork uses, and equally for cliamp, mpv, or a browser tab. The spectrum comes fromcavalistening to PipeWire. Colours follow the active theme.How it fits
tiny-dfr owns the Touch Bar's DRM device and digitizer, both root-only. The app borrows them through
omarchy-touchbar-handoff, a small root helper:appstops tiny-dfr, grants the calling user an ACL on the bar's DRM node and digitizer, and makes the user the owner of the bar's backlight attribute (sysfs has no ACLs).keysreverses that and starts tiny-dfr again.devicesprints what would be handed over, without root (used by the test).etc/sudoers.d/omarchy-touchbarletswheelrun exactly theappandkeysinvocations without a password, the same pattern asomarchy-dnsandomarchy-theme-set-browser-policy: a hotkey has no terminal to carry a password prompt. The app runskeyson every exit path, including a failed handoff.Included
bin/omarchy-touchbar-now-playing: the app, one Python file. Raw DRM modesetting with a dumb buffer, cairo drawing rotated onto the portrait panel, evdev multitouch for taps. Dependencies beyond the base install:cava,python-cairo,python-gobject.bin/omarchy-touchbar-handoffandetc/sudoers.d/omarchy-touchbar: the handoff described above.bin/omarchy-hw-touchbar: detection by the digitizer's input device name (M1, M2 and T2 names).bin/omarchy-toggle-touchbar-now-playingandbin/omarchy-install-touchbar-now-playing: the hotkey target; installscavain a floating terminal on first use.default/hypr/bindings/media.lua:Super + Ctrl + M, bound only whenomarchy-hw-touchbarsucceeds.default/omarchy/omarchy-menu.jsonc: Trigger > Hardware > Touch Bar: Now Playing, guarded withwhen.docs/touchbar.mdand a README link.tests/test-touchbar-hw.sh: detection and device discovery against fake sysfs trees for both Apple Silicon and T2 device names.Tested
bin/omarchy commands --checkpasses (461 commands),tests/test-touchbar-hw.shpasses 8/8,./test/allpasses exceptconfig-test.shandunowned-system-paths-test.sh, which need anomarchy-pkgscheckout and fail identically on an untouchedquattro.appletbdrmand the T2 digitizer name, and the test exercises those paths, but a T2 owner should confirm before it is claimed as supported there.Notes for review
cavashould be installed by aninstall/hardware/applescript on Touch Bar Macs instead of on first use.install.shat https://github.com/DataKnox/omarchy-touchbar for anyone who wants it before this lands.🤖 Generated with Claude Code
https://claude.ai/code/session_01Tz9ekXeW8ijPdrDtHt4Rym