[wiki] [upstream] Added noapps page to customisation section to explain how removing all rules implies providing a default rule. || Filippo Erik Negroni

From: <hg_AT_suckless.org>
Date: Wed, 30 Jul 2008 23:17:18 +0100 (BST)

changeset: 84:e0061652e35e
tag: tip
user: Filippo Erik Negroni <f.e.negroni_AT_googlemail.com>
date: Wed Jul 30 23:17:11 2008 +0100
files: dwm/customisation/noapps.md
description:
Added noapps page to customisation section to explain how removing all rules implies providing a default rule.


diff -r 64d92b6491ed -r e0061652e35e dwm/customisation/noapps.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm/customisation/noapps.md Wed Jul 30 23:17:11 2008 +0100
_AT_@ -0,0 +1,40 @@
+Remove application defaults from config.h
+=========================================
+
+The rules array is initialised, by default, to treat windows of class `Gimp` and `Firefox` in a special way.
+If, like me, you don't want any application to be treated in a special way, you must be careful when editing the rules array initialisation code.
+
+The original code describes what each value represents within the Rule structure.
+
+ static Rule rules[] = {
+ /* class instance title tags mask isfloating */
+ { "Gimp", NULL, NULL, 0, True },
+ { "Firefox", NULL, NULL, 1 << 8, True },
+ };
+
+For instance, Gimp and Firefox will be labeled as floating windows, even if the layout seected is Monocle or Tiled.
+In particular, the tag mask will attach Firefox to tag '9'.
+
+If we don't want any window class to be treated in a special way, we need to initialise rules with at least one element:
+
+ static Rule rules[] = {
+ /* class instance title tags mask isfloating */
+ { NULL, NULL, NULL, 0, False },
+ };
+
+The code in dwm.c will check that the `class` element is not NULL before any matching is done.
+
+ /* rule matching */
+ XGetClassHint(dpy, c->win, &ch);
+ for(i = 0; i < LENGTH(rules); i++) {
+ r = &rules[i];
+ if((!r->title || strstr(c->name, r->title))
+ && (!r->class || (ch.res_class && strstr(ch.res_class, r->class)))
+ && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) {
+ c->isfloating = r->isfloating;
+ c->tags |= r->tags & TAGMASK;
+ }
+ }
+
+This code assumes the rules array has at least one element, and that the first rule that does not match will apply to all window classes.
+Therefore, the rule we just made, is the default rule for all new windows and therefore it is important you set the `tags mask` and `isfloating` elements correctly.
Received on Thu Jul 31 2008 - 00:17:18 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:30:22 CEST