aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 455931eb71b1b62c80cbe26f4a7e777e431b0ef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
## waybar-mpris
<p align="center">
    <img src="images/cropped.gif" style="width: 100%;" alt="bar gif"></img>
</p>

##### Downloads:
##### [binary](https://builds2.hrfee.pw/view/hrfee/waybar-mpris) | [aur](https://aur.archlinux.org/packages/waybar-mpris-git/)

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
* Firefox (Limited support with `media.hardwaremediakeys.enabled = true` in about:config)
* Other browsers (using KDE Plasma Integration)
* VLC
* Spotify
* Noson
* mpd (with [mpDris2](https://github.com/eonpatapon/mpDris2))
* Most other music/media players

## Install
Available on the AUR as [waybar-mpris-git](https://aur.archlinux.org/packages/waybar-mpris-git/) (Thanks @nichobi!)

Available on my Debian repo as well:
```sh
sudo apt-get update && sudo apt-get install curl apt-transport-https gnupg
curl https://apt.hrfee.dev/hrfee.pubkey.gpg | sudo apt-key add -
echo "deb https://apt.hrfee.dev trusty-unstable main" | sudo tee /etc/apt/sources.list.d/hrfee.list
sudo apt-get update
sudo apt-get install waybar-mpris
```

`go get git.hrfee.pw/hrfee/waybar-mpris` will compile from source and install.

You can also download a precompiled binary from [here](https://builds2.hrfee.pw/view/hrfee/waybar-mpris).

## Issues
Stick them on [mpris2client](https://github.com/hrfee/mpris2client) or the [og](https://github.com/hrfee/waybar-mpris) repository (both on github) if you can't make an account here.
## Usage
When running, the program will pipe out json in waybar's format. Add something like this to your waybar `config.json`:
```
"custom/waybar-mpris": {
    "return-type": "json",
    "exec": "waybar-mpris --autofocus --text-format=\"%i  [%p/%d] %a - %t\"",
    "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,
},
```


```
Usage of ./waybar-mpris:
      --autofocus               Auto switch to currently playing music players.
      --interpolate             Interpolate track position (helpful for players that don't update regularly, e.g mpDris2)
      --max-title int           Maximum length of title. If the title's longer N-3 characters will be printed and ... will be printed at the end. (default 70)
      --pause string            Pause symbol/text to use. (default "\uf8e3")
      --play string             Play symbol/text to use. (default "▶")
      --replace                 Replace existing waybar-mpris if found. When false, new instance will clone the original instances output.
      --send string             send command to already runnning waybar-mpris instance. (options: player-next/player-prev/next/prev/toggle/list)
      --text-format string      Format of the waybar module text. (default "%i %a - %t (%p/%d)")
      --tooltip-format string   Format of the waybar module tooltip. (default "%t by %a from %A\n(%P)")
```

* `--text-format` specifies in what format to display the module's text in
  waybar; the accepted tokens are as follows:
  - `%i` play/pause icon
  - `%a` track artist
  - `%A` album
  - `%t` track title
  - `%p` current position
  - `%l` track length
  - `%P` current media player
* `--tooltip-format` same as `text-format` but for the tooltip; same rules
  apply.
* `--play/--pause` specify the symbols or text to display when music is paused/playing respectively.
* `--autofocus` makes waybar-mpris automatically focus on currently playing music players.
* `--interpolate` increments the track position every second. This is useful for players (e.g mpDris2) that don't regularly update the position.
* `--max-title` the maximum number of characters before the title cuts off.
* `--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. 
* `--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.
  * You can also bind these commands to Media keys in your WM config.