Skip to content
Kathir-DPublic

About

A terminal UI and CLI for the Spotify desktop app on macOS: now playing, album art, a real-audio visualizer, synced lyrics, and every shpotify command.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Trak

A fast, good-looking terminal UI for Spotify on macOS.

Now playing, album art or a live visualizer, synced lyrics, and every shpotify command. It controls the official Spotify app, so the Free tier works with no setup.

CI Latest release Homebrew: kathir-d/tap/trak macOS 14.2+ Rust MIT License

Trak in a terminal playing Jane Remover: the cover of Dancing with your eyes closed in orange, a skip to Beauty Sleep that turns the cover and the whole interface lavender, pause, shuffle, repeat, volume and mute, the visualizer through all four styles, synced lyrics, full-screen lyrics, the track info, a skip back that turns it orange again, and the settings screen.

Contents: Why Trak · Features · Install · Screenshots · The TUI · Version A and B · Settings · One-shot commands · Permissions · Works with Sonar and headless-spotify · Credits

Why Trak

  • It controls the app you already have. Trak talks to the official Spotify desktop app through AppleScript, so the Free tier works with zero setup — no account linking, no developer app.
  • It is a real interface, not just commands. Now playing, album art in the terminal, synced lyrics, a visualizer, and the whole of shpotify's command set for scripts.
  • It is polite. It never launches Spotify as a side effect, writes only in answer to a key you pressed, and coexists with Sonar and headless-spotify.

Features

🎧 Now Playing title, artist, album, progress bar you can click, volume meter, shuffle and repeat
🖼 Album art in kitty, iTerm2, sixel or half-block terminals (negotiated at start); the accent colour is taken from the cover
📜 Synced lyrics from LRCLIB, follow the song, with a full-screen page on L
📊 Visualizer four styles (v), 30 fps while visible, from Spotify's own audio (a Core Audio tap on Spotify alone, never the rest of the system); simulated if the tap is unavailable
🕘 History and Info tracks played this session; everything AppleScript exposes about the current track
⚙️ Settings , or ? (or trak config): a checklist where changes apply live, with every key beside it
🔎 Search, playlists, queue, library optional, with a Spotify Client ID (unverified against a live account)
🔌 Plays well with others shows Sonar's ducking, detects headless-spotify, never fights either — see the caveats below
⌨️ shpotify's commands trak play, vol, status --json and the rest, for scripts

Install

Needs macOS 14.2 or newer and the Spotify desktop app (brew install --cask spotify if you do not have it — Trak never launches Spotify for you):

brew install kathir-d/tap/trak
trak                 # the TUI
trak status          # one-shot

Upgrade with brew update && brew upgrade kathir-d/tap/trak; remove with brew uninstall trak.

Without Homebrew, the installer downloads the same release, checks its SHA-256 and puts trak in /usr/local/bin (if writable) or ~/.local/bin. It never uses sudo:

curl -fsSL https://raw.githubusercontent.com/Kathir-D/Trak/main/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/Kathir-D/Trak/main/install.sh | sh -s -- --uninstall

The binary is universal (Apple silicon and Intel) and ad-hoc signed, not notarized. Neither path sets the quarantine flag, so macOS shows no Gatekeeper prompt. The first command that talks to Spotify asks your terminal for Automation permission, once (Permissions).

From source, with a recent stable Rust:

git clone https://github.com/Kathir-D/Trak && cd Trak
cargo build --release
./target/release/trak

cargo test runs with no Spotify, no network and no audio device.

Screenshots

Dashboard, visualizer styles, full-screen lyrics, settings
The dashboard: album art with the artist, title and album under it, a progress bar, transport controls and volume meter on the left; the session history on the right. The visualizer in waveform style in place of the cover, beside the session history.
Dashboard with the cover and the session history waveform visualizer
The visualizer in circular style: a ring of dots that swells with the music. The visualizer in spectrum style: vertical bars in the album's colours.
circular spectrum
Full-screen lyrics: the whole song centred, the current line bright and the rest dimmed. The settings screen over the dashboard: display, theme, visualizer, input, notifications and Spotify API settings, with the key list below.
Full-screen lyrics (L) Settings (, or ?)

The TUI

Run trak with no arguments. The layout adapts to the terminal: Now Playing on the left, tabs on the right, collapsing to a compact strip when it gets small.

Key Action
space play / pause
n / p next / previous
← / → previous / next tab — or the focused pane's own horizontal control
↑ / ↓ move in a list, and focus into one
esc leave a focused list, or close an open album / artist / playlist page
+ - volume ±10 (a setting)
m mute (and back to the volume you had)
s / r / R shuffle / repeat off → all → one / replay the track
a / v art ↔ visualizer / next visualizer style
j k enter move in a list / play the selection (History and the Web tabs)
tab shift-tab, 1–6 change tab
L full-screen lyrics
c copy the track's share link
, or ? settings, with every key listed beside them
q quit

With a Client ID there are more: / search, A add to queue, f like the playing track, o open an artist or album, P add to a playlist, X remove from the open playlist.

Version A and B

B — no setup A — with a Client ID
Needs the Spotify desktop app the desktop app and a free Spotify developer app
Works on Free yes search, library and playlists yes; add-to-queue needs Premium (Spotify's rule) (unverified live)
Now Playing, art, lyrics, visualizer, history, CLI ✅ ✅
Search, playlists, queue, liked songs, library tabs explain what to add ✅ (unverified live)

To switch to A: press , inside Trak (or run trak config), then s for the guided setup. It walks you through it in four steps, and copies the one string you have to paste:

  1. Open the Spotify developer dashboard and press Create app.
  2. Paste this into Redirect URI — exactly, it must match:
    http://127.0.0.1:8888/callback
    
    Tick Web API, press Save. (localhost is rejected by Spotify, and so is the port-less form http://127.0.0.1.)
  3. Open the app's Settings page and paste the Client ID — the 32 letters and numbers.
  4. Press enter and Allow in the browser.

Trak keeps the token in ~/.config/trak/token.json with mode 0600; see SECURITY.md. The account that creates the app needs Spotify Premium, and Spotify's development mode limits an app to a handful of users, so each person creates their own. ? lists every key; q saves and closes.

Settings

~/.config/trak/config.toml (XDG_CONFIG_HOME is respected). Unknown keys are ignored, missing keys take defaults, and a corrupt file is renamed to config.toml.bak.

Every key and its default
Section Key Values (default first)
[display] art, progress, volume, popularity, key_hints, clock, side_pane true / false
mode art, visualizer
default_tab history, info, lyrics, search, playlists, queue, liked, library
border rounded, sharp, double, none
accent art, green, terminal
art_protocol auto, kitty, iterm2, sixel, halfblocks
[visualizer] style spectrum, mirrored, waveform, circular
source auto (real audio, falling back to simulated), simulated
[input] mouse true, false
volume_step 10
[volume] control spotify, system
[notifications] song_change false, true
[lyrics] enabled true, false
[spotify] client_id "" (Version B)

NO_COLOR=1 removes colour from the TUI and the CLI; terminals without 24-bit colour get the nearest 256- or 16-colour approximation.

One-shot commands

trak status                 # a card of what is playing
▶
Census Designated
Jane Remover · Census Designated
1:35 / 6:00
volume 100

On a terminal that also gets a progress bar and a volume meter, the title in bold and the artist line dimmed. Piped or redirected, the same command prints clean text with no escape codes — so trak status | cat is safe to put in a script.

Every command

Command What it does Output
trak status the card above
trak status --json machine readable one JSON object, below
trak status artist just the artist Jane Remover
trak status album just the album Census Designated
trak status track just the title Census Designated
trak play resume (silent)
trak play spotify:track:… play a URI — works on the Free tier (silent)
trak play <song> search and play the best match (needs the optional Client ID) Playing Teardrop — Massive Attack (Mezzanine)
trak play album <name> search albums, play the best match Playing Mezzanine — Massive Attack (1998)
trak play artist <name> search artists, play the best match Playing Massive Attack
trak play list <name> search playlists, play the best match Playing Massive Attack on Repeat · 3 tracks
trak play uri <uri> play a URI, spelt the way shpotify did (silent)
trak pause toggles play/pause, as shpotify's did (silent) — it is a toggle, so there is nothing to report
trak stop pause if playing; Spotify has no stop command Pausing Spotify. / Spotify is already stopped.
trak next skip (silent)
trak prev back (silent)
trak replay restart the track (silent)
trak pos 60 seek to 1:00 1:00
trak vol up +10% 90 — the volume after the step
trak vol down −10% 70
trak vol show print the current volume 80
trak toggle shuffle toggle shuffle (silent)
trak toggle repeat cycle repeat off → all → one (silent)
trak share url print and copy the open.spotify.com link https://open.spotify.com/track/…
trak share uri print and copy the spotify: URI spotify:track:…
trak quit quit the Spotify app Quitting Spotify.

trak --help lists them all. Exit codes are 0 on success, 1 on a runtime failure, 2 on a usage or setup problem. Commands that write to Spotify print nothing on success — the next trak status is the confirmation. The exceptions report something you asked about: stop and quit say what they did, and a play by name prints the match it chose: you named a song rather than a URI, and "the best match" is a decision worth seeing. It never prints a miss as a success — nothing found is No results when searching for "…", exit 1.

Search is the optional Client ID's too: trak play <song> and friends need the one-time setup (trak config, the steps it prints), which no machine has walked yet — until then those commands print the setup steps and exit 2, exactly as shpotify did before its user configured an app.

JSON

trak status --json
{"state":"▶","title":"Census Designated","artist":"Jane Remover","album":"Census Designated","album_artist":"Jane Remover","uri":"spotify:track:6HacgXCExkzS552ILfJTXu","duration_ms":360511,"position_secs":95.196,"volume":100,"shuffling":false,"repeating":true,"popularity":48,"track_number":8,"disc_number":1,"artwork_url":"https://i.scdn.co/image/ab67616d0000b2738a821784ac3e69e691d4945f","is_ad":false}

Permissions

The first AppleScript call asks your terminal for permission to control Spotify. If it is denied, Trak says so and tells you where to fix it:

System Settings › Privacy & Security › Automation › add your terminal, with Spotify checked.

That prompt belongs to your terminal, not to Trak, so it happens once per terminal. Trak never starts Spotify as a side effect; it only talks to an app you already have running.

The visualizer taps Spotify's audio only while it is on screen. On the Macs tested so far macOS asks for nothing; if it ever refuses, the bars fall back to a simulated spectrum and Trak says once where to allow it:

System Settings › Privacy & Security › Screen & System Audio Recording › Trak.

The tap is in Trak's own process, so unlike the Automation prompt above this one names Trak rather than your terminal.

Made for a headless setup

Works alongside Sonar (menu-bar skip/prev and auto-pause) and headless-spotify (Spotify with no Dock icon). The contract Trak keeps with both is written down in docs/COMPAT.md and the details that are easy to get wrong are measured in docs/APPLESCRIPT.md.

Two honest caveats. Trak's half is measured; the rows of COMPAT.md's matrix that need Sonar actually running are not — ducking, the auto-pause handshake and the concurrent audio tap are reasoned about and unit-tested, not observed. And both siblings need macOS 15+, so on a 14.2 machine the combination is Trak alone.

For contributors and agents

Start with AGENTS.md, then docs/SPEC.md and TODO.md. To re-check the measurements behind the design, ./spikes/verify.sh runs every spike and compares the result against the docs.

Credits

Trak descends from shpotify by Harish Narayanan (MIT), and the tab layout began as a study of spotify-tui. The interface is ratatui; the lyrics come from LRCLIB. The visualizer is inspired by cava; its tap uses cidre. See THIRD-PARTY-NOTICES.md for the full list and licences.

License

MIT. See LICENSE.

About

A terminal UI and CLI for the Spotify desktop app on macOS: now playing, album art, a real-audio visualizer, synced lyrics, and every shpotify command.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages