PrayagS / polybar-spotify

:musical_note: Spotify status and controls module for Polybar with text scrolling
MIT License
581 stars 38 forks source link
hacktoberfest polybar polybar-config polybar-scripts spotify

polybar-spotify

This polybar module shows details regarding the currently playing song on Spotify. The unique feature of this module is that the text displayed is constantly scrolled to save space on the bar. This is something that is not found in other spotify modules I came across. Also, this module uses playerctl to do all the work and hence, no >100 line scripts which do all the work themselves. Only one line to fetch the required metadata in the format that you like and another line to scroll the fetched text using zscroll.

Dependencies

Setup

Set the source audio player here.

Players supporting the MPRIS spec are supported.

Examples: spotify, vlc, chrome, mpv and others.

Use playerctld to detect the latest player.

See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control

PLAYER="playerctld"

Format of the information displayed

Eg. {{ artist }} - {{ album }} - {{ title }}

See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata

FORMAT="{{ title }} - {{ artist }}"

- Add the following in your polybar config.
Make sure to place the desired symbols for each module. You can get them from like [Font Awesome](https://fontawesome.com/cheatsheet) or [Nerd Fonts](https://www.nerdfonts.com/cheat-sheet).
```ini
[module/spotify]
type = custom/script
tail = true
interval = 1
; prefix symbol is shown before the text
format-prefix = "<prefix-symbol>"
format = <label>
exec = ~/.config/polybar/scripts/scroll_spotify_status.sh

[module/spotify-prev]
type = custom/script
exec = echo "<previous-song-symbol>"
format = <label>
click-left = playerctl previous -p spotify

[module/spotify-play-pause]
type = custom/ipc
hook-0 = echo "<playing-symbol>"
hook-1 = echo "<pause-symbol>"
initial = 1
click-left = playerctl play-pause -p spotify

[module/spotify-next]
type = custom/script
exec = echo "next-song-symbol"
format = <label>
click-left = playerctl next -p spotify

NOTE: The above given play-pause module requires IPC support enabled for its parent bar. That can be done by adding enable-ipc = true in your bar config.

Support for KDE panel

To have this bar show up in your KDE panel, see PrayagS/polybar-spotify#21.

Customization

Star History

Star History Chart