Skip to content

feat: Replace TUI with graphical macroquad UI and live panel preview#5

Merged
WeekendSuperhero merged 5 commits intomainfrom
container_and_raspberry_pi
Mar 17, 2026
Merged

feat: Replace TUI with graphical macroquad UI and live panel preview#5
WeekendSuperhero merged 5 commits intomainfrom
container_and_raspberry_pi

Conversation

@WeekendSuperhero
Copy link
Collaborator

@WeekendSuperhero WeekendSuperhero commented Mar 17, 2026

Summary

Replaces the ratatui terminal UI with a native graphical window (macroquad) that renders the physical Nanoleaf panel layout. The app now starts directly in visualizer mode with a real-time graphical representation of your device.

  • Graphical panel rendering — Panels (hexagons, triangles, squares) are drawn to match the physical device layout with correct orientation, shape types, and controller positions
  • Live color preview — Press Space to toggle real-time visualization of the colors being sent to the device, rendered directly on the panel shapes
  • Album art integration — Press N to extract colors from the currently playing track's album artwork (Spotify via ScriptingBridge, Apple Music via iTunes Search API) with artwork displayed in the UI
  • Removed ratatui dependency — No more terminal UI; the app is now a native windowed application
  • All visualizer controls preserved — Same keybinds for gain, palette switching, effects, sorting, and panel reset
  • DPI-aware text rendering — Uses camera_font_scale for sharp text on Retina displays
  • Non-blocking album art fetching — All artwork downloads and color extraction happen on background threads

Changes

New

  • app.rs — Complete rewrite as macroquad-based graphical app with panel rendering, floating HUD overlays, and help screen
  • Shared color state (Arc<Mutex<HashMap<u16, [u8; 3]>>>) between visualizer thread and UI for live panel preview
  • fetch_artwork_and_palette() — Single-fetch function that returns both artwork bytes and extracted palette to avoid race conditions
  • Album art texture display in the UI (bottom-right corner)
  • Proper bounding box calculation that accounts for panel radius (prevents edge panels from being clipped)
  • Oklch→sRGB gamut clamping for accurate color reproduction

Removed

  • event_handler.rs — Replaced by macroquad's built-in input handling
  • ratatui dependency
  • TUI effect list view and all related code (EffectList, Scroll, NlEffect, get_effect_list, play_effect, cur_effect_name)
  • TuiConfig and colorful_effect_names config option
  • osascript fallback for now-playing (replaced by ScriptingBridge-only + iTunes Search API)
  • Pause/Resume visualizer messages (visualizer starts immediately)

Changed

  • visualizer.rs — Writes display colors to shared HashMap after each frame for UI preview
  • now_playing.rs — ScriptingBridge only (no subprocess spawning), iTunes Search API fallback for streaming track artwork
  • config.rs — Removed tui_config section, silently ignores legacy config for backwards compatibility
  • main.rs — Launches macroquad window instead of ratatui terminal
  • README.md — Rewritten to reflect the graphical app with new screenshot and demo GIF

Test plan

  • Launch with a connected Nanoleaf device — window shows panel layout
  • Press Space — panels show live visualization colors matching the device
  • Press 1-0 — palette switches, colors update on device and in preview
  • Press E — cycles through Spectrum / Energy Wave / Pulse effects
  • Press N with Spotify or Apple Music playing — album art appears, palette changes to extracted colors
  • Change tracks — artwork and palette auto-update after ~3 seconds
  • Press ? — help overlay appears with all keybinds
  • Press -/+ — gain adjusts (visual only, not audio volume)
  • Press A/P/S — sorting controls update
  • Window resize — panels rescale to fit
  • ESC — clean shutdown, device turns off

@WeekendSuperhero WeekendSuperhero changed the title Container and raspberry pi feat: Replace TUI with graphical macroquad UI and live panel preview Mar 17, 2026
@WeekendSuperhero WeekendSuperhero merged commit 4f7291a into main Mar 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant