Fix Feature #22 : set a default tag and/or screen where to send client

that have no tag/screen specific rule. Feature requested by philpep
This commit is contained in:
Raphael Khaiat 2011-01-05 01:25:12 +01:00
parent a1ad5685f9
commit fb1627e8cc
5 changed files with 34 additions and 2 deletions

View File

@ -1007,6 +1007,8 @@ client_set_rules(Client *c)
ulong n, il;
uchar *data = NULL;
char wwrole[256] = { 0 };
Bool applied_tag_rule = False;
Bool applied_screen_rule = False;
memset(&xch, 0, sizeof(xch));
@ -1060,6 +1062,10 @@ client_set_rules(Client *c)
}
tags[c->screen][c->tag].layout.func(c->screen);
/* Deprecated but still in use */
applied_tag_rule = True;
applied_screen_rule = True;
}
/* }}} */
@ -1076,7 +1082,10 @@ client_set_rules(Client *c)
c->screen = conf.rule[i].screen;
if(conf.rule[i].tag != -1)
{
c->tag = conf.rule[i].tag;
applied_tag_rule = True;
}
if(conf.rule[i].free)
c->flags |= FreeFlag;
@ -1096,12 +1105,28 @@ client_set_rules(Client *c)
client_focus(NULL);
}
if(! conf.rule[i].ignoretags)
if(!conf.rule[i].ignoretags)
tags[c->screen][c->tag].layout.func(c->screen);
}
}
}
if(!applied_tag_rule && conf.client.default_open_tag > 0 && conf.client.default_open_tag < (uint)conf.ntag[selscreen])
{
c->tag = conf.client.default_open_tag;
client_focus_next(c);
tags[c->screen][c->tag].request_update = True;
}
if(!applied_screen_rule && conf.client.default_open_screen > -1 && conf.client.default_open_screen < screen_count())
{
c->screen = conf.client.default_open_screen;
client_focus_next(c);
tags[c->screen][c->tag].request_update = True;
}
return;
}

View File

@ -286,6 +286,8 @@ conf_client_section(void)
conf.client.padding = fetch_opt_first(sec, "0", "padding").num;
conf.client.autofree = fetch_opt_first(sec, "", "autofree").str;
conf.client.automax = fetch_opt_first(sec, "", "automax").str;
conf.client.default_open_tag = fetch_opt_first(sec, "0", "default_open_tag").num;
conf.client.default_open_screen = fetch_opt_first(sec, "-1", "default_open_screen").num;
mouse = fetch_section(sec, "mouse");

View File

@ -443,6 +443,8 @@ typedef struct
uint padding;
MouseBinding *mouse;
int nmouse;
uint default_open_tag;
int default_open_screen;
} client;
struct
{

View File

@ -58,7 +58,7 @@ tag_set(int tag)
{
if(tag <= 0)
seltag[selscreen] = conf.ntag[selscreen];
else if(tag > conf.ntag[selscreen])
else if(tag > conf.ntag[selscreen])
seltag[selscreen] = 1;
else
seltag[selscreen] = tag;

3
wmfsrc
View File

@ -163,6 +163,9 @@
resize_corner_normal = "#191919"
resize_corner_focus = "#003366"
# default_open_tag = 4 # send all client that have no tag rule in this default tag
# default_open_screen = 1 # same as above but for the screen
# Space between tiled clients
padding = 0