How do I tag console based programs?

Added by Christoph Kappel over 6 years ago. Updated by Christoph Kappel over 5 years ago.

Category: Tagging Difficulty: Difficulty5
Assignee: - Due date:
Related issue: - Related Message: -
Related version: - Views: 5462
Valid: Valid


When console based programs like irssi are started with a terminal like urxvt -e irssi, they usually just change the WM_NAME of the terminal and per default, subtle uses both of the WM_CLASS values for tagging.

The problem about that is, that the tagging is normally done before the terminal really starts the desired app. To avoid that all better known terminals support the -name argument which changes the instance value (first string) of the WM_CLASS: urxvt -name irssi -e irssi

Another problem is that terminals retain their class value (second string) of the WM_CLASS and may match other tags like:

1 tag "terms" do
2   match "urxvt" 
3 end

The common solution to bypass is this to use the :instance matcher, which just matches when for the specific instance value. So the easiest way to reliable match this client is a tag like this:

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

Following table shows the WM_NAME and WM_CLASS output of xprop of the various combinations:

urxvt urxvt urxvt, URxvt
urxvt -e irssi irssi urxvt, URxvt
urxvt -name irssi urxvt irssi, URxvt
urxvt -name irssi -e irssi irssi irssi, URxvt

Please have a look at the tagging wiki page for more information.

Also available in: PDF