commit 3d429fb11776d066aa1a482c90fcb8b28232b3b5
parent 1db0f43b5ac2b43cd13986063d2a1ea0980211bf
Author: Gary B. Genett <me@garybgenett.net>
Date: Tue, 25 Mar 2014 09:15:41 -0700
dwm patches: added multimon patches
Diffstat:
5 files changed, 766 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/multimon-1-added-monitor-marker-to-bar.diff b/dwm.suckless.org/patches/multimon-1-added-monitor-marker-to-bar.diff
@@ -0,0 +1,163 @@
+From 143e7f2f3caa047469c7219cd6b0cb704466683f Mon Sep 17 00:00:00 2001
+From: "Gary B. Genett" <me@garybgenett.net>
+Date: Mon, 24 Mar 2014 13:47:59 -0700
+Subject: added monitor marker to bar
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------1.8.3.2"
+
+This is a multi-part message in MIME format.
+--------------1.8.3.2
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+---
+ config.def.h | 2 ++
+ dwm.c | 13 +++++++++++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+
+--------------1.8.3.2
+Content-Type: text/x-patch; name="0001-added-monitor-marker-to-bar.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0001-added-monitor-marker-to-bar.patch"
+
+diff --git a/config.def.h b/config.def.h
+index 875885b864986b6b2c190f9e05d979887e563f93..af6bcfae52a8d1783158ae4f38f35b88025c04e1 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -90,20 +90,22 @@ static Key keys[] = {
+ TAGKEYS( XK_9, 8)
+ { 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, 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, Button1, tag, {0} },
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
+ };
+diff --git a/dwm.c b/dwm.c
+index 1bbb4b35be25b0a10b8ffd093c55906b8aea96df..209dedc1417a29fb44c3ba5b6fa62f1b75b6a09f 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -56,21 +56,21 @@
+ #define TAGMASK ((1 << LENGTH(tags)) - 1)
+ #define TEXTW(X) (drw_font_getexts_width(drw->font, X, strlen(X)) + drw->font->h)
+
+ /* enums */
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+ enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */
+ enum { NetSupported, NetWMName, NetWMState,
+ NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
++enum { ClkTagBar, ClkLtSymbol, ClkMonNum, ClkStatusText, ClkWinTitle,
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+
+ typedef union {
+ int i;
+ unsigned int ui;
+ float f;
+ const void *v;
+ } Arg;
+
+ typedef struct {
+@@ -231,21 +231,21 @@ 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);
+
+ /* 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 = 0; /* bar geometry */
++static int bh, blw, bmw = 0; /* bar geometry */
+ static int (*xerrorxlib)(Display *, XErrorEvent *);
+ static unsigned int numlockmask = 0;
+ static void (*handler[LASTEvent]) (XEvent *) = {
+ [ButtonPress] = buttonpress,
+ [ClientMessage] = clientmessage,
+ [ConfigureRequest] = configurerequest,
+ [ConfigureNotify] = configurenotify,
+ [DestroyNotify] = destroynotify,
+ [EnterNotify] = enternotify,
+ [Expose] = expose,
+@@ -425,20 +425,22 @@ buttonpress(XEvent *e) {
+ i = x = 0;
+ do
+ x += TEXTW(tags[i]);
+ while(ev->x >= x && ++i < LENGTH(tags));
+ if(i < LENGTH(tags)) {
+ click = ClkTagBar;
+ arg.ui = 1 << i;
+ }
+ else if(ev->x < x + blw)
+ click = ClkLtSymbol;
++ else if(ev->x < x + blw + bmw)
++ click = ClkMonNum;
+ else if(ev->x > selmon->ww - TEXTW(stext))
+ click = ClkStatusText;
+ else
+ click = ClkWinTitle;
+ }
+ else if((c = wintoclient(ev->window))) {
+ focus(c);
+ click = ClkClientWin;
+ }
+ for(i = 0; i < LENGTH(buttons); i++)
+@@ -707,28 +709,35 @@ drawbar(Monitor *m) {
+ drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
+ drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+ occ & 1 << i, urg & 1 << i);
+ x += w;
+ }
+ w = blw = TEXTW(m->ltsymbol);
+ drw_setscheme(drw, &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
+ x += w;
++ char custom[4] = {0}; // needs to be +1 of actual size, for some reason
++ snprintf(custom, sizeof(custom), "<%d>", m->num);
++ w = bmw = TEXTW(custom);
++ drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
++ drw_text(drw, x, 0, w, bh, custom, 0);
++ x += w;
+ xx = x;
+ if(m == selmon) { /* status is only drawn on selected monitor */
+ w = TEXTW(stext);
+ x = m->ww - w;
+ if(x < xx) {
+ x = xx;
+ w = m->ww - xx;
+ }
++ drw_setscheme(drw, &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, stext, 0);
+ }
+ else
+ x = m->ww;
+ if((w = x - xx) > bh) {
+ x = xx;
+ if(m->sel) {
+ drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, m->sel->name, 0);
+ drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0);
+
+--------------1.8.3.2--
+
+
diff --git a/dwm.suckless.org/patches/multimon-2-added-n-view-wrappers-for-unified-multi-monitor.diff b/dwm.suckless.org/patches/multimon-2-added-n-view-wrappers-for-unified-multi-monitor.diff
@@ -0,0 +1,181 @@
+From 2521a74714bb7c4b8787f30584f1565cc582928b Mon Sep 17 00:00:00 2001
+From: "Gary B. Genett" <me@garybgenett.net>
+Date: Mon, 24 Mar 2014 13:57:47 -0700
+Subject: added n*view wrappers, for unified multi-monitor
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------1.8.3.2"
+
+This is a multi-part message in MIME format.
+--------------1.8.3.2
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+---
+ config.def.h | 5 +++++
+ dwm.c | 24 ++++++++++++++++++++++++
+ 2 files changed, 29 insertions(+)
+
+
+--------------1.8.3.2
+Content-Type: text/x-patch; name="0002-added-n-view-wrappers-for-unified-multi-monitor.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0002-added-n-view-wrappers-for-unified-multi-monitor.patch"
+
+diff --git a/config.def.h b/config.def.h
+index af6bcfae52a8d1783158ae4f38f35b88025c04e1..d3b6a4b7bbf244a9d824d99340e5fc6d9ecb8a56 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -32,24 +32,27 @@ static const int nmaster = 1; /* number of clients in master area */
+ static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
+
+ 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
+ #define TAGKEYS(KEY,TAG) \
+ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
++ { MODKEY|WINKEY, KEY, nview, {.ui = 1 << TAG} }, \
++ { MODKEY|WINKEY|ControlMask, KEY, ntoggleview, {.ui = 1 << TAG} }, \
+ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
+
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+
+ /* commands */
+ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
+ static const char *termcmd[] = { "st", NULL };
+@@ -99,14 +102,16 @@ static Button buttons[] = {
+ { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
+ { ClkMonNum, 0, Button1, focusmon, {.i = +1} },
+ { 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} },
+ { ClkTagBar, MODKEY, Button1, tag, {0} },
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
+ };
+
+diff --git a/dwm.c b/dwm.c
+index 209dedc1417a29fb44c3ba5b6fa62f1b75b6a09f..f6e9588d78a01e3263de54e94bd1559434a802c2 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -204,34 +204,36 @@ static void setmfact(const Arg *arg);
+ static void setup(void);
+ static void showhide(Client *c);
+ static void sigchld(int unused);
+ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
++static void ntoggleview(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, Bool setfocus);
+ static void unmanage(Client *c, Bool destroyed);
+ static void unmapnotify(XEvent *e);
+ static Bool updategeom(void);
+ static void updatebarpos(Monitor *m);
+ static void updatebars(void);
+ static void updateclientlist(void);
+ static void updatenumlockmask(void);
+ static void updatesizehints(Client *c);
+ static void updatestatus(void);
+ 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);
+
+ /* variables */
+ static const char broken[] = "broken";
+@@ -1663,20 +1665,31 @@ toggletag(const Arg *arg) {
+ return;
+ newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
+ if(newtags) {
+ selmon->sel->tags = newtags;
+ focus(NULL);
+ arrange(selmon);
+ }
+ }
+
+ void
++ntoggleview(const Arg *arg) {
++ const Arg n = {.i = +1};
++ const int mon = selmon->num;
++ do {
++ focusmon(&n);
++ toggleview(arg);
++ }
++ while (selmon->num != mon);
++}
++
++void
+ toggleview(const Arg *arg) {
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+
+ if(newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
+ focus(NULL);
+ arrange(selmon);
+ }
+ }
+
+@@ -1961,20 +1974,31 @@ updatewmhints(Client *c) {
+ c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
+ if(wmh->flags & InputHint)
+ c->neverfocus = !wmh->input;
+ else
+ c->neverfocus = False;
+ XFree(wmh);
+ }
+ }
+
+ void
++nview(const Arg *arg) {
++ const Arg n = {.i = +1};
++ const int mon = selmon->num;
++ do {
++ focusmon(&n);
++ view(arg);
++ }
++ while (selmon->num != mon);
++}
++
++void
+ view(const Arg *arg) {
+ if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ return;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ if(arg->ui & TAGMASK)
+ selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
+ focus(NULL);
+ arrange(selmon);
+ }
+
+
+--------------1.8.3.2--
+
+
diff --git a/dwm.suckless.org/patches/multimon-3-added-reset_view-function.diff b/dwm.suckless.org/patches/multimon-3-added-reset_view-function.diff
@@ -0,0 +1,168 @@
+From b9f79c3dd07b285e974b2dfdf2371a72467539bb Mon Sep 17 00:00:00 2001
+From: "Gary B. Genett" <me@garybgenett.net>
+Date: Mon, 24 Mar 2014 14:27:40 -0700
+Subject: added reset_view function
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------1.8.3.2"
+
+This is a multi-part message in MIME format.
+--------------1.8.3.2
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+---
+ config.def.h | 8 ++++++++
+ dwm.c | 21 +++++++++++++++++++++
+ 2 files changed, 29 insertions(+)
+
+
+--------------1.8.3.2
+Content-Type: text/x-patch; name="0003-added-reset_view-function.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0003-added-reset_view-function.patch"
+
+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;
+ }
+
+--------------1.8.3.2--
+
+
diff --git a/dwm.suckless.org/patches/multimon-4-added-statusall-toggle-replacing-need-for-patch.diff b/dwm.suckless.org/patches/multimon-4-added-statusall-toggle-replacing-need-for-patch.diff
@@ -0,0 +1,195 @@
+From d318ffdc7ab7a365e548776a1d8ed5ccbd67cd42 Mon Sep 17 00:00:00 2001
+From: "Gary B. Genett" <me@garybgenett.net>
+Date: Mon, 24 Mar 2014 14:44:04 -0700
+Subject: added statusall toggle, replacing need for patch
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------1.8.3.2"
+
+This is a multi-part message in MIME format.
+--------------1.8.3.2
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+---
+ config.def.h | 1 +
+ dwm.c | 12 ++++++------
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+
+
+--------------1.8.3.2
+Content-Type: text/x-patch; name="0004-added-statusall-toggle-replacing-need-for-patch.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0004-added-statusall-toggle-replacing-need-for-patch.patch"
+
+diff --git a/config.def.h b/config.def.h
+index 92b1a461604c81c061f60780dc189a83dd697562..b4759a569dc23754dd240da51dd12607ae93e0f3 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -24,20 +24,21 @@ static const Rule rules[] = {
+ /* 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 Bool statusall = False;/* True means status is shown in all bars, not just active monitor */
+
+ 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 */
+diff --git a/dwm.c b/dwm.c
+index 2b3bf5f99c95180cfb5a3bb04b4181481fbe7bbd..92aa91a75a39cf1ed298a2279db9974a4f456129 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -719,21 +719,21 @@ drawbar(Monitor *m) {
+ drw_setscheme(drw, &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
+ x += w;
+ char custom[4] = {0}; // needs to be +1 of actual size, for some reason
+ snprintf(custom, sizeof(custom), "<%d>", m->num);
+ w = bmw = TEXTW(custom);
+ drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, custom, 0);
+ x += w;
+ xx = x;
+- if(m == selmon) { /* status is only drawn on selected monitor */
++ if(m == selmon || statusall) { /* status is only drawn on selected monitor, unless statusall is true */
+ w = TEXTW(stext);
+ x = m->ww - w;
+ if(x < xx) {
+ x = xx;
+ w = m->ww - xx;
+ }
+ drw_setscheme(drw, &scheme[SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, stext, 0);
+ }
+ else
+@@ -779,21 +779,21 @@ enternotify(XEvent *e) {
+ return;
+ focus(c);
+ }
+
+ void
+ expose(XEvent *e) {
+ Monitor *m;
+ XExposeEvent *ev = &e->xexpose;
+
+ if(ev->count == 0 && (m = wintomon(ev->window)))
+- drawbar(m);
++ statusall ? drawbars() : drawbar(m);
+ }
+
+ void
+ focus(Client *c) {
+ if(!c || !ISVISIBLE(c))
+ for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
+ /* was if(selmon->sel) */
+ if(selmon->sel && selmon->sel != c)
+ unfocus(selmon->sel, False);
+ if(c) {
+@@ -1222,21 +1222,21 @@ propertynotify(XEvent *e) {
+ updatesizehints(c);
+ break;
+ case XA_WM_HINTS:
+ updatewmhints(c);
+ drawbars();
+ break;
+ }
+ if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
+ updatetitle(c);
+ if(c == c->mon->sel)
+- drawbar(c->mon);
++ statusall ? drawbars() : drawbar(c->mon);
+ }
+ if(ev->atom == netatom[NetWMWindowType])
+ updatewindowtype(c);
+ }
+ }
+
+ void
+ quit(const Arg *arg) {
+ running = False;
+ }
+@@ -1325,21 +1325,21 @@ resizemouse(const Arg *arg) {
+ focus(NULL);
+ }
+ }
+
+ void
+ restack(Monitor *m) {
+ Client *c;
+ XEvent ev;
+ XWindowChanges wc;
+
+- drawbar(m);
++ statusall ? drawbars() : drawbar(m);
+ if(!m->sel)
+ return;
+ if(m->sel->isfloating || !m->lt[m->sellt]->arrange)
+ XRaiseWindow(dpy, m->sel->win);
+ if(m->lt[m->sellt]->arrange) {
+ wc.stack_mode = Below;
+ wc.sibling = m->barwin;
+ for(c = m->stack; c; c = c->snext)
+ if(!c->isfloating && ISVISIBLE(c)) {
+ XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
+@@ -1475,21 +1475,21 @@ setfullscreen(Client *c, Bool fullscreen) {
+ void
+ setlayout(const Arg *arg) {
+ if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
+ selmon->sellt ^= 1;
+ if(arg && arg->v)
+ selmon->lt[selmon->sellt] = (Layout *)arg->v;
+ strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
+ if(selmon->sel)
+ arrange(selmon);
+ else
+- drawbar(selmon);
++ statusall ? drawbars() : drawbar(selmon);
+ }
+
+ /* arg > 1.0 will set mfact absolutly */
+ void
+ setmfact(const Arg *arg) {
+ float f;
+
+ if(!arg || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
+@@ -1941,21 +1941,21 @@ updatetitle(Client *c) {
+ if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
+ gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
+ if(c->name[0] == '\0') /* hack to mark broken clients */
+ strcpy(c->name, broken);
+ }
+
+ void
+ updatestatus(void) {
+ if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
+ strcpy(stext, "dwm-"VERSION);
+- drawbar(selmon);
++ statusall ? drawbars() : drawbar(selmon);
+ }
+
+ void
+ updatewindowtype(Client *c) {
+ Atom state = getatomprop(c, netatom[NetWMState]);
+ Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
+
+ if(state == netatom[NetWMFullscreen])
+ setfullscreen(c, True);
+ if(wtype == netatom[NetWMWindowTypeDialog])
+
+--------------1.8.3.2--
+
+
diff --git a/dwm.suckless.org/patches/multimon.md b/dwm.suckless.org/patches/multimon.md
@@ -0,0 +1,59 @@
+multimon
+========
+
+Last Updated: 2014-03-25
+
+Description
+-----------
+
+These patches provide enhancements for working in a multi-monitor environment.
+
+ * monitor marker
+ * Adds a small token to the bar that displays the dwm monitor number.
+ * The token has a mouse binding, just like the rest of the bar objects.
+ * unified view
+ * Provides two wrapper functions that work across all monitors simultaneously.
+ * Can change/toggle the view for all monitors, creating a unified workspace.
+ * reset view
+ * Function and settings for a "default view", for checking on primary tasks which may have been shuffled out of view doing more focused work.
+ * Per-monitor default settings for nmaster and tags.
+ * status all
+ * Show/update the status on all bars.
+ * Based on [statusbar on all monitors](http://dwm.suckless.org/patches/statusallmons), but uses a configurable boolean.
+
+Each can be applied independently, if desired, except for "reset view" which references "ClkMonNum" from "unified view" in "config.def.h". Simply remove the reference to get it to apply and compile.
+
+Example configuration settings with comments are included in "config.def.h" within each patch.
+
+The default settings and behavior of dwm are not modified by these patches. They provide enhancements and new options only, so there should be minimal conflict with other dwm patches.
+
+Usage
+-----
+
+Each patch can be applied using "patch -p1" or "git am":
+
+ cd dwm; patch -p1 <multimon-1-added-monitor-marker-to-bar.diff
+-OR-
+ cd dwm; git pull; git am multimon-1-added-monitor-marker-to-bar.diff
+
+There are default settings and bindings in "config.def.h" which you will likely want to customize.
+
+Download
+--------
+
+Each of the patches was created by "format-patch" based on commit: [cdec9782a1789bd5c3a84772fd59abb9da288597](http://git.suckless.org/dwm/commit/?id=cdec9782a1789bd5c3a84772fd59abb9da288597)
+
+ * monitor marker (6228b): [multimon-1-added-monitor-marker-to-bar.diff](multimon-1-added-monitor-marker-to-bar.diff) -[GitHub](https://github.com/garybgenett/.dwm/commit/143e7f2f3caa047469c7219cd6b0cb704466683f)-
+ * unified view (6558b): [multimon-2-added-n-view-wrappers-for-unified-multi-monitor.diff](multimon-2-added-n-view-wrappers-for-unified-multi-monitor.diff) -[GitHub](https://github.com/garybgenett/.dwm/commit/2521a74714bb7c4b8787f30584f1565cc582928b)-
+ * reset view (6816b): [multimon-3-added-reset_view-function.diff](multimon-3-added-reset_view-function.diff) -[GitHub](https://github.com/garybgenett/.dwm/commit/b9f79c3dd07b285e974b2dfdf2371a72467539bb)-
+ * status all (6165b): [multimon-4-added-statusall-toggle-replacing-need-for-patch.diff](multimon-4-added-statusall-toggle-replacing-need-for-patch.diff) -[GitHub](https://github.com/garybgenett/.dwm/commit/d318ffdc7ab7a365e548776a1d8ed5ccbd67cd42)-
+
+The patches are intended to be applied in order, one after the other, but can also be used independently.
+
+Author
+------
+
+ * Gary B. Genett - <me at garybgenett dot net>
+
+---
+Original Submission: [http://lists.suckless.org/dev/1403/20488.html](http://lists.suckless.org/dev/1403/20488.html)