about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@10kloc.org>2006-08-23 12:08:37 +0200
committerAnselm R. Garbe <arg@10kloc.org>2006-08-23 12:08:37 +0200
commitd6a6eca71d760fb3b61e35b187b9b9fd51092c71 (patch)
tree40416b29fb7df46aa8f35a4201a49dd73d66840b
parent39ffc18635686b1a65cd80d19828c4fe2aed982f (diff)
downloaddwm-d6a6eca71d760fb3b61e35b187b9b9fd51092c71.tar.gz
implemented class:inst:title matching
-rw-r--r--config.arg.h2
-rw-r--r--config.default.h6
-rw-r--r--tag.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/config.arg.h b/config.arg.h
index d346856..70c245f 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -46,7 +46,7 @@ static Key key[] = { \
 
 #define RULES \
 static Rule rule[] = { \
-	/* class:instance regex		tags regex	isfloat */ \
+	/* class:instance:title regex	tags regex	isfloat */ \
 	{ "Firefox.*",			"net",		False }, \
 	{ "Gimp.*",			NULL,		True}, \
 	{ "MPlayer.*",			NULL,		True}, \
diff --git a/config.default.h b/config.default.h
index 453da71..c0102b0 100644
--- a/config.default.h
+++ b/config.default.h
@@ -47,11 +47,11 @@ static Key key[] = { \
 	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
 };
 
-/* Query class:instance for regex matching info with following command:
- * xprop | awk -F'"' '/^WM_CLASS/ { printf "%s:%s\n", $4, $2 }'*/
+/* Query class:instance:title for regex matching info with following command:
+ * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/{ printf("%s\n",$2) }' */
 #define RULES \
 static Rule rule[] = { \
-	/* class:instance regex		tags regex	isfloat */ \
+	/* class:instance:title regex	tags regex	isfloat */ \
 	{ "Firefox.*",			"2",		False }, \
 	{ "Gimp.*",			NULL,		True}, \
 };
diff --git a/tag.c b/tag.c
index bc36f08..512f355 100644
--- a/tag.c
+++ b/tag.c
@@ -78,18 +78,18 @@ initrregs()
 void
 settags(Client *c)
 {
-	char classinst[256];
+	char prop[512];
 	unsigned int i, j;
 	regmatch_t tmp;
 	Bool matched = False;
 	XClassHint ch;
 
 	if(XGetClassHint(dpy, c->win, &ch)) {
-		snprintf(classinst, sizeof(classinst), "%s:%s",
+		snprintf(prop, sizeof(prop), "%s:%s:%s",
 				ch.res_class ? ch.res_class : "",
-				ch.res_name ? ch.res_name : "");
+				ch.res_name ? ch.res_name : "", c->name);
 		for(i = 0; !matched && i < len; i++)
-			if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) {
+			if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
 				c->isfloat = rule[i].isfloat;
 				for(j = 0; rreg[i].tregex && j < ntags; j++) {
 					if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) {
='n248' href='#n248'>248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440