Updated tag handling

Replaced exclude matching by logic AND
Added by Christoph Kappel over 3 years ago

Tagging is a double edged sword, some windows especially terminals are really difficult to tag, because they usually retain their class value like URxvt and all tags that include urxvt match every instance. To make this easier there is the exclude match to sort this cases out.

Exclude was just a mere hack, hence in r2813 this hack is replaced by a more sophiscated way. Matching values can now be combined in a logic AND fashion.

Following example, there are two terminals, one urxvt and one xterm with following data:

  0x600009 * 0    0 x  408 +  796 + 388        bottom ---- foo (URxvt)
  0x800022 * 0    0 x   16 +  796 + 388           top ---- foo (XTerm)

Matching both windows is easy based on the class, but difficult based on the instance name.

Before r2813:

 1 tag "test1" do
 2   match   :instance => "test" 
 3   exclude :class    => "XTerm" 
 4 end
 6 tag "test2" do
 7   match   :instance => "test" 
 8   exclude :class    => "XTerm" 
 9 end


1 tag "test" do
2   match :instance => "test", :class => "urxvt" 
3 end

Too make long story short: Match allows to combine different values for a finer grained control.

Update: The removal of the exclude option lead to confusion, in fact in all cases the option was horribly misused. The correct way is to match the clients that should be tagged and not match all and exclude some.

The common use case is a tag for all urxvt's without -name, but knowing that -name basically just changes the instance value (first string) of WM_CLASS this is just wrong.

1 tag "terms" do
2   match "urxvt" 
3   exclude "irssi|ncmpcpp|ranger" 
4 end


1 tag "terms" do
2   match :instance => "urxvt" 
3 end