diff options
-rw-r--r-- | config.def.h | 5 | ||||
-rw-r--r-- | dwm.c | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h index 9c2b2c5..804752e 100644 --- a/config.def.h +++ b/config.def.h @@ -45,6 +45,11 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const int mainmon = 0; /* xsetroot will only change the bar on this monitor */ +static const int lpm[] = { + /* Index of preferred layout], if LENGTH(lpm)<#monitors -> default layout */ + 0, 5 +}; + static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ @@ -143,6 +143,7 @@ typedef struct { } Rule; /* function declarations */ +static void applydefaultlayouts(); static void applyrules(Client *c); static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); static void arrange(Monitor *m); @@ -296,6 +297,21 @@ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; /* function implementations */ void +applydefaultlayouts() +{ + Monitor *m; + int i = 0; + for (m = mons; m; m = m->next) { + if (i < LENGTH(lpm)) { + m->lt[0] = &layouts[lpm[i]]; + m->lt[1] = &layouts[(lpm[i] + 1)/ LENGTH(layouts)]; + strncpy(m->ltsymbol, layouts[i].symbol, sizeof m->ltsymbol); + } + i++; + } +} + +void applyrules(Client *c) { const char *class, *instance; @@ -2119,6 +2135,7 @@ updategeom(void) selmon = mons; cleanupmon(m); } + applydefaultlayouts(); free(unique); } else #endif /* XINERAMA */ |