Skip to content
sstarkPublic

About

Watch wireplumber volume and show it using wob

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

wobmon

wobmon watches the volume of the default WirePlumber audio sink and sends it to wob as an integer from 0 to 100. It is meant to run in the background, so changing the volume with the normal media keys (or anything else) automatically displays the wob bar without extra Hyprland keybind configuration.

Requirements

  • PipeWire + WirePlumber (pw-dump and wpctl in PATH)
  • Python 3
  • wob running and listening on its FIFO/socket

wpctl is only needed for the --poll fallback.

Usage

$ ./wobmon

The wob socket path is resolved in this order:

  1. the command-line argument: ./wobmon /path/to/wob.sock (or ./wobmon --socket /path/to/wob.sock)
  2. $WOBSOCK
  3. $XDG_RUNTIME_DIR/wob.sock

Other options:

$ ./wobmon --help
$ ./wobmon --verbose                 # log every value that is sent
$ ./wobmon --mute-as-zero            # show 0 while the sink is muted
$ ./wobmon --skip-initial            # don't show the volume at startup
$ ./wobmon --poll --interval 0.05    # poll wpctl instead of using pw-dump

By default wobmon reads pw-dump --monitor events, so it reacts immediately and does not spawn wpctl for every volume change. It automatically follows changes to the default sink.

Start it with Hyprland

Download the wobmon executable and place it somewhere in your path.

Add one line to your Hyprland config:

exec-once = wobmon

wob itself still has to be started (for example as a systemd socket-activated user service). wobmon does not need any volume keybinds.

A systemd user service is also fine:

[Unit]
Description=Show WirePlumber volume in wob
After=graphical-session.target
PartOf=graphical-session.target

[Service]
ExecStart=%h/.local/bin/wobmon
Restart=on-failure

[Install]
WantedBy=graphical-session.target

Nix flake

The repository is a flake with these outputs:

  • packages.<system>.default / packages.<system>.wobmon
  • overlays.default
  • homeModules.default (alias: homeModules.wobmon)

Home Manager

Add the flake input and make its nixpkgs follow yours:

{
  inputs.wobmon.url = "github:sstark/wobmon";
  inputs.wobmon.inputs.nixpkgs.follows = "nixpkgs";
}

Import the module and enable the service:

{
  imports = [ inputs.wobmon.homeModules.default ];

  services.wobmon = {
    enable = true;

    # Defaults:
    # socket = "%t/wob.sock";
    # wobUnit = "wob.service";
    # muteAsZero = false;
    # skipInitial = false;
    # poll = false;
    # interval = null;
    # extraArgs = [ ];
  };
}

The module creates systemd.user.services.wobmon with this shape:

[Unit]
After=graphical-session.target wob.service
BindsTo=wob.service
PartOf=graphical-session.target

[Service]
ExecStart=.../bin/wobmon
Environment=WOBSOCK=%t/wob.sock
Restart=on-failure
RestartSec=2

[Install]
WantedBy=graphical-session.target

Set wobUnit = null if you do not want the module to bind wobmon to your wob service. Set socket = null to let wobmon use its own socket resolution.

Module options

Option Default Description
services.wobmon.enable false Enable the systemd user service.
services.wobmon.package flake package wobmon package to use.
services.wobmon.socket "%t/wob.sock" WOBSOCK value; null uses wobmon's default.
services.wobmon.wobUnit "wob.service" Unit that owns the FIFO; null disables After/BindsTo.
services.wobmon.muteAsZero false Pass --mute-as-zero.
services.wobmon.skipInitial false Pass --skip-initial; don't show the volume at startup.
services.wobmon.poll false Pass --poll.
services.wobmon.interval null Pass --interval SECONDS.
services.wobmon.extraArgs [] Extra command-line arguments.

Without Home Manager

$ nix build .
$ ./result/bin/wobmon --help

About

Watch wireplumber volume and show it using wob

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages