Client/Conf/Tag: Add clients = {} list section in tag {} section for choose which clients will goes in which tags.

This commit is contained in:
Martin Duquesnoy 2009-04-20 13:11:45 +02:00
parent 4a8db8d34b
commit 0f3fcb2192
2 changed files with 31 additions and 17 deletions

View File

@ -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
*/

View File

@ -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);