summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-13 21:42:17 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-13 21:42:17 +0200
commit66da15324eef4f85c6dda13eba80430dc4cc97bb (patch)
treeb2ecd808ad31e5237cabebdc7d80fc6a4edaf1f4 /client.c
parentfixed several things, nearly feature complete (diff)
downloaddwm-66da15324eef4f85c6dda13eba80430dc4cc97bb.tar.gz
dwm-66da15324eef4f85c6dda13eba80430dc4cc97bb.zip
added mini stuff
Diffstat (limited to '')
-rw-r--r--client.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/client.c b/client.c
index 6d7bd92..3fb2318 100644
--- a/client.c
+++ b/client.c
@@ -11,10 +11,11 @@
11 11
12#include "dwm.h" 12#include "dwm.h"
13 13
14static void (*arrange)(Arg *) = tiling; 14void (*arrange)(Arg *) = tiling;
15 15
16static Rule rule[] = { 16static Rule rule[] = {
17 { "Firefox-bin", "Gecko", { [Twww] = "www" } }, 17 /* class instance tags floating */
18 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False },
18}; 19};
19 20
20static Client * 21static Client *
@@ -64,27 +65,27 @@ view(Arg *arg)
64} 65}
65 66
66void 67void
67tag(Arg *arg) 68tappend(Arg *arg)
68{ 69{
69 int i, n;
70 if(!sel) 70 if(!sel)
71 return; 71 return;
72 72
73 if(arg->i == tsel) { 73 sel->tags[arg->i] = tags[arg->i];
74 for(n = i = 0; i < TLast; i++)
75 if(sel->tags[i])
76 n++;
77 if(n < 2)
78 return;
79 }
80
81 if(sel->tags[arg->i])
82 sel->tags[arg->i] = NULL; /* toggle tag */
83 else
84 sel->tags[arg->i] = tags[arg->i];
85 arrange(NULL); 74 arrange(NULL);
86} 75}
87 76
77void
78ttrunc(Arg *arg)
79{
80 int i;
81 if(!sel)
82 return;
83
84 for(i = 0; i < TLast; i++)
85 sel->tags[i] = NULL;
86 tappend(arg);
87}
88
88static void 89static void
89ban_client(Client *c) 90ban_client(Client *c)
90{ 91{
@@ -122,13 +123,18 @@ tiling(Arg *arg)
122 w = sw - mw; 123 w = sw - mw;
123 arrange = tiling; 124 arrange = tiling;
124 for(n = 0, c = clients; c; c = c->next) 125 for(n = 0, c = clients; c; c = c->next)
125 if(c->tags[tsel]) 126 if(c->tags[tsel] && !c->floating)
126 n++; 127 n++;
127 128
128 h = (n > 1) ? sh / (n - 1) : sh; 129 h = (n > 1) ? sh / (n - 1) : sh;
129 130
130 for(i = 0, c = clients; c; c = c->next) { 131 for(i = 0, c = clients; c; c = c->next) {
131 if(c->tags[tsel]) { 132 if(c->tags[tsel]) {
133 if(c->floating) {
134 craise(c);
135 resize(c, True);
136 continue;
137 }
132 if(n == 1) { 138 if(n == 1) {
133 c->x = sx; 139 c->x = sx;
134 c->y = sy; 140 c->y = sy;
@@ -330,14 +336,13 @@ init_tags(Client *c)
330 336
331 if(XGetClassHint(dpy, c->win, &ch)) { 337 if(XGetClassHint(dpy, c->win, &ch)) {
332 if(ch.res_class && ch.res_name) { 338 if(ch.res_class && ch.res_name) {
333 fprintf(stderr, "%s:%s\n", ch.res_class, ch.res_name);
334 for(i = 0; i < len; i++) 339 for(i = 0; i < len; i++)
335 if(!strncmp(rule[i].class, ch.res_class, sizeof(rule[i].class)) 340 if(!strncmp(rule[i].class, ch.res_class, sizeof(rule[i].class))
336 && !strncmp(rule[i].instance, ch.res_name, sizeof(rule[i].instance))) 341 && !strncmp(rule[i].instance, ch.res_name, sizeof(rule[i].instance)))
337 { 342 {
338 fprintf(stderr, "->>>%s:%s\n", ch.res_class, ch.res_name);
339 for(j = 0; j < TLast; j++) 343 for(j = 0; j < TLast; j++)
340 c->tags[j] = rule[i].tags[j]; 344 c->tags[j] = rule[i].tags[j];
345 c->floating = rule[i].floating;
341 matched = True; 346 matched = True;
342 break; 347 break;
343 } 348 }
@@ -357,6 +362,7 @@ manage(Window w, XWindowAttributes *wa)
357{ 362{
358 Client *c, **l; 363 Client *c, **l;
359 XSetWindowAttributes twa; 364 XSetWindowAttributes twa;
365 Window trans;
360 366
361 c = emallocz(sizeof(Client)); 367 c = emallocz(sizeof(Client));
362 c->win = w; 368 c->win = w;
@@ -370,7 +376,7 @@ manage(Window w, XWindowAttributes *wa)
370 update_size(c); 376 update_size(c);
371 XSelectInput(dpy, c->win, 377 XSelectInput(dpy, c->win,
372 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); 378 StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
373 XGetTransientForHint(dpy, c->win, &c->trans); 379 XGetTransientForHint(dpy, c->win, &trans);
374 twa.override_redirect = 1; 380 twa.override_redirect = 1;
375 twa.background_pixmap = ParentRelative; 381 twa.background_pixmap = ParentRelative;
376 twa.event_mask = ExposureMask; 382 twa.event_mask = ExposureMask;
@@ -396,6 +402,11 @@ manage(Window w, XWindowAttributes *wa)
396 GrabModeAsync, GrabModeSync, None, None); 402 GrabModeAsync, GrabModeSync, None, None);
397 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, 403 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
398 GrabModeAsync, GrabModeSync, None, None); 404 GrabModeAsync, GrabModeSync, None, None);
405
406 if(!c->floating)
407 c->floating = trans
408 || ((c->maxw == c->minw) && (c->maxh == c->minh));
409
399 arrange(NULL); 410 arrange(NULL);
400 if(c->tags[tsel]) 411 if(c->tags[tsel])
401 focus(c); 412 focus(c);