sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

index.md (2254B)


      1 Setting rules in config.h
      2 =========================
      3 
      4 What does '`rules`' do?
      5 -----------------------
      6 The `rules` array allows treating of certain applications (clients) uniquely.
      7 A rule has a matching and an action part. When a new client appears (sends a
      8 maprequest), it is matched against the rules based on its class, instance
      9 (`WM_CLASS`) and title (`WM_NAME`) properties and then the given tag and
     10 floating mode setting actions are performed. The default tag mask is `0`, which
     11 means the currently viewed tags and the default mode is tiled so isfloating is
     12 `False` or `0`.
     13 
     14 Example from the default config:
     15 
     16 	static Rule rules[] = {
     17 		/* class      instance    title       tags mask     isfloating   monitor */
     18 		{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     19 		{ "Firefox",  NULL,       NULL,       1 << 8,       1,           -1 },
     20 		{ "deadbeef", NULL,       NULL,       1 << 7,       0             0 }
     21 	};
     22 
     23 These rules make every Gimp and Firefox window floating and makes Firefox
     24 windows appear on tag 9 instead of the currently viewed tags.
     25 deadbeef similarly displays its window on tag 8 for a secondary display
     26 monitor.
     27 
     28 How does the matching work?
     29 ---------------------------
     30 A client is matched if its properties contain the given strings as substrings
     31 (case-sensitively) or `NULL` is given (which means anything is matched there).
     32 
     33 More than one rule can be applied to a client, the rules are matched in order.
     34 
     35 How to check these properties of a client?
     36 ------------------------------------------
     37 The `xprop` utility can be used to get this information:
     38 `WM_CLASS` is (instance, class) `WM_NAME` (or `_NET_WM_NAME`) is the title.
     39 
     40 For example this shell script prints the relevant properties of the selected
     41 client (if the properties does not contain '`=`' or '`,`'):
     42 
     43 	xprop | awk '
     44 		/^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print}
     45 		/^WM_NAME/{sub(/.* =/, "title:"); print}'
     46 
     47 How to add exception to a tagging rule?
     48 ---------------------------------------
     49 It cannot be simply done. For example it is difficult to achieve that each
     50 Firefox window goes to tag 9 except one specific dialog, which goes to tag 8,
     51 because the tag masks of different matched rules are 'or'ed (and not overwritten).