Merge pull request #2554 from mutoroglin/cava-hide-on-silence
commit
3d496c2200
|
@ -36,6 +36,7 @@ class Cava final : public ALabel {
|
||||||
std::chrono::seconds fetch_input_delay_{4};
|
std::chrono::seconds fetch_input_delay_{4};
|
||||||
std::chrono::seconds suspend_silence_delay_{0};
|
std::chrono::seconds suspend_silence_delay_{0};
|
||||||
bool silence_{false};
|
bool silence_{false};
|
||||||
|
bool hide_on_silence_{false};
|
||||||
int sleep_counter_{0};
|
int sleep_counter_{0};
|
||||||
// Cava method
|
// Cava method
|
||||||
void pause_resume();
|
void pause_resume();
|
||||||
|
|
|
@ -35,7 +35,7 @@ libcava lives in:
|
||||||
|[ *framerate*
|
|[ *framerate*
|
||||||
:[ integer
|
:[ integer
|
||||||
:[ 30
|
:[ 30
|
||||||
:[ rames per second. Is used as a replacement for *interval*
|
:[ Frames per second. Is used as a replacement for *interval*
|
||||||
|[ *autosens*
|
|[ *autosens*
|
||||||
:[ integer
|
:[ integer
|
||||||
:[ 1
|
:[ 1
|
||||||
|
@ -60,6 +60,10 @@ libcava lives in:
|
||||||
:[ integer
|
:[ integer
|
||||||
:[ 5
|
:[ 5
|
||||||
:[ Seconds with no input before cava main thread goes to sleep mode
|
:[ Seconds with no input before cava main thread goes to sleep mode
|
||||||
|
|[ *hide_on_silence*
|
||||||
|
:[ bool
|
||||||
|
:[ false
|
||||||
|
:[ Hides the widget if no input (after sleep_timer elapsed)
|
||||||
|[ *method*
|
|[ *method*
|
||||||
:[ string
|
:[ string
|
||||||
:[ pulse
|
:[ pulse
|
||||||
|
|
|
@ -64,6 +64,7 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
|
||||||
prm_.noise_reduction = config_["noise_reduction"].asDouble();
|
prm_.noise_reduction = config_["noise_reduction"].asDouble();
|
||||||
if (config_["input_delay"].isInt())
|
if (config_["input_delay"].isInt())
|
||||||
fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt());
|
fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt());
|
||||||
|
if (config_["hide_on_silence"].isBool()) hide_on_silence_ = config_["hide_on_silence"].asBool();
|
||||||
// Make cava parameters configuration
|
// Make cava parameters configuration
|
||||||
plan_ = new cava_plan{};
|
plan_ = new cava_plan{};
|
||||||
|
|
||||||
|
@ -174,10 +175,13 @@ auto waybar::modules::Cava::update() -> void {
|
||||||
}
|
}
|
||||||
|
|
||||||
label_.set_markup(text_);
|
label_.set_markup(text_);
|
||||||
|
label_.show();
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
upThreadDelay(frame_time_milsec_, suspend_silence_delay_);
|
upThreadDelay(frame_time_milsec_, suspend_silence_delay_);
|
||||||
|
if (hide_on_silence_) label_.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Cava::doAction(const std::string& name) -> void {
|
auto waybar::modules::Cava::doAction(const std::string& name) -> void {
|
||||||
|
|
Loading…
Reference in New Issue