dwm-windowfollow-6.3.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-windowfollow-6.3.diff (5187B) | |
--- | |
1 diff '--color=auto' -up dwm-6.3/config.def.h windowfollow-impl-6-3/confi… | |
2 --- dwm-6.3/config.def.h 2022-01-07 11:42:18.000000000 +0000 | |
3 +++ windowfollow-impl-6-3/config.def.h 2022-10-02 18:32:22.244267… | |
4 @@ -31,6 +31,11 @@ static const Rule rules[] = { | |
5 { "Firefox", NULL, NULL, 1 << 8, 0, … | |
6 }; | |
7 | |
8 +/* window following */ | |
9 +#define WFACTIVE '>' | |
10 +#define WFINACTIVE 'v' | |
11 +#define WFDEFAULT WFINACTIVE | |
12 + | |
13 /* layout(s) */ | |
14 static const float mfact = 0.55; /* factor of master area size [0.0… | |
15 static const int nmaster = 1; /* number of clients in master are… | |
16 @@ -65,6 +70,7 @@ static Key keys[] = { | |
17 { MODKEY, XK_p, spawn, {.v … | |
18 { MODKEY|ShiftMask, XK_Return, spawn, {.v … | |
19 { MODKEY, XK_b, togglebar, {0} … | |
20 + { MODKEY, XK_n, togglefollow, {0} … | |
21 { MODKEY, XK_j, focusstack, {.i … | |
22 { MODKEY, XK_k, focusstack, {.i … | |
23 { MODKEY, XK_i, incnmaster, {.i … | |
24 @@ -103,6 +109,7 @@ static Button buttons[] = { | |
25 /* click event mask button functio… | |
26 { ClkLtSymbol, 0, Button1, setlayo… | |
27 { ClkLtSymbol, 0, Button3, setlayo… | |
28 + { ClkFollowSymbol, 0, Button1, togglef… | |
29 { ClkWinTitle, 0, Button2, zoom, … | |
30 { ClkStatusText, 0, Button2, spawn, … | |
31 { ClkClientWin, MODKEY, Button1, movemou… | |
32 diff '--color=auto' -up dwm-6.3/dwm.1 windowfollow-impl-6-3/dwm.1 | |
33 --- dwm-6.3/dwm.1 2022-01-07 11:42:18.000000000 +0000 | |
34 +++ windowfollow-impl-6-3/dwm.1 2022-10-02 18:32:22.244267491 +01… | |
35 @@ -44,7 +44,8 @@ command. | |
36 .TP | |
37 .B Button1 | |
38 click on a tag label to display all windows with that tag, click on the… | |
39 -label toggles between tiled and floating layout. | |
40 +label toggles between tiled and floating layout, click on the window fo… | |
41 +icon toggles it on and off. | |
42 .TP | |
43 .B Button3 | |
44 click on a tag label adds/removes all windows with that tag to/from the… | |
45 @@ -80,6 +81,9 @@ Send focused window to next screen, if a | |
46 .B Mod1\-b | |
47 Toggles bar on and off. | |
48 .TP | |
49 +.B Mod1\-n | |
50 +Toggles window following on and off. | |
51 +.TP | |
52 .B Mod1\-t | |
53 Sets tiled layout. | |
54 .TP | |
55 diff '--color=auto' -up dwm-6.3/dwm.c windowfollow-impl-6-3/dwm.c | |
56 --- dwm-6.3/dwm.c 2022-01-07 11:42:18.000000000 +0000 | |
57 +++ windowfollow-impl-6-3/dwm.c 2022-10-02 18:32:22.244267491 +01… | |
58 @@ -65,7 +65,7 @@ enum { NetSupported, NetWMName, NetWMSta | |
59 NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ | |
60 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* defaul… | |
61 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, | |
62 - ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ | |
63 + ClkClientWin, ClkRootWin, ClkFollowSymbol, ClkLast }; /* clicks … | |
64 | |
65 typedef union { | |
66 int i; | |
67 @@ -113,6 +113,7 @@ typedef struct { | |
68 | |
69 struct Monitor { | |
70 char ltsymbol[16]; | |
71 + char wfsymbol[2]; | |
72 float mfact; | |
73 int nmaster; | |
74 int num; | |
75 @@ -212,6 +213,7 @@ static void tagmon(const Arg *arg); | |
76 static void tile(Monitor *); | |
77 static void togglebar(const Arg *arg); | |
78 static void togglefloating(const Arg *arg); | |
79 +static void togglefollow(const Arg *arg); | |
80 static void toggletag(const Arg *arg); | |
81 static void toggleview(const Arg *arg); | |
82 static void unfocus(Client *c, int setfocus); | |
83 @@ -440,6 +442,8 @@ buttonpress(XEvent *e) | |
84 arg.ui = 1 << i; | |
85 } else if (ev->x < x + blw) | |
86 click = ClkLtSymbol; | |
87 + else if (ev->x < x + blw + TEXTW(selmon->wfsymbol)) | |
88 + click = ClkFollowSymbol; | |
89 else if (ev->x > selmon->ww - (int)TEXTW(stext)) | |
90 click = ClkStatusText; | |
91 else | |
92 @@ -642,6 +646,8 @@ createmon(void) | |
93 m->lt[0] = &layouts[0]; | |
94 m->lt[1] = &layouts[1 % LENGTH(layouts)]; | |
95 strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); | |
96 + m->wfsymbol[0] = WFDEFAULT; | |
97 + m->wfsymbol[1] = '\0'; | |
98 return m; | |
99 } | |
100 | |
101 @@ -732,6 +738,9 @@ drawbar(Monitor *m) | |
102 drw_setscheme(drw, scheme[SchemeNorm]); | |
103 x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); | |
104 | |
105 + w = TEXTW(m->wfsymbol); | |
106 + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->wfsymbol, 0); | |
107 + | |
108 if ((w = m->ww - tw - x) > bh) { | |
109 if (m->sel) { | |
110 drw_setscheme(drw, scheme[m == selmon ? SchemeS… | |
111 @@ -1664,6 +1673,8 @@ tag(const Arg *arg) | |
112 focus(NULL); | |
113 arrange(selmon); | |
114 } | |
115 + if (selmon->wfsymbol[0] == WFACTIVE) | |
116 + view(arg); | |
117 } | |
118 | |
119 void | |
120 @@ -1672,6 +1683,8 @@ tagmon(const Arg *arg) | |
121 if (!selmon->sel || !mons->next) | |
122 return; | |
123 sendmon(selmon->sel, dirtomon(arg->i)); | |
124 + if (selmon->wfsymbol[0] == WFACTIVE) | |
125 + focusmon(arg); | |
126 } | |
127 | |
128 void | |
129 @@ -1712,6 +1725,13 @@ togglebar(const Arg *arg) | |
130 } | |
131 | |
132 void | |
133 +togglefollow(const Arg *arg) | |
134 +{ | |
135 + selmon->wfsymbol[0] = (selmon->wfsymbol[0] == WFACTIVE) ? WFINA… | |
136 + drawbars(); | |
137 +} | |
138 + | |
139 +void | |
140 togglefloating(const Arg *arg) | |
141 { | |
142 if (!selmon->sel) |