Project

General

Profile

unexist.dev

/

subtle

Assorted tidbits and projects

Tagging » History » Version 49

Anonymous, 06/24/2011 01:13 PM

1 49
h1. Tagging\015\012\015\012{{>toc}}\015\012\015\012\015\012[[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 [[Tags|tag]] to be on a certain [[Views|view]]. This also includes that [[Clients|clients]] that are started on a certain [[Views|view]] will not automatically be placed there.\015\012\015\012There are two ways to define a [[Tags|tag]] in the [[config]]:\015\012\015\012h2. Simple\015\012\015\012The simple way just needs a name and a regular expression to just handle the placement:\015\012\015\012<pre><code class="ruby">tag "tag", "xterm"</code></pre>\015\012\015\012h2. Extended\015\012\015\012Additionally tags can do a lot more then just control the placement - they also have properties than can define and control some aspects of a [[Clients|client]] like the default [[gravity]] or the default [[Screens|screen]] per [[Views|view]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "tag" do\015\012  match   "xterm|[u]?rxvt"\015\012  gravity :center\015\012end\015\012</code></pre>\015\012\015\012h2. Default\015\012\015\012Whenever a window has no [[Tagging|tags]] it will get the +default+ [[Tagging|tag]] and be placed on the default [[Views|view]]. The +default+ view can either be set by the user with adding the +default+ [[Tagging|tag]] to a [[Views|view]] by choice or otherwise the first defined [[Views|view]] will be chosen *automatically*.\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012view "terms", "terms",\015\012view  "www", "default|browser",\015\012view  "dev", "editor"\015\012</code></pre>\015\012\015\012h2. Properties\015\012\015\012Additionally [[tagging|tags]] can do a lot more then just control the placement - they also have properties than can define and control some aspects of a [[Clients|client] like the [[gravity]].\015\012\015\012{{needs(r2900)}}\015\012\015\012h3. Borderless \015\012\015\012This property enables the [[Clients#Borderless|borderless mode]] for [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "borderless" do\015\012  match       "xterm"\015\012  borderless  true\015\012end</code></pre>\015\012\015\012{{needs(r2890)}}\015\012\015\012h3. Fixed\015\012\015\012This property enables the [[Clients#Fixed|fixed mode]] for [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "fixed" do\015\012  match "xterm"\015\012  fixed  true\015\012end</code></pre>\015\012\015\012h3. Float\015\012\015\012This property enables the [[Clients#Floating|floating mode]] [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "float" do\015\012  match"xterm"\015\012  float true\015\012end\015\012</code></pre>\015\012\015\012h3. Full\015\012\015\012This property enables the [[Clients#Fullscreen|fullscreen mode]] for [[Tagging|tagged]] [[Clients|clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "full" do\015\012  match "xterm"\015\012  full  true\015\012end\015\012</code></pre>\015\012\015\012h3. Geometry\015\012\015\012This property sets a certain geometry as well as floating to the [[Tagging|tagged]] [[Clients|client]], but +only+ on [[views]] that have this tag too. It expects an "array":http://www.ruby-doc.org/core/classes/Array.html with *x*, *y*, *width* and *height* values whereas width and height *must* be >0.\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "geometry" do\015\012  match    "xterm"\015\012  geometry [ 10, 10, 100, 100 ]\015\012end\015\012</code></pre>\015\012\015\012h3. Gravity\015\012\015\012This property sets a certain to [[gravity]] to the [[Tagging|tagged]] [[Clients|client]], but +only+ on [[Tagging|matching]] [[views]].\015\012<pre>{{hide}}<code class="ruby">\015\012tag "gravity" do\015\012  match   "xterm"\015\012  gravity :center\015\012end\015\012</code></pre>\015\012\015\012h3. Match\015\012\015\012This property adds matching patterns to a [[Tagging|tag]], a [[Tagging|tag]] can have more than one. Matching works either via plaintext, regex (see "regex(7)":http://linux.die.net/man/7/regex)) or window id. Per default tags will only match the "WM_NAME":http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html and the "WM_CLASS":http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html portion of a client.\015\012\015\012This can be changed by following possible values:\015\012\015\012| *&#58;name*     | Match the WM_NAME which is also visible in the [[panel]] |\015\012| *&#58;instance* | Match the {{color(#ff0000, WM_CLASS)}}                   |\015\012| *&#58;class*    | Match the {{color(#0000ff, WM_CLASS)}}                   |\015\012| *&#58;role*     | Match the window role                                    |\015\012| *&#58;type*     | Match the [[Clients#Types|window type]]                  |\015\012\015\012\015\012There are several ways to get these values, here are the most common:\015\012\015\012* "xprop":http://www.xfree86.org/current/xprop.1.html: Just select the window and have a look for the "WM_CLASS":http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html line which usually look like this:\015\012\015\012p{class:pre}. WM_CLASS(STRING) = "{{color(#ff0000, urxvt)}}", "{{color(#0000ff, URxvt)}}")\015\012\015\012* [[subtler]]: Run *[[subtler]] -cl* and look for the matching line:\015\012\015\012p{class:pre}. 0x800007 * 1 100x100 5 0 --- {{color(#ff0000, xterm)}} ({{color(#0000ff,XTerm)}})\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "match" do\015\012  match [ :title, :class ] => "xterm"\015\012end\015\012\015\012tag "match" do\015\012  match "xterm"\015\012end\015\012</code></pre>\015\012\015\012{{info(When dealing with console-based apps please keep in mind, that [[Tagging|tagging]] via WM_NAME won't work as expected. [[Tagging|Tags]] are usually applied *when* the terminal starts and *before* the shell with the app is spawned.)}}\015\012\015\012Please also check the "How do I tag console based programs?":http://subforge.org/ezfaq/show/subtle?faq_id=15 FAQ entry.\015\012\015\012h3. Position\015\012\015\012Similar to the geometry property, this property just sets the x/y coordinates of the [[Tagging|tagged]] [[Clients|client]], but +only+ on [[views]] that have this [[Tagging|tag]], too. It expects an "array":http://www.ruby-doc.org/core/classes/Array.html with *x* and *y* values.\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "position" do\015\012  match    "xterm"\015\012  position [ 10, 10 ]\015\012end\015\012</code></pre>\015\012\015\012h3. Resize\015\012\015\012This property enables the [[Clients#Resize|resize mode]] for [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "resize" do\015\012  match  "xterm"\015\012  resize true\015\012end\015\012</code></pre>\015\012\015\012h3. Stick\015\012\015\012This property enables the [[Clients#Sticky|sticky mode]] for [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "stick" do\015\012  match "xterm"\015\012  stick true\015\012end\015\012</code></pre>\015\012\015\012h3. Type\015\012\015\012This property sets the [[Tagging|tagged]] [[Clients|client]] to be treated as a specific window type though as the window sets the type itself. \015\012\015\012Following types are possible:\015\012\015\012{{needs(r2905)}}\015\012\015\012| *&#58;normal* | Treat as [[Clients#Normal|normal window]]                                     |\015\012| *&#58;desktop* | Treat as [[Clients#Desktop|desktop window]] (__NET_WM_WINDOW_TYPE_DESKTOP_)  |\015\012| *&#58;dock*    | Treat as [[Clients#Dock|dock window]] (__NET_WM_WINDOW_TYPE_DOCK_)           |\015\012| *&#58;toolbar* | Treat as [[Clients#Toolbar|toolbar windows]] (__NET_WM_WINDOW_TYPE_TOOLBAR_) |\015\012| *&#58;splash*  | Treat as [[Clients#splash|splash window]] (__NET_WM_WINDOW_TYPE_SPLASH_)     |\015\012| *&#58;dialog*  | Treat as [[Clients#Dialog|dialog window]] (__NET_WM_WINDOW_TYPE_DIALOG_)     |\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "desktop" do\015\012  match   "xterm"\015\012  type    :desktop\015\012end\015\012</code></pre>\015\012\015\012h3. Urgent\015\012\015\012This property enables the [[Clients#Urgent|urgent mode]] for [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "urgent" do\015\012  match  "xterm"\015\012  urgent true\015\012end\015\012</code></pre>\015\012\015\012{{needs(r2871)}}\015\012\015\012h3. Zaphod\015\012\015\012This property enables the [[Clients#Zaphod|zaphod mode]] for [[Tagging|tagged]] [[clients]].\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "zaphod" do\015\012  match  "xterm"\015\012  zaphod true\015\012end</code></pre>\015\012\015\012h2. Examples\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012tag "bashrun" do\015\012  match    "bashrun"\015\012  geometry [ 50, 1000, 200, 28 ]#\015\012  stick    true\015\012  urgent   true\015\012end\015\012\015\012tag "browser" do\015\012  match   "chrom[e|ium]"\015\012  gravity :center\015\012end\015\012</code></pre>