diff --git a/config.def.h b/config.def.h index d3b6a4b7bbf244a9d824d99340e5fc6d9ecb8a56..92b1a461604c81c061f60780dc189a83dd697562 100644 --- a/config.def.h +++ b/config.def.h @@ -22,22 +22,28 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating monitor */ { "Gimp", NULL, NULL, 0, True, -1 }, { "Firefox", NULL, NULL, 1 << 8, False, -1 }, }; /* layout(s) */ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ +static const int nviews = 1; /* number of tags highlighted by default */ static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ +static const int master[1]; /* nmaster override per monitor */ +//static const int master[] = {1,-1}; /* monitor 0 = nmaster 1, monitor 1 = no nmaster (all vertical) */ +static const int views[1]; /* nviews override per monitor */ +//static const int views[] = {4,~0}; /* monitor 0 = nviews 4, monitor 1 = all (all highlighted) */ + static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, }; /* key definitions */ #define WINKEY Mod4Mask #define MODKEY Mod1Mask @@ -84,30 +90,32 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) TAGKEYS( XK_4, 3) TAGKEYS( XK_5, 4) TAGKEYS( XK_6, 5) TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) + { MODKEY, XK_grave, reset_view, {0} }, { MODKEY|ShiftMask, XK_q, quit, {0} }, }; /* button definitions */ /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, { ClkMonNum, 0, Button1, focusmon, {.i = +1} }, + { ClkMonNum, 0, Button2, reset_view, {0} }, { ClkMonNum, 0, Button3, focusmon, {.i = -1} }, { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkTagBar, 0, Button1, view, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, MODKEY|WINKEY, Button1, nview, {0} }, { ClkTagBar, MODKEY|WINKEY, Button3, ntoggleview, {0} }, diff --git a/dwm.c b/dwm.c index f6e9588d78a01e3263de54e94bd1559434a802c2..2b3bf5f99c95180cfb5a3bb04b4181481fbe7bbd 100644 --- a/dwm.c +++ b/dwm.c @@ -227,20 +227,21 @@ static void updatewindowtype(Client *c); static void updatetitle(Client *c); static void updatewmhints(Client *c); static void nview(const Arg *arg); static void view(const Arg *arg); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void reset_view(const Arg *arg); /* variables */ static const char broken[] = "broken"; static char stext[256]; static int screen; static int sw, sh; /* X display screen geometry width, height */ static int bh, blw, bmw = 0; /* bar geometry */ static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int numlockmask = 0; static void (*handler[LASTEvent]) (XEvent *) = { @@ -2069,28 +2070,48 @@ zoom(const Arg *arg) { if(!selmon->lt[selmon->sellt]->arrange || (selmon->sel && selmon->sel->isfloating)) return; if(c == nexttiled(selmon->clients)) if(!c || !(c = nexttiled(c->next))) return; pop(c); } +void +reset_view(const Arg *arg) { + const Arg n = {.i = +1}; + const Arg m = {.f = 1 + mfact}; + const int mon = selmon->num; + Arg i = {.i = 0}; + Arg v = {.ui = 0}; + do { + focusmon(&n); + i.i = (master[selmon->num] ? master[selmon->num] : nmaster) - selmon->nmaster; + incnmaster(&i); + setmfact(&m); + v.ui = (views[selmon->num] == ~0 ? ~0 : ((1 << (views[selmon->num] ? views[selmon->num] : nviews)) -1)); + view(&v); + } + while (selmon->num != mon); +} + int main(int argc, char *argv[]) { if(argc == 2 && !strcmp("-v", argv[1])) die("dwm-"VERSION", © 2006-2012 dwm engineers, see LICENSE for details\n"); else if(argc != 1) die("usage: dwm [-v]\n"); if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fputs("warning: no locale support\n", stderr); if(!(dpy = XOpenDisplay(NULL))) die("dwm: cannot open display\n"); checkotherwm(); setup(); scan(); + const Arg r = {0}; + reset_view(&r); run(); cleanup(); XCloseDisplay(dpy); return EXIT_SUCCESS; }