A module to display currently playing media in your Waybar.
Supports fetching data from the following media players:
- Firefox, Google Chrome, Chromium and other browsers
via KDE Plasma Integration. You must follow their instructions for installing a browser extension and a native host. KDE Plasma itself is not required. - MPV
- Potentially, any other player that supports MPRIS. Feel free to open an issue.
In the toolbar, the current title and artist are shown separated by a dash, like so: Mountains - Hans Zimmer
.
Long titles/artists will be ellipsized to 80 characters.
The tooltip displays more metadata, including the album and player name.
If you use Arch Linux, you may use the following packages: python-pydbus python-psutil
Put waybar-media.py
somewhere in your path, e.g. ~/.local/bin/
Add to your Waybar configuration as a custom module, like so:
{
"modules-center": ["custom/waybar-media"],
"custom/waybar-media": {
"return-type": "json",
"exec": "waybar-media.py status",
"on-click": "waybar-media.py playpause",
"on-scroll-up": "waybar-media.py previous",
"on-scroll-down": "waybar-media.py next",
"escape": true
}
}
As shown above, waybar-media.py
always takes one argument. These are the available options:
status
: Print the status in Waybar's JSON format.playpause
: Toggle the state of the current player.previous
: Go to the previous song.next
: Go to the next song.
You may use the following classes to style the module:
playing
paused
stopped
Here's an example:
#custom-waybar-media.paused {
color: grey;
}