2020-08-21 13:54:32 +00:00
## waybar-mpris
2020-08-22 18:03:36 +00:00
< p align = "center" >
2020-08-22 18:01:51 +00:00
< img src = "images/cropped.gif" style = "width: 100%;" alt = "bar gif" > < / img >
< / p >
2020-08-21 13:54:32 +00:00
2020-08-22 18:01:51 +00:00
a waybar component/utility for displaying and controlling MPRIS2 compliant media players individually, inspired by [waybar-media ](https://github.com/yurihs/waybar-media ).
MPRIS2 is widely supported, so this component should work with:
* Chrome/Chromium
* Other browsers (with kde plasma integration installed)
* VLC
* Spotify
* Noson
* mpd (with [mpDris2 ](https://github.com/eonpatapon/mpDris2 ))
* Most other music/media players
2020-08-22 14:40:24 +00:00
2020-08-22 14:43:18 +00:00
## Install
2020-08-27 22:15:16 +00:00
`go get git.hrfee.pw/hrfee/waybar-mpris` will install the program, as well as the go dbus bindings and pflags for command-line arguments.
2020-08-22 14:43:18 +00:00
2020-08-22 18:01:51 +00:00
or just grab the `waybar-mpris` binary from here and place it in your PATH.
2020-08-22 14:43:18 +00:00
2020-08-22 14:40:24 +00:00
## Usage
2020-08-22 18:01:51 +00:00
When running, the program will pipe out json in waybar's format. Add something like this to your waybar `config.json` :
2020-08-22 18:17:48 +00:00
```
2020-08-22 18:01:51 +00:00
"custom/waybar-mpris": {
"return-type": "json",
2020-08-26 21:19:20 +00:00
"exec": "waybar-mpris --position --autofocus",
2020-08-22 18:01:51 +00:00
"on-click": "waybar-mpris --send toggle",
// This option will switch between players on right click.
"on-click-right": "waybar-mpris --send player-next",
// The options below will switch the selected player on scroll
// "on-scroll-up": "waybar-mpris --send player-next",
// "on-scroll-down": "waybar-mpris --send player-prev",
// The options below will go to next/previous track on scroll
// "on-scroll-up": "waybar-mpris --send next",
// "on-scroll-down": "waybar-mpris --send prev",
"escape": true,
},
2020-08-22 14:40:24 +00:00
```
2020-08-22 18:01:51 +00:00
```
Usage of waybar-mpris:
--autofocus Auto switch to currently playing music players.
2020-09-28 22:48:51 +00:00
--interpolate Interpolate track position (helpful for players that don't update regularly, e.g mpDris2)
2020-08-26 21:19:20 +00:00
--order string Element order. (default "SYMBOL:ARTIST:ALBUM:TITLE:POSITION")
2020-08-22 18:01:51 +00:00
--pause string Pause symbol/text to use. (default "\uf8e3")
2020-08-22 14:40:24 +00:00
--play string Play symbol/text to use. (default "▶")
2020-08-26 21:19:20 +00:00
--position Show current position between brackets, e.g (04:50/05:00)
2020-09-28 22:48:51 +00:00
--replace Replace any running instances
2020-08-22 18:01:51 +00:00
--send string send command to already runnning waybar-mpris instance. (options: player-next/player-prev/next/prev/toggle)
2020-08-22 14:40:24 +00:00
--separator string Separator string to use between artist, album, and title. (default " - ")
```
2020-08-22 18:01:51 +00:00
2020-08-26 21:19:20 +00:00
* Modify the order of components with `--order` . `SYMBOL` is the play/paused icon or text, `POSITION` is the track position (if enabled), other options are self explanatory.
2020-08-22 14:40:24 +00:00
* `--play/--pause` specify the symbols or text to display when music is paused/playing respectively.
2020-08-22 18:01:51 +00:00
* `--separator` specifies a string to separate the artist, album and title text.
* `--autofocus` makes waybar-mpris automatically focus on currently playing music players.
2020-08-26 21:19:20 +00:00
* `--position` enables the display of the track position.
2020-09-28 22:48:51 +00:00
* `--interpolate` increments the track position every second. This is useful for players (e.g mpDris2) that don't regularly update the position.
* `--replace` : By default, new instances will attach to the existing one so that the output is identical. This lets this instance replace any others running. It isn't recommended.
2020-08-22 18:01:51 +00:00
* `--send` sends commands to an already running waybar-mpris instance via a unix socket. Commands:
* `player-next` : Switch to displaying and controlling next available player.
* `player-prev` : Same as `player-next` , but for the previous player.
* `next/prev` : Next/previous track on the selected player.
* `toggle` : Play/pause.
* *Note: you can also bind these commands to keys in your sway/other wm config.*
2020-08-22 14:40:24 +00:00