mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Merge pull request #596 from vesim987/output-exclusion
Add a way to exclude specific output
This commit is contained in:
commit
9817955fef
@ -28,7 +28,7 @@ Also a minimal example configuration can be found on the at the bottom of this m
|
||||
|
||||
*output* ++
|
||||
typeof: string|array ++
|
||||
Specifies on which screen this bar will be displayed.
|
||||
Specifies on which screen this bar will be displayed. Exclamation mark(*!*) can be used to exclude specific output.
|
||||
|
||||
*position* ++
|
||||
typeof: string ++
|
||||
|
@ -64,21 +64,24 @@ void waybar::Client::handleOutput(struct waybar_output &output) {
|
||||
}
|
||||
|
||||
bool waybar::Client::isValidOutput(const Json::Value &config, struct waybar_output &output) {
|
||||
bool found = true;
|
||||
if (config["output"].isArray()) {
|
||||
bool in_array = false;
|
||||
for (auto const &output_conf : config["output"]) {
|
||||
if (output_conf.isString() && output_conf.asString() == output.name) {
|
||||
in_array = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
found = in_array;
|
||||
return false;
|
||||
} else if (config["output"].isString()) {
|
||||
auto config_output_name = config["output"].asString();
|
||||
if (!config_output_name.empty()) {
|
||||
if (config_output_name.substr(0, 1) == "!") {
|
||||
return config_output_name.substr(1) != output.name;
|
||||
}
|
||||
return config_output_name == output.name;
|
||||
}
|
||||
}
|
||||
if (config["output"].isString() && config["output"].asString() != output.name) {
|
||||
found = false;
|
||||
}
|
||||
return found;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct waybar::waybar_output &waybar::Client::getOutput(void *addr) {
|
||||
|
Loading…
Reference in New Issue
Block a user