Module i3status_rs::blocks::music
source · Expand description
The current song title and artist
Also provides buttons for play/pause, previous and next.
Supports all music players that implement the MediaPlayer2 Interface. This includes:
- Spotify
- VLC
- mpd (via mpDris2)
and many others.
By default the block tracks all players available on the MPRIS bus. Right clicking on the block will cycle it to the next player. You can pin the widget to a given player via the “player” setting.
§Configuration
Key | Values | Default |
---|---|---|
format | A string to customise the output of this block. See below for available placeholders. | " $icon {$combo.str(max_w:25,rot_interval:0.5) $play |}" |
format_alt | If set, block will switch between format and format_alt on every click | None |
player | Name(s) of the music player(s) MPRIS interface. This can be either a music player name or an array of music player names. Run busctl --user list | grep "org.mpris.MediaPlayer2." | cut -d' ' -f1 and the name is the part after “org.mpris.MediaPlayer2.”. | None |
interface_name_exclude | A list of regex patterns for player MPRIS interface names to ignore. | ["playerctld"] |
separator | String to insert between artist and title. | " - " |
seek_step_secs | Positive number of seconds to seek forward/backward when scrolling on the bar. Does not need to be an integer. | 1 |
seek_forward_step_secs | Positive number of seconds to seek forward when scrolling on the bar. Does not need to be an integer. | seek_step_secs |
seek_backward_step_secs | Positive number of seconds to seek backward when scrolling on the bar. Does not need to be an integer. | seek_step_secs |
volume_step | The percent volume level is increased/decreased for the selected audio device when scrolling. Capped automatically at 50. | 5 |
Note: All placeholders except icon
can be absent. See the examples below to learn how to handle this.
Placeholder | Value | Type |
---|---|---|
icon | A static icon | Icon |
artist | Current artist | Text |
title | Current title | Text |
url | Current song url | Text |
combo | Resolves to “$artist[sep]$title" , "$artist" , "$title" , or "$url" depending on what information is available. [sep] is set by separator option. | Text |
player | Name of the current player (taken from the last part of its MPRIS bus name) | Text |
avail | Total number of players available to switch between | Number |
cur | The current player index of the available players | Number |
play | Play/Pause button | Clickable icon |
next | Next button | Clickable icon |
prev | Previous button | Clickable icon |
volume_icon | Icon based on volume. Missing if unsupported. | Icon |
volume | Current volume. Missing if muted or unsupported. | Number |
Action | Default button |
---|---|
play_pause | Left on $play |
next | Left on $next |
prev | Left on $prev |
next_player | Right |
seek_forward | Wheel Up |
seek_backward | Wheel Down |
volume_up | - |
volume_down | - |
toggle_format | Left |
§Examples
Show the currently playing song on Spotify only, with play & next buttons and limit the width to 20 characters:
[[block]]
block = "music"
format = " $icon {$combo.str(max_w:20) $play $next |}"
player = "spotify"
Same thing for any compatible player, takes the first active on the bus, but ignores “mpd” or anything with “kdeconnect” in the name:
[[block]]
block = "music"
format = " $icon {$combo.str(max_w:20) $play $next |}"
interface_name_exclude = [".*kdeconnect.*", "mpd"]
Same as above, but displays with rotating text
[[block]]
block = "music"
format = " $icon {$combo.str(max_w:20,rot_interval:0.5) $play $next |}"
interface_name_exclude = [".*kdeconnect.*", "mpd"]
Click anywhere to play/pause, middle click to toggle format:
[[block]]
block = "music"
format = " format 1 "
format_alt = " format 2 "
[[block.click]]
button = "left"
action = "play_pause"
[[block.click]]
button = "middle"
widget = "."
action = "toggle_format"
Scroll to change the player volume, use the forward and back buttons to seek:
[[block]]
block = "music"
format = " $icon $volume_icon $combo $play $next| "
seek_step_secs = 10
[[block.click]]
button = "up"
action = "volume_up"
[[block.click]]
button = "down"
action = "volume_down"
[[block.click]]
button = "forward"
action = "seek_forward"
[[block.click]]
button = "back"
action = "seek_backward"
§Icons Used
music
music_next
music_play
music_prev
volume_muted
volume
(as a progression)