From 62cb61c670876f192976a366b3fc4175cbe72406 Mon Sep 17 00:00:00 2001 From: Sonter Date: Wed, 14 Aug 2024 11:34:28 +0300 Subject: [PATCH] Add format_silent to cava module --- include/modules/cava.hpp | 1 + src/modules/cava.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/modules/cava.hpp b/include/modules/cava.hpp index 430c71b7..219d9302 100644 --- a/include/modules/cava.hpp +++ b/include/modules/cava.hpp @@ -39,6 +39,7 @@ class Cava final : public ALabel { std::chrono::seconds suspend_silence_delay_{0}; bool silence_{false}; bool hide_on_silence_{false}; + std::string format_silent_{""}; int sleep_counter_{0}; // Cava method void pause_resume(); diff --git a/src/modules/cava.cpp b/src/modules/cava.cpp index 431ce5f1..1841e276 100644 --- a/src/modules/cava.cpp +++ b/src/modules/cava.cpp @@ -59,6 +59,7 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config) if (config_["input_delay"].isInt()) fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt()); if (config_["hide_on_silence"].isBool()) hide_on_silence_ = config_["hide_on_silence"].asBool(); + if (config_["format_silent"].isString()) format_silent_ = config_["format_silent"].asString(); // Make cava parameters configuration plan_ = new cava::cava_plan{}; @@ -176,6 +177,7 @@ auto waybar::modules::Cava::update() -> void { } else { upThreadDelay(frame_time_milsec_, suspend_silence_delay_); if (hide_on_silence_) label_.hide(); + else if (config_["format_silent"].isString()) label_.set_markup(format_silent_); } }