A CLI fetch tool for your currently playing Spotify track.
sfetch is a command-line utility written in Rust that displays information about the song you are currently listening to on Spotify. It renders the album art directly in your terminal (if supported) alongside track details, mimicking the aesthetic of tools like neofetch.
- Now Playing: Fetches real-time data for the current track.
- Album Art: Displays high-quality album covers in the terminal using viuer.
- Customizable: Fully configurable colors, layout, and formatting via a TOML config file.
- Hyperlinks: Generates clickable links to the track and album cover directly in the terminal output.
To use sfetch, you need:
- Rust & Cargo: Installed on your system to build the project.
- Spotify Developer Credentials: You need to create an app in the Spotify Developer Dashboard to get a Client ID and Client Secret.
- Terminal Support: A terminal emulator that supports image protocols (like Kitty, iTerm2, or Sixel) is recommended for album art display.
Clone the repository and install using Cargo:
git clone https://github.com/thatmagicalcat/sfetch.git
cd sfetch
cargo install --path .Or build it locally:
cargo build --release
# Binary will be at ./target/release/sfetchsfetch requires Spotify API credentials to access your current playback. You can provide these via environment variables or a .env file in the directory where you run the tool.
Create a .env file:
RSPOTIFY_CLIENT_ID="your_client_id_here"
RSPOTIFY_CLIENT_SECRET="your_client_secret_here"
RSPOTIFY_REDIRECT_URI="http://localhost:8888/callback"Note: On the first run, sfetch will open your browser to authenticate and authorize the application. It caches the token in ~/.cache/.spotify_token_cache.json.
You can customize the appearance of sfetch by creating a configuration file. The tool looks for a config file in the following locations (in order of precedence):
config.tomlin the current directory.~/.config/sfetch/config.toml
Default Configuration:
image_width = 30
padding = 4
# Colors: black, red, green, yellow, blue, magenta, cyan, white, grey
# Variations: dark_grey, dark_red, dark_green, etc.
track_color = "green"
type_color = "dark_yellow"
artists_color = "blue"
album_color = "magenta"
popularity_color = "cyan"
duration_color = "yellow"
explicit_color = "red"
# Define the order and presence of fields
order = [
"Track",
"Type",
"Artists",
"Album",
"Popularity",
"Duration",
"Explicit"
]Simply run the command in your terminal while playing music on Spotify:
sfetchIf nothing is playing or the track cannot be identified, sfetch will let you know and exit gracefully.