From 2521a74714bb7c4b8787f30584f1565cc582928b Mon Sep 17 00:00:00 2001 From: "Gary B. Genett" 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--