diff options
Diffstat (limited to 'dwl-patches/patches/skipfocus')
-rw-r--r-- | dwl-patches/patches/skipfocus/README.md | 18 | ||||
-rw-r--r-- | dwl-patches/patches/skipfocus/skipfocus-20240714.patch | 81 | ||||
-rw-r--r-- | dwl-patches/patches/skipfocus/skipfocus.patch | 81 | ||||
-rw-r--r-- | dwl-patches/patches/skipfocus/skipfocus20240108.patch | 62 |
4 files changed, 242 insertions, 0 deletions
diff --git a/dwl-patches/patches/skipfocus/README.md b/dwl-patches/patches/skipfocus/README.md new file mode 100644 index 0000000..4fb6e8a --- /dev/null +++ b/dwl-patches/patches/skipfocus/README.md @@ -0,0 +1,18 @@ +### Description +Adds a rule-based ability to skip automatically focusing a window on creation. Expected use-case is for transient windows like notifications etc. The window can still be focused by mouse or keyboard movement. + +| `skipfocus` value | effect | +| ----------------- | ------------------ | +| 0 | usual | +| 1 | skipautofocus | +| 2 | skipfocus entirely | + +### Download +- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus.patch) +- [2024-07-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus-20240714.patch) +- [2024-01-08](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus-20240108.patch) +- [git branch](https://codeberg.org/dhruva_sambrani/dwl/src/branch/skipfocus) + +### Authors +- [Dhruva Sambrani](https://codeberg.org/dhruva_sambrani) + diff --git a/dwl-patches/patches/skipfocus/skipfocus-20240714.patch b/dwl-patches/patches/skipfocus/skipfocus-20240714.patch new file mode 100644 index 0000000..2715fb9 --- /dev/null +++ b/dwl-patches/patches/skipfocus/skipfocus-20240714.patch @@ -0,0 +1,81 @@ +diff --git a/config.def.h b/config.def.h +index 22d2171..9f6599c 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -22,10 +22,11 @@ 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 skipfocus monitor */ + /* 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, 0, -1 }, /* Start on currently visible tags floating, not tiled */ ++ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 0, -1 }, /* Start on ONLY tag "9" */ ++ { "mako_EXAMPLE", NULL, 0, 1, 1, -1 }, /* Start floating and skip focus + }; + + /* layout(s) */ +diff --git a/dwl.c b/dwl.c +index 145fd01..ec9d1af 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -138,7 +138,7 @@ typedef struct { + #endif + unsigned int bw; + uint32_t tags; +- int isfloating, isurgent, isfullscreen; ++ int isfloating, isurgent, isfullscreen, skipfocus; + uint32_t resize; /* configure serial of a pending resize */ + } Client; + +@@ -229,6 +229,7 @@ typedef struct { + const char *title; + uint32_t tags; + int isfloating; ++ int skipfocus; + int monitor; + } Rule; + +@@ -465,6 +466,7 @@ applyrules(Client *c) + if ((!r->title || strstr(title, r->title)) + && (!r->id || strstr(appid, r->id))) { + c->isfloating = r->isfloating; ++ c->skipfocus = r->skipfocus; + newtags |= r->tags; + i = 0; + wl_list_for_each(m, &mons, link) { +@@ -1323,6 +1325,13 @@ focusclient(Client *c, int lift) + if (locked) + return; + ++ if (c && c->skipfocus != 0){ ++ if (c -> skipfocus == 1) { ++ c->skipfocus = 0; ++ } ++ return; ++ } ++ + /* Raise client in stacking order if requested */ + if (c && lift) + wlr_scene_node_raise_to_top(&c->scene->node); +@@ -1692,11 +1701,13 @@ mapnotify(struct wl_listener *listener, void *data) + printstatus(); + + unset_fullscreen: +- m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); +- wl_list_for_each(w, &clients, link) { +- if (w != c && w->isfullscreen && m == w->mon && (w->tags & c->tags)) +- setfullscreen(w, 0); +- } ++ if (!c->skipfocus) { ++ m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); ++ wl_list_for_each(w, &clients, link) { ++ if (w != c && w->isfullscreen && m == w->mon && (w->tags & c->tags)) ++ setfullscreen(w, 0); ++ } ++ } + } + + void diff --git a/dwl-patches/patches/skipfocus/skipfocus.patch b/dwl-patches/patches/skipfocus/skipfocus.patch new file mode 100644 index 0000000..ed445ec --- /dev/null +++ b/dwl-patches/patches/skipfocus/skipfocus.patch @@ -0,0 +1,81 @@ +diff --git a/config.def.h b/config.def.h +index 22d2171..9f6599c 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -22,10 +22,11 @@ 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 skipfocus monitor */ + /* 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, 0, -1 }, /* Start on currently visible tags floating, not tiled */ ++ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 0, -1 }, /* Start on ONLY tag "9" */ ++ { "mako_EXAMPLE", NULL, 0, 1, 1, -1 }, /* Start floating and skip focus + }; + + /* layout(s) */ +diff --git a/dwl.c b/dwl.c +index dc0c861..b6a4cbb 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -141,7 +141,7 @@ typedef struct { + #endif + unsigned int bw; + uint32_t tags; +- int isfloating, isurgent, isfullscreen; ++ int isfloating, isurgent, isfullscreen, skipfocus; + uint32_t resize; /* configure serial of a pending resize */ + } Client; + +@@ -231,6 +231,7 @@ typedef struct { + const char *title; + uint32_t tags; + int isfloating; ++ int skipfocus; + int monitor; + } Rule; + +@@ -466,6 +467,7 @@ applyrules(Client *c) + if ((!r->title || strstr(title, r->title)) + && (!r->id || strstr(appid, r->id))) { + c->isfloating = r->isfloating; ++ c->skipfocus = r->skipfocus; + newtags |= r->tags; + i = 0; + wl_list_for_each(m, &mons, link) { +@@ -1343,6 +1345,13 @@ focusclient(Client *c, int lift) + if (locked) + return; + ++ if (c && c->skipfocus != 0){ ++ if (c -> skipfocus == 1) { ++ c->skipfocus = 0; ++ } ++ return; ++ } ++ + /* Raise client in stacking order if requested */ + if (c && lift) + wlr_scene_node_raise_to_top(&c->scene->node); +@@ -1738,11 +1747,13 @@ mapnotify(struct wl_listener *listener, void *data) + printstatus(); + + unset_fullscreen: +- m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); +- wl_list_for_each(w, &clients, link) { +- if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags)) +- setfullscreen(w, 0); +- } ++ if (!c->skipfocus) { ++ m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); ++ wl_list_for_each(w, &clients, link) { ++ if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags)) ++ setfullscreen(w, 0); ++ } ++ } + } + + void diff --git a/dwl-patches/patches/skipfocus/skipfocus20240108.patch b/dwl-patches/patches/skipfocus/skipfocus20240108.patch new file mode 100644 index 0000000..10d5f4f --- /dev/null +++ b/dwl-patches/patches/skipfocus/skipfocus20240108.patch @@ -0,0 +1,62 @@ +diff --git a/config.def.h b/config.def.h +index a784eb4..5d3a4f9 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -21,10 +21,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca + static int log_level = WLR_ERROR; + + static const Rule rules[] = { +- /* app_id title tags mask isfloating monitor */ ++ /* app_id title tags mask isfloating skipfocus monitor */ + /* 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, 0, -1 }, /* Start on currently visible tags floating, not tiled */ ++ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 0, -1 }, /* Start on ONLY tag "9" */ ++ { "mako_EXAMPLE", NULL, 0, 1, 1, -1 }, /* Start floating and skip focus + }; + + /* layout(s) */ +diff --git a/dwl.c b/dwl.c +index 6f041a0..90ac57b 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -137,7 +137,7 @@ typedef struct { + #endif + unsigned int bw; + uint32_t tags; +- int isfloating, isurgent, isfullscreen; ++ int isfloating, isurgent, isfullscreen, skipfocus; + uint32_t resize; /* configure serial of a pending resize */ + } Client; + +@@ -228,6 +228,7 @@ typedef struct { + const char *title; + uint32_t tags; + int isfloating; ++ int skipfocus; + int monitor; + } Rule; + +@@ -464,6 +465,7 @@ applyrules(Client *c) + if ((!r->title || strstr(title, r->title)) + && (!r->id || strstr(appid, r->id))) { + c->isfloating = r->isfloating; ++ c->skipfocus = r->skipfocus; + newtags |= r->tags; + i = 0; + wl_list_for_each(m, &mons, link) { +@@ -1307,6 +1309,13 @@ focusclient(Client *c, int lift) + if (locked) + return; + ++ if (c && c->skipfocus != 0){ ++ if (c -> skipfocus == 1) { ++ c->skipfocus = 0; ++ } ++ return; ++ } ++ + /* Raise client in stacking order if requested */ + if (c && lift) + wlr_scene_node_raise_to_top(&c->scene->node); |