From d1da5bfe4e94c0acbb9c8cb568a0a0c67a670a79 Mon Sep 17 00:00:00 2001 From: Zuki Air Date: Thu, 29 May 2025 14:24:02 +0100 Subject: [PATCH] inverse rules patch adds a rule flag to allow a user to apply a rule to all but one window. --- config.def.h | 6 +++--- dwl.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index 22d2171..0aaa6a0 100644 --- a/config.def.h +++ b/config.def.h @@ -22,10 +22,10 @@ static int log_level = WLR_ERROR; /* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */ static const Rule rules[] = { - /* app_id title tags mask isfloating monitor */ + /* app_id title tags mask isfloating monitor inverse*/ /* examples: */ - { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */ - { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */ + { "Gimp_EXAMPLE", NULL, 0, 1, -1, false}, /* Start on currently visible tags floating, not tiled */ + { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1, false}, /* Start on ONLY tag "9" */ }; /* layout(s) */ diff --git a/dwl.c b/dwl.c index 4816159..57d8a09 100644 --- a/dwl.c +++ b/dwl.c @@ -228,6 +228,7 @@ typedef struct { uint32_t tags; int isfloating; int monitor; + bool inverse; } Rule; typedef struct { @@ -488,8 +489,8 @@ applyrules(Client *c) title = client_get_title(c); for (r = rules; r < END(rules); r++) { - if ((!r->title || strstr(title, r->title)) - && (!r->id || strstr(appid, r->id))) { + if (((!r->title || strstr(title, r->title)) + && (!r->id || strstr(appid, r->id))) ^ r->inverse) { c->isfloating = r->isfloating; newtags |= r->tags; i = 0; -- 2.49.0