#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define RULES \
-static Rule rule[] = { \
+static Rule rules[] = { \
/* class:instance:title regex tags regex isfloating */ \
{ "Firefox", "3", False }, \
{ "Gimp", NULL, True }, \
/* layout(s) */
#include "tile.h"
#define LAYOUTS \
-static Layout layout[] = { \
+static Layout layouts[] = { \
/* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \
{ "><>", floating }, \
/* key definitions */
#define MODKEY Mod1Mask
#define KEYS \
-Key key[] = { \
+Key keys[] = { \
/* modifier key function argument */ \
{ MODKEY, XK_p, spawn, \
"exe=`dmenu_path | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"'" \
/* Query class:instance:title for regex matching info with following command:
* xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
#define RULES \
-static Rule rule[] = { \
+static Rule rules[] = { \
/* class:instance:title regex tags regex isfloating */ \
{ "Gimp", NULL, True }, \
{ "MPlayer", NULL, True }, \
/* layout(s) */
#include "tile.h"
#define LAYOUTS \
-static Layout layout[] = { \
+static Layout layouts[] = { \
/* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \
{ "><>", floating }, \
/* key definitions */
#define MODKEY Mod1Mask
#define KEYS \
-Key key[] = { \
+Key keys[] = { \
/* modifier key function argument */ \
{ MODKEY|ShiftMask, XK_Return, spawn, "exec xterm" }, \
{ MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \
static void
keypress(XEvent *e) {
KEYS
- unsigned int len = sizeof key / sizeof key[0];
+ unsigned int len = sizeof keys / sizeof keys[0];
unsigned int i;
KeySym keysym;
XKeyEvent *ev = &e->xkey;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < len; i++)
- if(keysym == key[i].keysym
- && CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
+ if(keysym == keys[i].keysym
+ && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state))
{
- if(key[i].func)
- key[i].func(key[i].arg);
+ if(keys[i].func)
+ keys[i].func(keys[i].arg);
}
}
void
grabkeys(void) {
KEYS
- unsigned int len = sizeof key / sizeof key[0];
+ unsigned int len = sizeof keys / sizeof keys[0];
unsigned int i;
KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, root);
for(i = 0; i < len; i++) {
- code = XKeysymToKeycode(dpy, key[i].keysym);
- XGrabKey(dpy, code, key[i].mod, root, True,
+ code = XKeysymToKeycode(dpy, keys[i].keysym);
+ XGrabKey(dpy, code, keys[i].mod, root, True,
GrabModeAsync, GrabModeAsync);
- XGrabKey(dpy, code, key[i].mod | LockMask, root, True,
+ XGrabKey(dpy, code, keys[i].mod | LockMask, root, True,
GrabModeAsync, GrabModeAsync);
- XGrabKey(dpy, code, key[i].mod | numlockmask, root, True,
+ XGrabKey(dpy, code, keys[i].mod | numlockmask, root, True,
GrabModeAsync, GrabModeAsync);
- XGrabKey(dpy, code, key[i].mod | numlockmask | LockMask, root, True,
+ XGrabKey(dpy, code, keys[i].mod | numlockmask | LockMask, root, True,
GrabModeAsync, GrabModeAsync);
}
}
initlayouts(void) {
unsigned int i, w;
- lt = &layout[0];
- nlayouts = sizeof layout / sizeof layout[0];
+ lt = &layouts[0];
+ nlayouts = sizeof layouts / sizeof layouts[0];
for(blw = i = 0; i < nlayouts; i++) {
- w = textw(layout[i].symbol);
+ w = textw(layouts[i].symbol);
if(w > blw)
blw = w;
}
if(!arg) {
lt++;
- if(lt == layout + nlayouts)
- lt = layout;
+ if(lt == layouts + nlayouts)
+ lt = layouts;
}
else {
i = atoi(arg);
if(i < 0 || i >= nlayouts)
return;
- lt = &layout[i];
+ lt = &layouts[i];
}
if(sel)
arrange();
if(regs)
return;
- nrules = sizeof rule / sizeof rule[0];
+ nrules = sizeof rules / sizeof rules[0];
regs = emallocz(nrules * sizeof(Regs));
for(i = 0; i < nrules; i++) {
- if(rule[i].prop) {
+ if(rules[i].prop) {
reg = emallocz(sizeof(regex_t));
- if(regcomp(reg, rule[i].prop, REG_EXTENDED))
+ if(regcomp(reg, rules[i].prop, REG_EXTENDED))
free(reg);
else
regs[i].propregex = reg;
}
- if(rule[i].tags) {
+ if(rules[i].tags) {
reg = emallocz(sizeof(regex_t));
- if(regcomp(reg, rule[i].tags, REG_EXTENDED))
+ if(regcomp(reg, rules[i].tags, REG_EXTENDED))
free(reg);
else
regs[i].tagregex = reg;
ch.res_name ? ch.res_name : "", c->name);
for(i = 0; i < nrules; i++)
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
- c->isfloating = rule[i].isfloating;
+ c->isfloating = rules[i].isfloating;
for(j = 0; regs[i].tagregex && j < ntags; j++) {
if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
matched = True;