Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-multimon-3-reset_view-6.4.patch - sites - public wiki contents of suckless.…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-multimon-3-reset_view-6.4.patch (7758B)
---
1 From a69526cdfa0f3c15ac60e290cbd1282cd02a59c5 Mon Sep 17 00:00:00 2001
2 From: "Gary B. Genett" <[email protected]>
3 Date: Sun, 19 Feb 2023 08:58:02 -0800
4 Subject: added reset_view function
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 | 9 +++++++++
15 dwm.c | 30 ++++++++++++++++++++++++++++++
16 2 files changed, 39 insertions(+)
17
18
19 --------------2.37.4
20 Content-Type: text/x-patch; name="0003-added-reset_view-function.patch"
21 Content-Transfer-Encoding: 8bit
22 Content-Disposition: attachment; filename="0003-added-reset_view-functio…
23
24 diff --git a/config.def.h b/config.def.h
25 index c59d27597a62ddf884baacded2830a318db1b45c..a664c793845c4c7c0ebe8ac6…
26 --- a/config.def.h
27 +++ b/config.def.h
28 @@ -27,23 +27,31 @@ static const Rule rules[] = {
29 * WM_NAME(STRING) = title
30 */
31 /* class instance title tags mask isfloating …
32 { "Gimp", NULL, NULL, 0, 1, …
33 { "Firefox", NULL, NULL, 1 << 8, 0, …
34 };
35
36 /* layout(s) */
37 static const float mfact = 0.55; /* factor of master area size [0.0…
38 static const int nmaster = 1; /* number of clients in master are…
39 +static const int nviews = 3; /* mask of tags highlighted by def…
40 static const int resizehints = 1; /* 1 means respect size hints in t…
41 static const int lockfullscreen = 1; /* 1 will force focus on the fulls…
42
43 +static const float facts[1]; //static const float facts[] = { …
44 +static const int masters[1]; //static const int masters[] = { …
45 +static const int views[1]; //static const int views[] = { …
46 +/* invert tags after nviews */ /* array dimentions can both be as big …
47 +static const int toggles[1][1]; //static const int toggles[2][2] = { {0…
48 +static const int toggles[1][1] = {{~0}};
49 +
50 static const Layout layouts[] = {
51 /* symbol arrange function */
52 { "[]=", tile }, /* first entry is default */
53 { "><>", NULL }, /* no layout function means floating b…
54 { "[M]", monocle },
55 };
56
57 /* key definitions */
58 #define WINKEY Mod4Mask
59 #define MODKEY Mod1Mask
60 @@ -90,30 +97,32 @@ static const Key keys[] = {
61 { MODKEY|ShiftMask, XK_period, tagmon, {.i …
62 TAGKEYS( XK_1, 0)
63 TAGKEYS( XK_2, 1)
64 TAGKEYS( XK_3, 2)
65 TAGKEYS( XK_4, 3)
66 TAGKEYS( XK_5, 4)
67 TAGKEYS( XK_6, 5)
68 TAGKEYS( XK_7, 6)
69 TAGKEYS( XK_8, 7)
70 TAGKEYS( XK_9, 8)
71 + { MODKEY, XK_grave, reset_view, {0} …
72 { MODKEY|ShiftMask, XK_q, quit, {0} …
73 };
74
75 /* button definitions */
76 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, Clk…
77 static const Button buttons[] = {
78 /* click event mask button functio…
79 { ClkLtSymbol, 0, Button1, setlayo…
80 { ClkLtSymbol, 0, Button3, setlayo…
81 { ClkMonNum, 0, Button1, focusmo…
82 + { ClkMonNum, 0, Button2, reset_v…
83 { ClkMonNum, 0, Button3, focusmo…
84 { ClkWinTitle, 0, Button2, zoom, …
85 { ClkStatusText, 0, Button2, spawn, …
86 { ClkClientWin, MODKEY, Button1, movemou…
87 { ClkClientWin, MODKEY, Button2, togglef…
88 { ClkClientWin, MODKEY, Button3, resizem…
89 { ClkTagBar, 0, Button1, view, …
90 { ClkTagBar, 0, Button3, togglev…
91 { ClkTagBar, MODKEY|WINKEY, Button1, nview, …
92 { ClkTagBar, MODKEY|WINKEY, Button3, ntoggle…
93 diff --git a/dwm.c b/dwm.c
94 index 2cf8d78c22c64ff26eda6195b6bd503f213a4d5f..93da0f4565d7a17ef96a1b16…
95 --- a/dwm.c
96 +++ b/dwm.c
97 @@ -229,20 +229,21 @@ static void updatetitle(Client *c);
98 static void updatewindowtype(Client *c);
99 static void updatewmhints(Client *c);
100 static void nview(const Arg *arg);
101 static void view(const Arg *arg);
102 static Client *wintoclient(Window w);
103 static Monitor *wintomon(Window w);
104 static int xerror(Display *dpy, XErrorEvent *ee);
105 static int xerrordummy(Display *dpy, XErrorEvent *ee);
106 static int xerrorstart(Display *dpy, XErrorEvent *ee);
107 static void zoom(const Arg *arg);
108 +static void reset_view(const Arg *arg);
109
110 /* variables */
111 static const char broken[] = "broken";
112 static char stext[256];
113 static int screen;
114 static int sw, sh; /* X display screen geometry width, height…
115 static int bh; /* bar height */
116 static int lrpad; /* sum of left and right padding for text …
117 static int (*xerrorxlib)(Display *, XErrorEvent *);
118 static unsigned int numlockmask = 0;
119 @@ -2161,33 +2162,62 @@ zoom(const Arg *arg)
120 {
121 Client *c = selmon->sel;
122
123 if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating)
124 return;
125 if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)…
126 return;
127 pop(c);
128 }
129
130 +void
131 +reset_view(const Arg *arg) {
132 + const int mon = selmon->num;
133 + Arg n = {.i = +1}; // focusmon(next monitor)
134 + Arg m = {.f = 0}; // mfact -> facts[]
135 + Arg i = {.i = 0}; // nmaster -> masters[]
136 + Arg v = {.ui = 0}; // nviews -> views[]
137 + Arg t = {.ui = 0}; // toggles[] -> toggleview()
138 + unsigned int x;
139 + do {
140 + focusmon(&n);
141 + m.f = (facts[selmon->num] ? facts[selmon->num] : mfact)…
142 + i.i = (masters[selmon->num] ? masters[selmon->num] : nm…
143 + v.ui = (views[selmon->num] == ~0 ? ~0 : ((1 << (views[s…
144 + setmfact(&m);
145 + incnmaster(&i);
146 + view(&v);
147 + for (x = 0; x < LENGTH(toggles[selmon->num]); x++) {
148 + if ((toggles[selmon->num][x] || toggles[selmon-…
149 + t.ui = (1 << toggles[selmon->num][x]);
150 + toggleview(&t);
151 + };
152 + }
153 + }
154 + while (selmon->num != mon);
155 +}
156 +
157 int
158 main(int argc, char *argv[])
159 {
160 if (argc == 2 && !strcmp("-v", argv[1]))
161 die("dwm-"VERSION);
162 else if (argc != 1)
163 die("usage: dwm [-v]");
164 if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
165 fputs("warning: no locale support\n", stderr);
166 if (!(dpy = XOpenDisplay(NULL)))
167 die("dwm: cannot open display");
168 checkotherwm();
169 setup();
170 #ifdef __OpenBSD__
171 if (pledge("stdio rpath proc exec", NULL) == -1)
172 die("pledge");
173 #endif /* __OpenBSD__ */
174 scan();
175 + const Arg r = {0};
176 + reset_view(&r);
177 run();
178 cleanup();
179 XCloseDisplay(dpy);
180 return EXIT_SUCCESS;
181 }
182
183 --------------2.37.4--
184
185
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.