Client: add autofree option in client section (Feature #9 requested by lidstah (and tamtam)) See default wmfsrc

This commit is contained in:
Martin Duquesnoy 2010-06-06 23:34:11 +02:00
parent 9067f3cb66
commit 12fc01b824
5 changed files with 16 additions and 4 deletions

View File

@ -719,7 +719,7 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
free(t);
client_attach(c);
client_set_wanted_tag(c);
client_set_rules(c);
client_get_name(c);
client_raise(c);
client_focus(c);
@ -972,11 +972,11 @@ client_swap(Client *c1, Client *c2)
return;
}
/** Set the wanted tag of a client
/** Set the wanted tag or autofree of a client
*\param c Client pointer
*/
void
client_set_wanted_tag(Client *c)
client_set_rules(Client *c)
{
XClassHint xch = { 0 };
int i, j, k;
@ -989,6 +989,12 @@ client_set_wanted_tag(Client *c)
XGetClassHint(dpy, c->win, &xch);
/* Auto free */
if((xch.res_name && strstr(conf.client.autofree, xch.res_name))
|| (xch.res_class && strstr(conf.client.autofree, xch.res_class)))
c->flags |= FreeFlag;
/* Wanted tag */
for(i = 0; i < screen_count(); ++i)
for(j = 1; j < conf.ntag[i] + 1; ++j)
if(tags[i][j].clients)

View File

@ -269,6 +269,7 @@ conf_client_section(void)
conf.client.mod |= char_to_modkey(fetch_opt_first(sec, "Alt", "modifier").str, key_list);
conf.client.set_new_win_master = fetch_opt_first(sec, "true", "set_new_win_master").bool;
conf.client.padding = fetch_opt_first(sec, "0", "padding").num;
conf.client.autofree = fetch_opt_first(sec, "", "autofree").str;
mouse = fetch_section(sec, "mouse");

View File

@ -396,6 +396,7 @@ typedef struct
Bool place_at_mouse;
Bool border_shadow;
int borderheight;
char *autofree;
uint bordernormal;
uint borderfocus;
uint resizecorner_normal;

View File

@ -187,7 +187,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 client_set_rules(Client *c);
void client_update_attributes(Client *c);
void uicb_client_raise(uicb_t);
void uicb_client_next(uicb_t);

View File

@ -127,8 +127,12 @@
# Space between tiled clients
padding = 0
# Modifier for mouse use
modifier = "Alt"
# Set automatic free client
# autofree = "xterm|MPlayer"
[mouse] button = "1" func = "client_raise" [/mouse]
[mouse] button = "1" func = "mouse_move" [/mouse]
[mouse] button = "3" func = "client_raise" [/mouse]