mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Merge pull request #105 from David96/master
Allow custom plugins that don't execute anything
This commit is contained in:
commit
65b9911df4
@ -4,14 +4,15 @@ waybar::modules::Custom::Custom(const std::string name,
|
|||||||
const Json::Value& config)
|
const Json::Value& config)
|
||||||
: ALabel(config, "{}"), name_(name)
|
: ALabel(config, "{}"), name_(name)
|
||||||
{
|
{
|
||||||
if (!config_["exec"].isString()) {
|
if (config_["exec"].isString()) {
|
||||||
throw std::runtime_error(name_ + " has no exec path.");
|
|
||||||
}
|
|
||||||
if (interval_.count() > 0) {
|
if (interval_.count() > 0) {
|
||||||
delayWorker();
|
delayWorker();
|
||||||
} else {
|
} else {
|
||||||
continuousWorker();
|
continuousWorker();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void waybar::modules::Custom::delayWorker()
|
void waybar::modules::Custom::delayWorker()
|
||||||
@ -66,7 +67,7 @@ void waybar::modules::Custom::continuousWorker()
|
|||||||
auto waybar::modules::Custom::update() -> void
|
auto waybar::modules::Custom::update() -> void
|
||||||
{
|
{
|
||||||
// Hide label if output is empty
|
// Hide label if output is empty
|
||||||
if (output_.out.empty() || output_.exit_code != 0) {
|
if (config_["exec"].isString() && (output_.out.empty() || output_.exit_code != 0)) {
|
||||||
label_.hide();
|
label_.hide();
|
||||||
label_.set_name("");
|
label_.set_name("");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user