From 0f3fcb21925df3d45bd9362e805635505b9a014b Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Mon, 20 Apr 2009 13:11:45 +0200 Subject: [PATCH] Client/Conf/Tag: Add clients = {} list section in tag {} section for choose which clients will goes in which tags. --- src/client.c | 47 ++++++++++++++++++++++++++++++----------------- src/wmfs.h | 1 + 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/client.c b/src/client.c index d8168c1..2e4af95 100644 --- a/src/client.c +++ b/src/client.c @@ -401,8 +401,7 @@ client_manage(Window w, XWindowAttributes *wa) Window trans; Status rettrans; XSetWindowAttributes at; - XClassHint xch; - int mx, my, i, j, k; + int mx, my; screen_get_sel(); @@ -460,30 +459,18 @@ client_manage(Window w, XWindowAttributes *wa) if(!c->free) c->free = (rettrans == Success) || c->hint; free(t); - XGetClassHint(dpy, c->win, &xch); - for(i = 0; i < screen_count(); ++i) - for(j = 1; j < conf.ntag[i] + 1; ++j) - if(tags[i][j].clients != NULL) - for(k = 0; k < tags[i][j].nclients; ++k) - if((xch.res_name && !strcmp(tags[i][j].clients[k], xch.res_name)) - || (xch.res_class && !strcmp(tags[i][j].clients[k], xch.res_class))) - { - printf("class: %s name: %s\n", xch.res_class, xch.res_name); - c->screen = i; - c->tag = j; - } - client_attach(c); - client_map(c); client_get_name(c); + client_map(c); client_raise(c); client_focus(c); setwinstate(c->win, NormalState); ewmh_get_client_list(); ewmh_manage_window_type(c); arrange(c->screen); + client_set_wanted_tag(c); - return; + return; } /** Move and Resize a client @@ -669,6 +656,32 @@ client_size_hints(Client *c) return; } +/** Set the wanted tag of a client + *\param c Client pointer +*/ +void +client_set_wanted_tag(Client *c) +{ + XClassHint xch; + int i, j, k; + + XGetClassHint(dpy, c->win, &xch); + + for(i = 0; i < screen_count(); ++i) + for(j = 1; j < conf.ntag[i] + 1; ++j) + if(tags[i][j].clients) + for(k = 0; k < tags[i][j].nclients; ++k) + if((xch.res_name && strstr(xch.res_name, tags[i][j].clients[k])) + || (xch.res_class && strstr(xch.res_class, tags[i][j].clients[k]))) + { + c->screen = i; + c->tag = j; + arrange(i); + } + + return; +} + /** Raise a client * \param c Client pointer */ diff --git a/src/wmfs.h b/src/wmfs.h index 9baaea4..1c670cf 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -149,6 +149,7 @@ void client_raise(Client *c); void client_unhide(Client *c); void client_unmanage(Client *c); void client_unmap(Client *c); +void client_set_wanted_tag(Client *c); void uicb_client_raise(uicb_t); void uicb_client_prev(uicb_t); void uicb_client_next(uicb_t);