- C++ 93.7%
- CMake 3.9%
- Shell 2.4%
| docs | ||
| packaging | ||
| src | ||
| tests | ||
| .clang-format | ||
| .clangd | ||
| .gitignore | ||
| CMakeLists.txt | ||
| README.md | ||
barplayer
An MPRIS media indicator for Waybar with a click-to-open, seekable popup player.
The bar shows the currently playing track; clicking it opens a small popup with album art, title/artist, a draggable seek bar, and previous / play-pause / next controls. It follows whichever MPRIS player you most recently interacted with, and adopts your active Qt theme.
How it works
barplayer is a single binary with two roles:
| Invocation | Role |
|---|---|
barplayer |
Daemon. Launched by Waybar's exec. Prints JSON status lines to stdout and serves the popup. |
barplayer toggle |
Client. Used by Waybar's on-click; toggles the popup over D-Bus. |
barplayer show / hide |
Explicitly show or hide the popup. |
The daemon talks to players over MPRIS (D-Bus) and exposes its own service
org.barplayer so the toggle client can reach it. The popup is a Wayland
layer-shell overlay anchored just beneath the bar, centred on the bar module
itself: it reads the module's on-screen rectangle from the desktop accessibility
tree (AT-SPI), so it stays under the pill wherever it sits and however the bar
reflows. It falls back to the click position when that lookup is unavailable.
Requirements
- A Wayland compositor supporting
wlr-layer-shell(Hyprland, sway, river, …) - Qt 6.5+,
LayerShellQt,at-spi2-core(libatspi, for popup positioning) - Build: CMake 3.21+, a C++23 compiler
Build
cmake -S . -B build -G Ninja
cmake --build build
ctest --test-dir build # optional: run the unit tests
cmake --install build # installs `barplayer` to <prefix>/bin
Or run it straight from the build tree: build/src/barplayer.
Waybar configuration
Add a custom module to ~/.config/waybar/config.jsonc:
"custom/barplayer": {
"exec": "barplayer",
"return-type": "json",
"on-click": "barplayer toggle",
"escape": true
}
…and reference it in one of your module lists, e.g.:
"modules-right": ["custom/barplayer", "pulseaudio", "clock"],
The module reports a CSS class of playing, paused, or stopped, so you can
style it in style.css:
#custom-barplayer.playing { color: #a6e3a1; }
#custom-barplayer.paused { color: #f9e2af; }
#custom-barplayer.stopped { opacity: 0; } /* hidden when nothing is playing */
When nothing is playing the module emits empty text, so Waybar collapses it.
Notes
- The popup follows your active Qt theme (qt6ct / Kvantum / KDE colours), including light mode — it only sets its rounded-card background from the palette and leaves labels, slider and buttons to the active style. Switching themes at runtime re-colours the painted icons automatically.
- The bar glyphs default to plain Unicode (
▶/⏸). Pass--nerd-fontto the daemon ("exec": "barplayer --nerd-font") to use Nerd Font media glyphs instead. Runbarplayer --helpfor all options. - The popup closes when you click anywhere outside it, click the bar button
again, or press
Esc.

