How haseebkhalid1507/myx works
Myx is a terminal Spotify Connect player. The principal workflow runs from user input through the app’s event/state layer to Spotify Web API browsing or librespot playback, then renders the library and playback views in the terminal. Playback events also drive album-art-reactive theming, lyrics, visualization, and optional color-protocol publishing. The README documents additional capabilities such as queue management, native media controls, and persistent equalizer settings. The graph uses the supplied tree and excerpts; unsampled subsystem wiring is shown only where documented.
Main entry points: main.rs Runtime loop · api/mod.rs Web API transport · engine/mod.rs Connect playback · app/mod.rs App state and actions
Components 28
Runtime and state
- Runtime loop
src/main.rs - Input handlers
src/input/mod.rs - App state and actions
src/app/mod.rs - Terminal views
src/ui/mod.rs - Saved state
src/app/persist.rs - Configuration
src/config.rs
Spotify integration
- OAuth PKCE
src/engine/auth.rs - Web API transport
src/api/mod.rs - Browse and search
src/api/library.rs - Context details
src/api/detail.rs - Track and queue data
src/api/queue.rs - Lyrics fetch
src/api/lyrics.rs - Connect playback
src/engine/mod.rs
Playback experience
- HTTP cache
src/httpcache.rs - Reactive theme
src/reactive.rs - Album artwork
src/cover.rs - Lyrics parsing
src/lyrics/mod.rs - EQ and visualizer
src/audio/mod.rs - OS media controls
src/input/media.rs
Color protocol
- Color publisher
src/mxc/publish.rs - Theme CLI client
src/mxc/cli.rs - Local color socket
src/mxc/subscribe.rs
Other components
- User
- Terminal
- Spotify services
- Spotify platform
- Operating system
- Color subscribers
Connections 36
- User → Input handlers: sends input
- Terminal → Runtime loop: provides events
- Runtime loop → Input handlers: dispatches events
- Input handlers → App state and actions: mutates state
- App state and actions → Terminal views: provides state
- Terminal views → Terminal: renders views
- Runtime loop → App state and actions: coordinates
- Runtime loop → Saved state: restores and saves
- Runtime loop → Configuration: loads settings
- Runtime loop → OAuth PKCE: gets credentials
- OAuth PKCE → Spotify services: authorizes with
- Runtime loop → Web API transport: starts API workers
- Web API transport → Browse and search: serves browse requests
- Web API transport → Context details: serves detail requests
- Web API transport → Track and queue data: serves track requests
- Web API transport → Lyrics fetch: serves lyric requests
- Browse and search → Spotify services: fetches catalogue
- Context details → Spotify services: fetches details
- Track and queue data → Spotify services: fetches queue data
- Lyrics fetch → Spotify services: fetches lyrics
- Web API transport → HTTP cache: reads and writes
- Web API transport → App state and actions: returns data
- App state and actions → Connect playback: issues playback commands
- Connect playback → Spotify platform: streams and controls
- Spotify platform → Connect playback: sends player events
- Connect playback → EQ and visualizer: processes audio
- Connect playback → Runtime loop: emits playback events
- Runtime loop → Reactive theme: updates on track changes
- Reactive theme → Album artwork: derives art palette
- Runtime loop → Lyrics parsing: uses fetched lyrics
- Runtime loop → OS media controls: handles media events
- OS media controls → Operating system: integrates controls
- Runtime loop → Color publisher: publishes palette
- Color publisher → Local color socket: sends snapshots
- Theme CLI client → Local color socket: reads theme
- Color subscribers → Local color socket: subscribes