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:

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

KeyValuesDefault
formatA 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_altIf set, block will switch between format and format_alt on every clickNone
playerName(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_excludeA list of regex patterns for player MPRIS interface names to ignore.["playerctld"]
separatorString to insert between artist and title." - "
seek_step_secsPositive number of seconds to seek forward/backward when scrolling on the bar. Does not need to be an integer.1
seek_forward_step_secsPositive number of seconds to seek forward when scrolling on the bar. Does not need to be an integer.seek_step_secs
seek_backward_step_secsPositive number of seconds to seek backward when scrolling on the bar. Does not need to be an integer.seek_step_secs
volume_stepThe 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.

PlaceholderValueType
iconA static iconIcon
artistCurrent artistText
titleCurrent titleText
urlCurrent song urlText
comboResolves to “$artist[sep]$title", "$artist", "$title", or "$url" depending on what information is available. [sep] is set by separator option.Text
playerName of the current player (taken from the last part of its MPRIS bus name)Text
availTotal number of players available to switch betweenNumber
curThe current player index of the available playersNumber
playPlay/Pause buttonClickable icon
nextNext buttonClickable icon
prevPrevious buttonClickable icon
volume_iconIcon based on volume. Missing if unsupported.Icon
volumeCurrent volume. Missing if muted or unsupported.Number
ActionDefault button
play_pauseLeft on $play
nextLeft on $next
prevLeft on $prev
next_playerRight
seek_forwardWheel Up
seek_backwardWheel Down
volume_up-
volume_down-
toggle_formatLeft

§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)

Structs§

Enums§

Functions§