diff --git a/awesomerc b/awesomerc index 5403b9a3..0ec820ff 100644 --- a/awesomerc +++ b/awesomerc @@ -92,8 +92,9 @@ rules rule { name = "Gimp" - tags = "" + tags = "9" float = true + screen = 0 } rule { diff --git a/client.c b/client.c index 8307c895..8c99d6c0 100644 --- a/client.c +++ b/client.c @@ -258,7 +258,7 @@ loadprops(Client * c, int ntags) void client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf) { - int i; + int i, newscreen = -1; Client *c, *t = NULL; Window trans; Status rettrans; @@ -344,7 +344,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf) /* loadprops or apply rules if no props */ if(!loadprops(c, awesomeconf->ntags)) - applyrules(c, awesomeconf); + newscreen = applyrules(c, awesomeconf); /* should be floating if transsient or fixed) */ if(!c->isfloating) @@ -363,6 +363,8 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf) /* rearrange to display new window */ arrange(awesomeconf); + if(newscreen != -1) + arrange(&awesomeconf[newscreen - awesomeconf->screen]); } void diff --git a/config.c b/config.c index d3139484..1bda7248 100644 --- a/config.c +++ b/config.c @@ -283,6 +283,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf) CFG_STR((char *) "name", (char *) "", CFGF_NONE), CFG_STR((char *) "tags", (char *) "", CFGF_NONE), CFG_BOOL((char *) "float", cfg_false, CFGF_NONE), + CFG_INT((char *) "screen", -1, CFGF_NONE), CFG_END() }; static cfg_opt_t rules_opts[] = @@ -452,6 +453,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf) if(!a_strlen(awesomeconf->rules[i].tags)) awesomeconf->rules[i].tags = NULL; awesomeconf->rules[i].isfloating = cfg_getbool(cfgsectmp, "float"); + awesomeconf->rules[i].screen = cfg_getint(cfgsectmp, "screen"); } compileregs(awesomeconf->rules, awesomeconf->nrules); diff --git a/config.h b/config.h index 9ca7ff84..34dbcbd0 100644 --- a/config.h +++ b/config.h @@ -40,6 +40,7 @@ typedef struct { char *prop; char *tags; + int screen; Bool isfloating; regex_t *propregex; regex_t *tagregex; @@ -165,7 +166,6 @@ struct awesome_config int ntags; /** Layout list */ Layout *layouts; - /** Number of layouts in *layouts */ int nlayouts; /** Rules list */ Rule *rules; diff --git a/tag.c b/tag.c index 7a2645ec..2fafc867 100644 --- a/tag.c +++ b/tag.c @@ -22,14 +22,15 @@ #include #include +#include "screen.h" #include "layout.h" #include "tag.h" #include "util.h" -void -applyrules(Client * c, awesome_config *awesomeconf) +int +applyrules(Client *c, awesome_config *awesomeconf) { - int i, j, len = 0; + int i, j, screen = -1, len = 0; regmatch_t tmp; Bool matched = False; XClassHint ch = { 0, 0 }; @@ -56,6 +57,14 @@ applyrules(Client * c, awesome_config *awesomeconf) } else c->tags[j] = False; + if(awesomeconf->rules[i].screen != -1 + && awesomeconf->rules[i].screen != awesomeconf->screen) + { + screen = awesomeconf->rules[i].screen; + move_client_to_screen(c, + &awesomeconf[awesomeconf->rules[i].screen - awesomeconf->screen], + True); + } } p_delete(&prop); if(ch.res_class) @@ -65,6 +74,8 @@ applyrules(Client * c, awesome_config *awesomeconf) if(!matched) for(i = 0; i < awesomeconf->ntags; i++) c->tags[i] = awesomeconf->tags[i].selected; + + return screen; } void diff --git a/tag.h b/tag.h index 1c37cd27..4c5cf0e2 100644 --- a/tag.h +++ b/tag.h @@ -29,7 +29,7 @@ void compileregs(Rule *, int); Bool isvisible(Client *, int, Tag *, int); -void applyrules(Client * c, awesome_config *); +int applyrules(Client * c, awesome_config *); UICB_PROTO(uicb_tag); UICB_PROTO(uicb_togglefloating);