@@ 217,3 217,9 @@ static const Button buttons[] = {
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};
+
+bool applycustomrules(const char *appid, const char *title, Rule *r)
+{
+ // TODO: apply any rules you wish
+ return false;
+}
@@ 261,7 261,7 @@ typedef struct {
int noswallow;
int allow_activation;
int monitor;
- const char scratchkey;
+ char scratchkey;
} Rule;
typedef struct {
@@ 585,7 585,7 @@ applyrules(Client *c)
const char *appid, *title;
uint32_t newtags = 0;
int i;
- const Rule *r;
+ Rule *r;
Monitor *mon = selmon, *m;
c->scratchkey = 0;
@@ 594,23 594,35 @@ applyrules(Client *c)
c->pid = client_get_pid(c);
+ void
+ applyrule(const Rule *r)
+ {
+ c->isfloating = r->isfloating;
+ c->isterm = r->isterm;
+ c->noswallow = r->noswallow;
+ c->scratchkey = r->scratchkey;
+ c->allow_activation = r->allow_activation;
+ newtags |= r->tags;
+ i = 0;
+ wl_list_for_each(m, &mons, link) {
+ if (r->monitor == i++)
+ mon = m;
+ }
+ }
+
for (r = rules; r < END(rules); r++) {
if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) {
- c->isfloating = r->isfloating;
- c->isterm = r->isterm;
- c->noswallow = r->noswallow;
- c->scratchkey = r->scratchkey;
- c->allow_activation = r->allow_activation;
- newtags |= r->tags;
- i = 0;
- wl_list_for_each(m, &mons, link) {
- if (r->monitor == i++)
- mon = m;
- }
+ applyrule(r);
}
}
+ // Reset the rule.
+ Rule rule = (Rule) { NULL, NULL, 0, 0, 0, 0, -1, 0 };
+ if (applycustomrules(appid, title, &rule)) {
+ applyrule(&rule);
+ }
+
wl_list_for_each(m, &mons, link) {
// tag with different monitor selected by rules
if (m->tagset[m->seltags] & newtags) {