screen can now be specified in rules

This commit is contained in:
Julien Danjou 2007-11-12 18:21:03 +01:00
parent 0c5c5ce426
commit f70424487e
6 changed files with 24 additions and 8 deletions

View File

@ -92,8 +92,9 @@ rules
rule
{
name = "Gimp"
tags = ""
tags = "9"
float = true
screen = 0
}
rule
{

View File

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

View File

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

View File

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

17
tag.c
View File

@ -22,14 +22,15 @@
#include <stdio.h>
#include <X11/Xutil.h>
#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

2
tag.h
View File

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