Added 'MPRIS' module

This commit adds the ability to display status information for MPRIS
compatible music players.

Closes #53
This commit is contained in:
haruInDisguise 2024-07-05 23:22:20 +02:00 committed by Daniel Eklöf
parent b5450c3918
commit c27de56bea
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
9 changed files with 1266 additions and 1 deletions

View file

@ -34,6 +34,9 @@ endif
if plugin_mpd_enabled
plugin_pages += ['yambar-modules-mpd.5.scd']
endif
if plugin_mpris_enabled
plugin_pages += ['yambar-modules-mpris.5.scd']
endif
if plugin_i3_enabled
plugin_pages += ['yambar-modules-i3.5.scd']
plugin_pages += ['yambar-modules-sway.5.scd']

View file

@ -0,0 +1,95 @@
yambar-modules-mpris(5)
# NAME
mpris - This module provides MPRIS status such as currently playing artist/album/song
# TAGS
[[ *Name*
:[ *Type*
:< *Description*
| state
: string
: One of *offline*, *stopped*, *paused* or *playing*
| shuffle
: bool
: True if the *shuffle* flag is set
| repeat
: string
: One of *none*, *track* or *paylist*
| volume
: range
: Volume in percentage
| album
: string
: Currently playing album
| artist
: string
: Artist of currently playing song
| title
: string
: Title of currently playing song
| file
: string
: Filename or URL of currently playing song
| pos
: string
: *%M:%S*-formatted string describing the song's current position
(also see _elapsed_)
| end
: string
: *%M:%S*-formatted string describing the song's total length (also
see _duration_)
| elapsed
: realtime
: Position in currently playing song, in milliseconds. Can be used
with a _progress-bar_ particle.
# CONFIGURATION
[[ *Name*
:[ *Type*
:[ *Req*
:< *Description*
| identities
: list of string
: yes
: A list of MPRIS client identities
# EXAMPLES
```
bar:
center:
- mpris:
identities:
- "spotify"
- "firefox"
content:
map:
conditions:
state != offline && state != stopped:
- string: {text: "{artist}", max: 30 }
- string: {text: "-" }
- string: {text: "{title}", max: 30 }
```
# NOTE
The 'identity' refers a part of your clients DBus bus name.
You can obtain a list of available bus names using:
```
Systemd: > busctl --user --list
Playerctl: > playerctl --list-all
Libdbus: > dbus-send --session --print-reply --type=method_call --dest='org.freedesktop.DBus' /org org.freedesktop.DBus.ListNames ... | grep 'org.mpris.MediaPlayer2'
```
The identity refers to the part after 'org.mpris.MediaPlayer2'.
For example, firefox may use the bus name
'org.mpris.MediaPlayer2.firefox.instance_1_7' and its identity would be
'firefox'
# SEE ALSO
*yambar-modules*(5), *yambar-particles*(5), *yambar-tags*(5), *yambar-decorations*(5)