No description
  • C++ 93.7%
  • CMake 3.9%
  • Shell 2.4%
Find a file
2026-06-16 19:56:39 +02:00
docs with correct centering 2026-06-16 19:56:39 +02:00
packaging Make the build Linux-only and drop unused dependencies 2026-06-03 14:35:08 +02:00
src MprisPlayer: extract D-Bus call helpers to remove duplication 2026-06-03 15:19:35 +02:00
tests Drop QStringLiteral wrappers, rely on implicit const-char* conversion 2026-06-03 15:09:47 +02:00
.clang-format Add .clang-format matching the existing style and format the tree 2026-06-01 20:58:54 +02:00
.clangd Add .clangd config for warning-free editing (Neovim/clangd) 2026-06-03 14:59:56 +02:00
.gitignore Add Arch PKGBUILD for makepkg 2026-06-01 17:07:51 +02:00
CMakeLists.txt Add .clangd config for warning-free editing (Neovim/clangd) 2026-06-03 14:59:56 +02:00
README.md Add a CLI with QCommandLineParser and a --nerd-font glyph option 2026-06-03 14:18:11 +02:00

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.

barplayer with a light theme — Catppuccin Latte

barplayer with a dark theme — Catppuccin Mocha

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-font to the daemon ("exec": "barplayer --nerd-font") to use Nerd Font media glyphs instead. Run barplayer --help for all options.
  • The popup closes when you click anywhere outside it, click the bar button again, or press Esc.