Package: i3blocks-mpris
i3blocks-mprisA persistenti3blocksblocklet for theMPRISD-Bus interface.Click the image above to watch ascreencast.This project was previously known asi3blocks-spotify-persist.Featuresnear-immediate updates thanks to the event-driven model: the blocket is a constantly running process receiving D-Bus signalsconfigurable outputconfigurable mouse click actions (i3blocksversion 1.5or later is required)InstallationPython version 3.8 or later is required.The blocket can be installed from PyPI usingpip:python3-mpipinstall[--user]i3blocks-mprisOnce the package is installed, there will be a blocket script namedi3blocks-mprissomewhere depending on the presence of a--userpip flag (e.g.,/usr/local/bin/i3blocks-mprisor~/.local/bin/i3blocks-mpris).To avoid dependecy hell,pipxcan be used:pipxinstalli3blocks-mprisIn this case the blocket script will be placed in~/.local/bindirectory.DependenciesRequired (installed automatically):PyGObjectdbus-pythonOptional (installed manually):Font Awesome(for status icons)UsageAdd the following lines to your i3blocks config:[mpris]
command=/path/to/bin/i3blocks-mpris -c /path/to/config.json
interval=persistConfigurationThe blocket can be configured using a JSON config file and/or command line arguments. The only required parameter isplayer. It must be specified using either the config or the command line argument. Other config parameters and the config itself are optional.Config parametersplayerType:stringDefault value:no default value, must be specifiedA name of the player, either a full bus name —org.mpris.MediaPlayer2.<player>[.<instance>]— or its<player>[.<instance>]part.Examples:org.mpris.MediaPlayer2.spotifyorg.mpris.MediaPlayer2.vlc.instance7389spotifyvlc.instance7389formatType:stringDefault value:{status}: {artist} – {title}A template string with placeholders. Placeholder formats are{field}and{field:filter}.Supported fields:status, one ofenumvalues:Playing,Paused,StoppedartisttitleSupported filters:FilterDescriptionExampleupperstr.upper“lorem Ipsum DOLor” → “LOREM IPSUM DOLOR”lowerstr.lower“lorem Ipsum DOLor” → “lorem ipsum dolor”capitalizestr.capitalize“lorem Ipsum DOLor” → “Lorem ipsum dolor”titlestr.title“lorem Ipsum DOLor” → “Lorem Ipsum Dolor”iconconverts a textualstatusto an icon, see thestatus_iconsoption below“Paused” → “⏸”markup_escapeType:booleanDefault value:falseThis option specifies whether to escape special characters (such as<,>,&) using corresponding XML entities. Set totrueif Pango markup is used (markup=pangoin youri3blocksconfig),falseotherwise.status_iconsType:objectDefault value:{"Playing": "\uf04b", "Paused": "\uf04c", "Stopped": "\uf04d"}This option provides a mapping for theiconfilter (see above). The default value uses icons fromFont Awesome.mouse_buttonsType:objectDefault value:{"1": "PlayPause"}This option provides a mapping of X11 mouse buttons numbers toMPRIS methods. You can use thexevprogram to determine button numbers.sanitize_unicodeType:booleanDefault value:trueIf this option is set totrue, the blocklet removes some unicode characters (more specifically, characters belonging toCc,Cs,Co, andCngeneral categories). Seeissue #9for details.dedupeType:booleanDefault value:trueFor some reason, the Spotify app emits several identical signals for one action/event (e.g., it producesfourPropertiesChangedsignals when a track is played or paused). If this option is settrue, the blocklet will compare the updated message with the previous one and print it only if it has changed. There is no reason to turn off deduplication except for debugging.Config example{"player":"spotify","format":"<span font_family='monospace' color='#ffa651' weight='bold'>{status:icon} {status:upper}</span> <span color='#72bf44' weight='bold'>{artist}</span><span color='#ffa651'>᛫</span><span color='#b2d235'>{title}</span>","markup_escape":true,"status_icons":{"Playing":"|>","Paused":"||","Stopped":"[]"},"mouse_buttons":{"1":"PlayPause","9":"Previous","8":"Next"}}Command line arguments-h,--help— show all command line arguments and exit-c,--config— a path to the config file (see above)The following arguments override corresponding config options or defaults (that is, command line arguments have the highest precedence):-p,--player-f,--format--markup-escape/--no-markup-escape--sanitize-unicode/--no-sanitize-unicode--dedupe/--no-dedupeChangelogSeeCHANGELOG.md.LicenseTheMIT License.