A custom Waybar module written in Rust that:
- Shows the current volume with a Unicode icon
- Displays tooltip with exact volume percentage
- Responds to:
- Left click to toggle mute
- Scroll up to increase volume by 5%
- Scroll down to decrease volume by 5%
- Uses wpctl to interface with PipeWire
- Icons change based on volume level:
- π Muted / 0%
- π 1β25%
- π 26β50%
- π 51β100%
- Outputs JSON in Waybar-compatible format
wpctl(part of WirePlumber)- Rust toolchain (
cargo)
Install using Cargo:
cargo install waybar-volumeEnsure ~/.cargo/bin is in your PATH.
Add the following to your Waybar config (~/.config/waybar/config.jsonc):
{
"custom/volume": {
"exec": "waybar-volume",
"on-click": "waybar-volume click-left",
"on-scroll-up": "waybar-volume scroll-up",
"on-scroll-down": "waybar-volume scroll-down",
"interval": 1,
"return-type": "json"
}
}When volume is 45%, not muted:
πWhen muted:
πTooltip will show:
Volume: 45%- Ensure
wpctlis installed and@DEFAULT_AUDIO_SINK@is available. - Run
wayland-volumemanually if no output appears in Waybar.
MIT - do whatever you want.