dwm-multimon-2-unified_view-6.4.patch (6582B)
1 From 96ebf3ddfad143aec93a7d2aa212389121ccae41 Mon Sep 17 00:00:00 2001 2 From: "Gary B. Genett" <me@garybgenett.net> 3 Date: Sun, 19 Feb 2023 08:57:30 -0800 4 Subject: added n*view wrappers, for unified multi-monitor 5 MIME-Version: 1.0 6 Content-Type: multipart/mixed; boundary="------------2.37.4" 7 8 This is a multi-part message in MIME format. 9 --------------2.37.4 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 | 26 ++++++++++++++++++++++++++ 16 2 files changed, 31 insertions(+) 17 18 19 --------------2.37.4 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 9d549ce8628e1a7769ee2a3d5c0a4c6d56ce6931..c59d27597a62ddf884baacded2830a318db1b45c 100644 26 --- a/config.def.h 27 +++ b/config.def.h 28 @@ -38,24 +38,27 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi 29 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ 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", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 55 static const char *termcmd[] = { "st", NULL }; 56 @@ -105,14 +108,16 @@ static const 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 bc5160a7d46ab07da82f0595abb7700debb2b891..2cf8d78c22c64ff26eda6195b6bd503f213a4d5f 100644 75 --- a/dwm.c 76 +++ b/dwm.c 77 @@ -206,34 +206,36 @@ static void setmfact(const Arg *arg); 78 static void setup(void); 79 static void seturgent(Client *c, int urg); 80 static void showhide(Client *c); 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 *m); 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, int setfocus); 91 static void unmanage(Client *c, int destroyed); 92 static void unmapnotify(XEvent *e); 93 static void updatebarpos(Monitor *m); 94 static void updatebars(void); 95 static void updateclientlist(void); 96 static int updategeom(void); 97 static void updatenumlockmask(void); 98 static void updatesizehints(Client *c); 99 static void updatestatus(void); 100 static void updatetitle(Client *c); 101 static void updatewindowtype(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 @@ -1743,20 +1745,32 @@ toggletag(const Arg *arg) 115 if (!selmon->sel) 116 return; 117 newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); 118 if (newtags) { 119 selmon->sel->tags = newtags; 120 focus(NULL); 121 arrange(selmon); 122 } 123 } 124 125 +void 126 +ntoggleview(const Arg *arg) 127 +{ 128 + const Arg n = {.i = +1}; 129 + const int mon = selmon->num; 130 + do { 131 + focusmon(&n); 132 + toggleview(arg); 133 + } 134 + while (selmon->num != mon); 135 +} 136 + 137 void 138 toggleview(const Arg *arg) 139 { 140 unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); 141 142 if (newtagset) { 143 selmon->tagset[selmon->seltags] = newtagset; 144 focus(NULL); 145 arrange(selmon); 146 } 147 @@ -2045,20 +2059,32 @@ updatewmhints(Client *c) 148 } else 149 c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0; 150 if (wmh->flags & InputHint) 151 c->neverfocus = !wmh->input; 152 else 153 c->neverfocus = 0; 154 XFree(wmh); 155 } 156 } 157 158 +void 159 +nview(const Arg *arg) 160 +{ 161 + const Arg n = {.i = +1}; 162 + const int mon = selmon->num; 163 + do { 164 + focusmon(&n); 165 + view(arg); 166 + } 167 + while (selmon->num != mon); 168 +} 169 + 170 void 171 view(const Arg *arg) 172 { 173 if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) 174 return; 175 selmon->seltags ^= 1; /* toggle sel tagset */ 176 if (arg->ui & TAGMASK) 177 selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; 178 focus(NULL); 179 arrange(selmon); 180 181 --------------2.37.4-- 182 183