Skip to content

Commit b16fabd

Browse files
author
Sokolov Innokenty
committed
upload monitor-marker patch (already applied)
1 parent 1e6fa57 commit b16fabd

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

patches/dwm-6.4-monitor-marker.diff

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
commit 1e6fa5737753f4a62b8ef29096b033265d3626ac
2+
Author: Sokolov Innokenty <[email protected]>
3+
Date: Sun Jun 4 19:44:56 2023 +0800
4+
5+
patch monitor-marker
6+
7+
diff --git a/config.def.h b/config.def.h
8+
index fb0337b..e118513 100644
9+
--- a/config.def.h
10+
+++ b/config.def.h
11+
@@ -193,6 +193,8 @@ static const Button buttons[] = {
12+
/* click event mask button function argument */
13+
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
14+
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
15+
+ { ClkMonNum, 0, Button1, focusmon, {.i = +1} },
16+
+ { ClkMonNum, 0, Button3, focusmon, {.i = -1} },
17+
{ ClkWinTitle, 0, Button2, zoom, {0} },
18+
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
19+
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
20+
diff --git a/dwm.c b/dwm.c
21+
index a6ac2e5..d0e9704 100644
22+
--- a/dwm.c
23+
+++ b/dwm.c
24+
@@ -79,7 +79,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
25+
NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */
26+
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
27+
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
28+
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
29+
+enum { ClkTagBar, ClkLtSymbol, ClkMonNum, ClkStatusText, ClkWinTitle,
30+
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
31+
32+
typedef union {
33+
@@ -128,6 +128,7 @@ typedef struct {
34+
35+
struct Monitor {
36+
char ltsymbol[16];
37+
+ char monmark[16];
38+
float mfact;
39+
int nmaster;
40+
int num;
41+
@@ -480,6 +481,8 @@ buttonpress(XEvent *e)
42+
arg.ui = 1 << i;
43+
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
44+
click = ClkLtSymbol;
45+
+ else if (ev->x < x + TEXTW(selmon->ltsymbol) + TEXTW(selmon->monmark))
46+
+ click = ClkMonNum;
47+
else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
48+
click = ClkStatusText;
49+
else
50+
@@ -739,6 +742,8 @@ createmon(void)
51+
m->lt[0] = &layouts[0];
52+
m->lt[1] = &layouts[1 % LENGTH(layouts)];
53+
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
54+
+ /* this is actually set in updategeom, to avoid a race condition */
55+
+// snprintf(m->monmark, sizeof(m->monmark), "(%d)", m->num);
56+
return m;
57+
}
58+
59+
@@ -792,6 +797,7 @@ dirtomon(int dir)
60+
for (m = mons; m->next; m = m->next);
61+
else
62+
for (m = mons; m->next != selmon; m = m->next);
63+
+
64+
return m;
65+
}
66+
67+
@@ -944,6 +950,9 @@ drawbar(Monitor *m)
68+
w = TEXTW(m->ltsymbol);
69+
drw_setscheme(drw, scheme[SchemeNorm]);
70+
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
71+
+ w = TEXTW(m->monmark);
72+
+ drw_setscheme(drw, scheme[SchemeNorm]);
73+
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->monmark, 0);
74+
75+
if ((w = m->ww - tw - stw - x) > bh) {
76+
if (m->sel) {
77+
@@ -2274,6 +2283,8 @@ updategeom(void)
78+
{
79+
dirty = 1;
80+
m->num = i;
81+
+ /* this is ugly, but it is a race condition otherwise */
82+
+ snprintf(m->monmark, sizeof(m->monmark), "{%d}", m->num);
83+
m->mx = m->wx = unique[i].x_org;
84+
m->my = m->wy = unique[i].y_org;
85+
m->mw = m->ww = unique[i].width;

0 commit comments

Comments
 (0)