Project

General

Profile

unexist.dev

Assorted tidbits and projects

Updated tag handling

Replaced exclude matching by logic AND
Added by Christoph Kappel over 13 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.

{{column(:start)}}
Before r2813:

tag "test1" do
  match   :instance => "test" 
  exclude :class    => "XTerm" 
end

tag "test2" do
  match   :instance => "test" 
  exclude :class    => "XTerm" 
end

{{column(:mid)}}
Now:

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

{{column(: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.

{{column(:start)}}
Wrong:

tag "terms" do
  match "urxvt" 
  exclude "irssi|ncmpcpp|ranger" 
end

{{column(:mid)}}
Correct:

tag "terms" do
  match :instance => "urxvt" 
end

end

{{column(:end)}}


Comments