author | Anselm R.Garbe <arg@10ksloc.org> |
Mon, 14 Aug 2006 15:11:02 +0200 | |
changeset 275 | 425cd4490c1e |
parent 272 | be40a56df248 |
child 276 | 9a0a351dd910 |
permissions | -rw-r--r-- |
75 | 1 |
/* |
2 |
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
3 |
* See LICENSE file for license details. |
|
4 |
*/ |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
5 |
#include "dwm.h" |
114 | 6 |
#include <regex.h> |
7 |
#include <stdio.h> |
|
191 | 8 |
#include <stdlib.h> |
75 | 9 |
#include <string.h> |
114 | 10 |
#include <sys/types.h> |
75 | 11 |
#include <X11/Xutil.h> |
12 |
||
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
13 |
|
114 | 14 |
typedef struct { |
191 | 15 |
const char *clpattern; |
16 |
const char *tpattern; |
|
114 | 17 |
Bool isfloat; |
18 |
} Rule; |
|
19 |
||
191 | 20 |
typedef struct { |
21 |
regex_t *clregex; |
|
22 |
regex_t *tregex; |
|
23 |
} RReg; |
|
24 |
||
25 |
/* static */ |
|
26 |
||
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
144
diff
changeset
|
27 |
TAGS |
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
144
diff
changeset
|
28 |
RULES |
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
80
diff
changeset
|
29 |
|
191 | 30 |
static RReg *rreg = NULL; |
31 |
static unsigned int len = 0; |
|
32 |
||
156 | 33 |
void (*arrange)(Arg *) = DEFMODE; |
125 | 34 |
|
35 |
/* extern */ |
|
36 |
||
75 | 37 |
void |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
38 |
appendtag(Arg *arg) |
75 | 39 |
{ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
40 |
if(!sel) |
75 | 41 |
return; |
42 |
||
173
1db04019684e
changed Client->tags and Rule->tags to be Bool (I'll also try to remove the TLast enum)
arg@10ksloc.org
parents:
164
diff
changeset
|
43 |
sel->tags[arg->i] = True; |
75 | 44 |
arrange(NULL); |
45 |
} |
|
46 |
||
47 |
void |
|
48 |
dofloat(Arg *arg) |
|
49 |
{ |
|
50 |
Client *c; |
|
51 |
||
52 |
for(c = clients; c; c = c->next) { |
|
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
53 |
c->ismax = False; |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
54 |
if(isvisible(c)) { |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
97
diff
changeset
|
55 |
resize(c, True, TopLeft); |
95
5d88952cbf96
implemened distinguishing float/managed geometries of clients (works quite well)
Anselm R. Garbe <garbeam@wmii.de>
parents:
94
diff
changeset
|
56 |
} |
75 | 57 |
else |
58 |
ban(c); |
|
59 |
} |
|
194 | 60 |
if((sel = getnext(clients))) { |
61 |
focus(sel); |
|
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
62 |
restack(); |
75 | 63 |
} |
194 | 64 |
else |
65 |
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
|
75 | 66 |
} |
67 |
||
68 |
void |
|
69 |
dotile(Arg *arg) |
|
70 |
{ |
|
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
71 |
int h, i, n, w; |
75 | 72 |
Client *c; |
73 |
||
74 |
w = sw - mw; |
|
75 |
for(n = 0, c = clients; c; c = c->next) |
|
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
76 |
if(isvisible(c) && !c->isfloat) |
75 | 77 |
n++; |
78 |
||
79 |
if(n > 1) |
|
80 |
h = (sh - bh) / (n - 1); |
|
81 |
else |
|
82 |
h = sh - bh; |
|
83 |
||
84 |
for(i = 0, c = clients; c; c = c->next) { |
|
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
85 |
c->ismax = False; |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
86 |
if(isvisible(c)) { |
80
8125f908c80c
several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents:
76
diff
changeset
|
87 |
if(c->isfloat) { |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
97
diff
changeset
|
88 |
resize(c, True, TopLeft); |
75 | 89 |
continue; |
90 |
} |
|
91 |
if(n == 1) { |
|
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
92 |
c->x = sx; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
93 |
c->y = sy + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
94 |
c->w = sw - 2; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
95 |
c->h = sh - 2 - bh; |
75 | 96 |
} |
97 |
else if(i == 0) { |
|
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
98 |
c->x = sx; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
99 |
c->y = sy + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
100 |
c->w = mw - 2; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
101 |
c->h = sh - 2 - bh; |
75 | 102 |
} |
104
3a708f113f55
implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents:
99
diff
changeset
|
103 |
else if(h > bh) { |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
104 |
c->x = sx + mw; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
105 |
c->y = sy + (i - 1) * h + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
106 |
c->w = w - 2; |
240
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
107 |
if(i + 1 == n) |
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
108 |
c->h = sh - c->y - 2; |
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
109 |
else |
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
110 |
c->h = h - 2; |
75 | 111 |
} |
104
3a708f113f55
implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents:
99
diff
changeset
|
112 |
else { /* fallback if h < bh */ |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
113 |
c->x = sx + mw; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
114 |
c->y = sy + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
115 |
c->w = w - 2; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
116 |
c->h = sh - 2 - bh; |
104
3a708f113f55
implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents:
99
diff
changeset
|
117 |
} |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
97
diff
changeset
|
118 |
resize(c, False, TopLeft); |
75 | 119 |
i++; |
120 |
} |
|
121 |
else |
|
122 |
ban(c); |
|
123 |
} |
|
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
124 |
if((sel = getnext(clients))) |
194 | 125 |
focus(sel); |
126 |
else |
|
127 |
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
|
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
128 |
restack(); |
75 | 129 |
} |
130 |
||
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
131 |
Client * |
142
9b9deafa0508
committed a patch which fixes the hints of Jukka
arg@10ksloc.org
parents:
138
diff
changeset
|
132 |
getnext(Client *c) |
93
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
133 |
{ |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
134 |
for(; c && !isvisible(c); c = c->next); |
93
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
135 |
return c; |
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
136 |
} |
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
137 |
|
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
138 |
Client * |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
139 |
getprev(Client *c) |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
140 |
{ |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
141 |
for(; c && !isvisible(c); c = c->prev); |
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
142 |
return c; |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
143 |
} |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
144 |
|
93
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
145 |
void |
191 | 146 |
initrregs() |
147 |
{ |
|
148 |
unsigned int i; |
|
149 |
regex_t *reg; |
|
150 |
||
151 |
if(rreg) |
|
152 |
return; |
|
153 |
len = sizeof(rule) / sizeof(rule[0]); |
|
154 |
rreg = emallocz(len * sizeof(RReg)); |
|
155 |
||
156 |
for(i = 0; i < len; i++) { |
|
157 |
if(rule[i].clpattern) { |
|
158 |
reg = emallocz(sizeof(regex_t)); |
|
159 |
if(regcomp(reg, rule[i].clpattern, 0)) |
|
160 |
free(reg); |
|
161 |
else |
|
162 |
rreg[i].clregex = reg; |
|
163 |
} |
|
164 |
if(rule[i].tpattern) { |
|
165 |
reg = emallocz(sizeof(regex_t)); |
|
166 |
if(regcomp(reg, rule[i].tpattern, 0)) |
|
167 |
free(reg); |
|
168 |
else |
|
169 |
rreg[i].tregex = reg; |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
||
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
174 |
Bool |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
175 |
isvisible(Client *c) |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
176 |
{ |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
177 |
unsigned int i; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
178 |
|
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
179 |
for(i = 0; i < ntags; i++) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
180 |
if(c->tags[i] && seltag[i]) |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
181 |
return True; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
182 |
return False; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
183 |
} |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
184 |
|
191 | 185 |
void |
75 | 186 |
replacetag(Arg *arg) |
187 |
{ |
|
188 |
int i; |
|
123 | 189 |
|
75 | 190 |
if(!sel) |
191 |
return; |
|
192 |
||
178
e848966a1ac6
removed TLast tag enum, now tags is simple defined as char *[] array, the rest is calculated correctly, rules take an int array for the tags
arg@10ksloc.org
parents:
177
diff
changeset
|
193 |
for(i = 0; i < ntags; i++) |
173
1db04019684e
changed Client->tags and Rule->tags to be Bool (I'll also try to remove the TLast enum)
arg@10ksloc.org
parents:
164
diff
changeset
|
194 |
sel->tags[i] = False; |
75 | 195 |
appendtag(arg); |
196 |
} |
|
197 |
||
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
198 |
void |
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
199 |
restack() |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
200 |
{ |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
201 |
static unsigned int nwins = 0; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
202 |
static Window *wins = NULL; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
203 |
unsigned int f, fi, m, mi, n; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
204 |
Client *c; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
205 |
XEvent ev; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
206 |
|
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
207 |
for(f = 0, m = 0, c = clients; c; c = c->next) |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
208 |
if(isvisible(c)) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
209 |
if(c->isfloat || arrange == dofloat) |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
210 |
f++; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
211 |
else |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
212 |
m++; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
213 |
} |
272 | 214 |
if(!(n = 2 * (f + m))) { |
215 |
drawstatus(); |
|
216 |
return; |
|
217 |
} |
|
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
218 |
if(nwins < n) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
219 |
nwins = n; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
220 |
wins = erealloc(wins, nwins * sizeof(Window)); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
221 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
222 |
|
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
223 |
fi = 0; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
224 |
mi = 2 * f; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
225 |
if(sel->isfloat || arrange == dofloat) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
226 |
wins[fi++] = sel->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
227 |
wins[fi++] = sel->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
228 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
229 |
else { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
230 |
wins[mi++] = sel->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
231 |
wins[mi++] = sel->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
232 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
233 |
for(c = clients; c; c = c->next) |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
234 |
if(isvisible(c) && c != sel) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
235 |
if(c->isfloat || arrange == dofloat) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
236 |
wins[fi++] = c->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
237 |
wins[fi++] = c->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
238 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
239 |
else { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
240 |
wins[mi++] = c->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
241 |
wins[mi++] = c->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
242 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
243 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
244 |
XRestackWindows(dpy, wins, n); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
245 |
drawall(); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
246 |
XSync(dpy, False); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
247 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
248 |
} |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
249 |
|
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
250 |
void |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
251 |
settags(Client *c) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
252 |
{ |
114 | 253 |
char classinst[256]; |
191 | 254 |
unsigned int i, j; |
114 | 255 |
regmatch_t tmp; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
256 |
Bool matched = False; |
114 | 257 |
XClassHint ch; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
258 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
259 |
if(XGetClassHint(dpy, c->win, &ch)) { |
114 | 260 |
snprintf(classinst, sizeof(classinst), "%s:%s", |
261 |
ch.res_class ? ch.res_class : "", |
|
262 |
ch.res_name ? ch.res_name : ""); |
|
191 | 263 |
for(i = 0; !matched && i < len; i++) |
264 |
if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { |
|
265 |
c->isfloat = rule[i].isfloat; |
|
266 |
for(j = 0; rreg[i].tregex && j < ntags; j++) { |
|
267 |
if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { |
|
268 |
matched = True; |
|
269 |
c->tags[j] = True; |
|
270 |
} |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
271 |
} |
114 | 272 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
273 |
if(ch.res_class) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
274 |
XFree(ch.res_class); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
275 |
if(ch.res_name) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
276 |
XFree(ch.res_name); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
277 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
278 |
if(!matched) |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
279 |
for(i = 0; i < ntags; i++) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
280 |
c->tags[i] = seltag[i]; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
281 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
282 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
283 |
void |
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
284 |
togglemode(Arg *arg) |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
285 |
{ |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
286 |
arrange = arrange == dofloat ? dotile : dofloat; |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
287 |
arrange(NULL); |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
288 |
} |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
289 |
|
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
290 |
void |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
291 |
view(Arg *arg) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
292 |
{ |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
293 |
unsigned int i; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
294 |
|
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
295 |
for(i = 0; i < ntags; i++) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
296 |
seltag[i] = False; |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
297 |
seltag[arg->i] = True; |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
298 |
arrange(NULL); |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
299 |
} |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
300 |
|
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
301 |
void |
263
118d3e010e5e
made shortcuts like proposed by Sander, renamed viewextend to toggleview (more clear)
Anselm R.Garbe <arg@10ksloc.org>
parents:
262
diff
changeset
|
302 |
toggleview(Arg *arg) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
303 |
{ |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
304 |
unsigned int i; |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
305 |
|
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
306 |
seltag[arg->i] = !seltag[arg->i]; |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
307 |
for(i = 0; !seltag[i] && i < ntags; i++); |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
308 |
if(i == ntags) |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
309 |
seltag[arg->i] = True; /* cannot toggle last view */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
310 |
arrange(NULL); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
311 |
} |