Tagging

Tags are generally used in subtle for placement of windows. This placement is mandatory, that means that - aside from other tiling window managers - windows must have a matching tag to be on a certain view. This also includes that windows that are started on a certain view will not automatically be placed there.

There are two ways to define a tag in the config:
  • with a string
    1 tag "tag", "xterm" 
    
  • with a hash of properties
    Numbers: on /off1 tag "tag" do
    2   match   "xterm|[u]?rxvt" 
    3   gravity :center
    4 end
    

Default

Whenever a window has no tags it will get the default tag and be placed on the default view. The default view can either be set by the user with adding the default tag to a view by choice or otherwise the first defined view will be chosen automatically.

Example:

Numbers: on /off1 view "terms", "terms",
2 view  "www", "default|browser",
3 view  "dev", "editor" 

Properties

Additionally tags can do a lot more then just control the placement - they also have properties than can define and control some aspects of a window like the default gravity or the default screen per view.

float

This property either sets the tagged client floating or prevents it from being floating depending on the value.

Numbers: on /off 1 tag "float" do
 2   match"xterm" 
 3   float true
 4 end
 5 
 6 tag "nofloat" do
 7   match "xterm" 
 8   float false
 9 end

full

This property either sets the tagged client to fullscreen or prevents it from being set to fullscreen depending on the value.

Numbers: on /off 1 tag "full" do
 2   match "xterm" 
 3   full  true
 4 end
 5 
 6 tag "nofull" do
 7   match "xterm" 
 8   full  false
 9 end

gravity

This property sets a certain to gravity to the tagged client, but only on views that have this tag too.

Numbers: on /off1 tag "gravity" do
2   match   "xterm" 
3   gravity :center
4 end

match

This property adds matching patterns to a tag, a tag can have more than one. Matching works either via plaintext, regex (see regex) or window id. Per default tags will only match the WM_NAME and the WM_CLASS portion of a client.

This can be changed by following possible values:

:title Match the title which is also visible in the panel
:name Match the WM_NAME
:class Match the WM_CLASS
:role Match the window role
:type Match the window type

There are several ways to get these values, here are the most common:

  • xprop: Just select the window and have a look for the WM_CLASS line which usually look like this:

WM_CLASS(STRING) = " urxvt", " URxvt")

0x800007 * 1 100x100 5 0 --- xterm (XTerm)

Numbers: on /off1 tag "match" do
2   match [ :title, :class ] => "xterm" 
3 end
4 
5 tag "match" 
6   match "xterm" 
7 end

exclude

This property works exactly the same way as match, but it excludes clients that match from this tag. That can be helpful with catch-all tags e.g. for console apps.

Numbers: on /off1 tag "exclude" do
2   match   "urxvt" 
3   exclude :instance => "irssi" 
4 end

resize

This property either enables or disables honoring of client resize hints and is independent of the global option.

Numbers: on /off1 tag "resize" do
2   match  "xterm" 
3   resize true
4 end

size

This property sets a certain to size as well as floating to the tagged cient, but only on views that have this tag too. It expects an array with x, y, width and height values.

Numbers: on /off1 tag "size" do
2   match "xterm" 
3   size  [ 10, 10, 100, 100 ]
4 end

stick

This property either sets the tagged client to stick or prevents it from being set to stick depending on the value. Stick clients are visible on every view.

Numbers: on /off 1 tag "stick" do
 2   match "xterm" 
 3   stick true
 4 end
 5 
 6 tag "nostick" do
 7   match "xterm" 
 8   stick false
 9 end

urgent

This property either sets the tagged client to be urgent or prevents it from being urgent depending on the value. Urgent clients will get keyboard and mouse focus automatically.

Numbers: on /off 1 tag "urgent" do 
 2   match  "xterm" 
 3   urgent true
 4 end
 5 
 6 tag "nourgent" do
 7   match  "xterm" 
 8   urgent false
 9 end

type

This property sets the tagged client to be treated as a specific window type though as the window sets the type itself.

Following types are possible:

:desktop Treat as desktop window (_NET_WM_WINDOW_TYPE_DESKTOP)
:dock Treat as dock window (_NET_WM_WINDOW_TYPE_DOCK)
:toolbar Treat as toolbar windows (_NET_WM_WINDOW_TYPE_TOOLBAR)
:splash Treat as splash window (_NET_WM_WINDOW_TYPE_SPLASH)
:dialog Treat as dialog window (_NET_WM_WINDOW_TYPE_DIALOG)
Numbers: on /off1 tag "desktop" do 
2   match   "xterm" 
3   desktop true
4 end

Examples

Numbers: on /off 1 tag "bashrun" do
 2   match  "bashrun" 
 3   size   [ 50, 1000, 200, 28 ]#
 4   stick  true
 5   float  true
 6   urgent true
 7   screen 0
 8 end
 9 
10 tag "browser" do
11   match   "chrom[e|ium]" 
12   gravity :center
13   screen  1
14 end