diff --git a/man/waybar.5.scd.in b/man/waybar.5.scd.in index d366e3e6..7061bc68 100644 --- a/man/waybar.5.scd.in +++ b/man/waybar.5.scd.in @@ -30,6 +30,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. Exclamation mark(*!*) can be used to exclude specific output. + In an array, star '*\**' can be used at the end to accept all outputs, in case all previous entries are exclusions. *position* ++ typeof: string ++ diff --git a/src/config.cpp b/src/config.cpp index a4d90909..45f5ee38 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -124,9 +124,21 @@ bool isValidOutput(const Json::Value &config, const std::string &name, const std::string &identifier) { if (config["output"].isArray()) { for (auto const &output_conf : config["output"]) { - if (output_conf.isString() && - (output_conf.asString() == name || output_conf.asString() == identifier)) { - return true; + if (output_conf.isString()) { + auto config_output = output_conf.asString(); + if (config_output.substr(0, 1) == "!") { + if (config_output.substr(1) == name || config_output.substr(1) == identifier) { + return false; + } else { + continue; + } + } + if (config_output == name || config_output == identifier) { + return true; + } + if (config_output.substr(0, 1) == "*") { + return true; + } } } return false;