multimon-2-added-n-view-wrappers-for-unified-multi-monitor.diff (6558B)
1 From 2521a74714bb7c4b8787f30584f1565cc582928b Mon Sep 17 00:00:00 2001 2 From: "Gary B. Genett" <me@garybgenett.net> 3 Date: Mon, 24 Mar 2014 13:57:47 -0700 4 Subject: added n*view wrappers, for unified multi-monitor 5 MIME-Version: 1.0 6 Content-Type: multipart/mixed; boundary="------------1.8.3.2" 7 8 This is a multi-part message in MIME format. 9 --------------1.8.3.2 10 Content-Type: text/plain; charset=UTF-8; format=fixed 11 Content-Transfer-Encoding: 8bit 12 13 --- 14 config.def.h | 5 +++++ 15 dwm.c | 24 ++++++++++++++++++++++++ 16 2 files changed, 29 insertions(+) 17 18 19 --------------1.8.3.2 20 Content-Type: text/x-patch; name="0002-added-n-view-wrappers-for-unified-multi-monitor.patch" 21 Content-Transfer-Encoding: 8bit 22 Content-Disposition: attachment; filename="0002-added-n-view-wrappers-for-unified-multi-monitor.patch" 23 24 diff --git a/config.def.h b/config.def.h 25 index af6bcfae52a8d1783158ae4f38f35b88025c04e1..d3b6a4b7bbf244a9d824d99340e5fc6d9ecb8a56 100644 26 --- a/config.def.h 27 +++ b/config.def.h 28 @@ -32,24 +32,27 @@ static const int nmaster = 1; /* number of clients in master area */ 29 static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ 30 31 static const Layout layouts[] = { 32 /* symbol arrange function */ 33 { "[]=", tile }, /* first entry is default */ 34 { "><>", NULL }, /* no layout function means floating behavior */ 35 { "[M]", monocle }, 36 }; 37 38 /* key definitions */ 39 +#define WINKEY Mod4Mask 40 #define MODKEY Mod1Mask 41 #define TAGKEYS(KEY,TAG) \ 42 { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ 43 { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ 44 + { MODKEY|WINKEY, KEY, nview, {.ui = 1 << TAG} }, \ 45 + { MODKEY|WINKEY|ControlMask, KEY, ntoggleview, {.ui = 1 << TAG} }, \ 46 { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ 47 { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, 48 49 /* helper for spawning shell commands in the pre dwm-5.0 fashion */ 50 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } 51 52 /* commands */ 53 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 54 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; 55 static const char *termcmd[] = { "st", NULL }; 56 @@ -99,14 +102,16 @@ static Button buttons[] = { 57 { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, 58 { ClkMonNum, 0, Button1, focusmon, {.i = +1} }, 59 { ClkMonNum, 0, Button3, focusmon, {.i = -1} }, 60 { ClkWinTitle, 0, Button2, zoom, {0} }, 61 { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, 62 { ClkClientWin, MODKEY, Button1, movemouse, {0} }, 63 { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, 64 { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, 65 { ClkTagBar, 0, Button1, view, {0} }, 66 { ClkTagBar, 0, Button3, toggleview, {0} }, 67 + { ClkTagBar, MODKEY|WINKEY, Button1, nview, {0} }, 68 + { ClkTagBar, MODKEY|WINKEY, Button3, ntoggleview, {0} }, 69 { ClkTagBar, MODKEY, Button1, tag, {0} }, 70 { ClkTagBar, MODKEY, Button3, toggletag, {0} }, 71 }; 72 73 diff --git a/dwm.c b/dwm.c 74 index 209dedc1417a29fb44c3ba5b6fa62f1b75b6a09f..f6e9588d78a01e3263de54e94bd1559434a802c2 100644 75 --- a/dwm.c 76 +++ b/dwm.c 77 @@ -204,34 +204,36 @@ static void setmfact(const Arg *arg); 78 static void setup(void); 79 static void showhide(Client *c); 80 static void sigchld(int unused); 81 static void spawn(const Arg *arg); 82 static void tag(const Arg *arg); 83 static void tagmon(const Arg *arg); 84 static void tile(Monitor *); 85 static void togglebar(const Arg *arg); 86 static void togglefloating(const Arg *arg); 87 static void toggletag(const Arg *arg); 88 +static void ntoggleview(const Arg *arg); 89 static void toggleview(const Arg *arg); 90 static void unfocus(Client *c, Bool setfocus); 91 static void unmanage(Client *c, Bool destroyed); 92 static void unmapnotify(XEvent *e); 93 static Bool updategeom(void); 94 static void updatebarpos(Monitor *m); 95 static void updatebars(void); 96 static void updateclientlist(void); 97 static void updatenumlockmask(void); 98 static void updatesizehints(Client *c); 99 static void updatestatus(void); 100 static void updatewindowtype(Client *c); 101 static void updatetitle(Client *c); 102 static void updatewmhints(Client *c); 103 +static void nview(const Arg *arg); 104 static void view(const Arg *arg); 105 static Client *wintoclient(Window w); 106 static Monitor *wintomon(Window w); 107 static int xerror(Display *dpy, XErrorEvent *ee); 108 static int xerrordummy(Display *dpy, XErrorEvent *ee); 109 static int xerrorstart(Display *dpy, XErrorEvent *ee); 110 static void zoom(const Arg *arg); 111 112 /* variables */ 113 static const char broken[] = "broken"; 114 @@ -1663,20 +1665,31 @@ toggletag(const Arg *arg) { 115 return; 116 newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); 117 if(newtags) { 118 selmon->sel->tags = newtags; 119 focus(NULL); 120 arrange(selmon); 121 } 122 } 123 124 void 125 +ntoggleview(const Arg *arg) { 126 + const Arg n = {.i = +1}; 127 + const int mon = selmon->num; 128 + do { 129 + focusmon(&n); 130 + toggleview(arg); 131 + } 132 + while (selmon->num != mon); 133 +} 134 + 135 +void 136 toggleview(const Arg *arg) { 137 unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); 138 139 if(newtagset) { 140 selmon->tagset[selmon->seltags] = newtagset; 141 focus(NULL); 142 arrange(selmon); 143 } 144 } 145 146 @@ -1961,20 +1974,31 @@ updatewmhints(Client *c) { 147 c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; 148 if(wmh->flags & InputHint) 149 c->neverfocus = !wmh->input; 150 else 151 c->neverfocus = False; 152 XFree(wmh); 153 } 154 } 155 156 void 157 +nview(const Arg *arg) { 158 + const Arg n = {.i = +1}; 159 + const int mon = selmon->num; 160 + do { 161 + focusmon(&n); 162 + view(arg); 163 + } 164 + while (selmon->num != mon); 165 +} 166 + 167 +void 168 view(const Arg *arg) { 169 if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) 170 return; 171 selmon->seltags ^= 1; /* toggle sel tagset */ 172 if(arg->ui & TAGMASK) 173 selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; 174 focus(NULL); 175 arrange(selmon); 176 } 177 178 179 --------------1.8.3.2-- 180 181