-
-
Notifications
You must be signed in to change notification settings - Fork 953
Description
After PR #4682 (merged Dec 18, 2025), the cava module fails with:
[warning] module cava: Disabling module "cava", Unknown module
This happens when using waybar's cava module without a cava_config file specified, which worked correctly before PR #4682.
Root Cause
The refactoring in PR #4682 introduced a mismatch between cava_backend.cpp and cava_frontend.hpp:
cava_backend.cpp
The output method is saved, temporarily set to RAW for initialization, then restored to the original value:
Save original output method:
Waybar/src/modules/cava/cava_backend.cpp
Line 184 in 97eb606
| auto const output{prm_.output}; |
Restore original output method (BUG):
Waybar/src/modules/cava/cava_backend.cpp
Line 267 in 97eb606
| prm_.output = output; |
cava_frontend.hpp
The frontend only accepts OUTPUT_RAW or OUTPUT_SDL_GLSL, rejecting all other output methods:
Switch statement that throws "Unknown module":
Waybar/include/modules/cava/cava_frontend.hpp
Lines 14 to 25 in 97eb606
| const std::shared_ptr<CavaBackend> backend_{waybar::modules::cava::CavaBackend::inst(config)}; | |
| switch (backend_->getPrm()->output) { | |
| case ::cava::output_method::OUTPUT_RAW: | |
| return new waybar::modules::cava::Cava(id, config); | |
| break; | |
| #ifdef HAVE_LIBCAVAGLSL | |
| case ::cava::output_method::OUTPUT_SDL_GLSL: | |
| return new waybar::modules::cava::CavaGLSL(id, config); | |
| break; | |
| #endif | |
| default: | |
| break; |
Cava library default
When no config file is provided, cava defaults to OUTPUT_NONCURSES:
Default output method is "noncurses":
https://github.com/LukashonakV/cava/blob/256cf7aa7c893fb457d54477bd20758db3d79026/config.c#L819
Old code (pre-PR #4682)
The old implementation simply set OUTPUT_RAW once and never changed it:
Old cava.cpp:
Line 22 in cbab9c9
| prm_.output = cava::output_method::OUTPUT_RAW; |
Flow Analysis
- Waybar config has no
cava_configoption → empty path passed toload_config() - Cava library uses default
output:method = noncurses→OUTPUT_NONCURSES cava_backend.cppsavesOUTPUT_NONCURSES, sets toOUTPUT_RAWfor init, then restores toOUTPUT_NONCURSEScava_frontend.hppcallsgetPrm()->output→ getsOUTPUT_NONCURSES- Switch statement doesn't match
OUTPUT_RAWorOUTPUT_SDL_GLSL - Falls through to
throw std::runtime_error("Unknown module")
Steps to Reproduce
- Use waybar built from current master (commit 97eb606 or later)
- Add cava module to waybar config without
cava_configoption:
"cava": {
"framerate": 60,
"bars": 12,
"method": "pulse",
"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
}- Run waybar
- See warning:
module cava: Disabling module "cava", Unknown module
Expected Behavior
Cava module should work without requiring a separate cava config file, as it did before PR #4682.
Suggested Fix
Either:
Option A: Don't restore the output method in cava_backend.cpp (line 267):
// prm_.output = output; // Keep OUTPUT_RAW for waybarOption B: Handle all output methods in cava_frontend.hpp, defaulting to raw Cava for non-GLSL methods:
switch (backend_->getPrm()->output) {
case OUTPUT_SDL_GLSL:
return new CavaGLSL(id, config);
default: // All other methods use raw text cava
return new Cava(id, config);
}System Info
- waybar version: 0.14.0+date=2025-12-18_97eb606
- OS: NixOS (Linux 6.18.2)
- Built with cava support from flake input
github:Alexays/waybar
Workaround
Create a cava config file with explicit method = raw in [output] section and reference via cava_config in waybar config. But this shouldn't be necessary for basic usage.