mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-04 01:32:42 +01:00 
			
		
		
		
	config:output:Allow multiple exclusions & wildcard
Covers the use case where needing to exclude more than 1 output but still include all other displays. e.g. I have 3 monitors: laptop + HD + 4K; and 3 bar types: - The main bar is on the laptop. `output: "laptop-monitor-id"` - The 4K has a specific waybar bar-1 configuration. `output: "4K-monitor-id"` - I want all other displays (3rd HD monitor / any HDMI output when presenting) to have a plain bar: `output: ["!laptop-monitor-id", "!4k-monitor-id", "*"]`
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user