mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-11-03 20:02:31 +00:00
skipfocus: rebase to latest main
This commit is contained in:
@@ -8,7 +8,8 @@ Adds a rule-based ability to skip automatically focusing a window on creation. E
|
|||||||
| 2 | skipfocus entirely |
|
| 2 | skipfocus entirely |
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus.patch)
|
- [2026-09-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus-20260927.patch)
|
||||||
|
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus-20240918.patch)
|
||||||
- [2024-07-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/skipfocus/skipfocus-20240714.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)
|
- [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)
|
- [git branch](https://codeberg.org/dhruva_sambrani/dwl/src/branch/skipfocus)
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a4019d3..f8b8ef0 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -22,9 +22,10 @@ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You ca
|
||||||
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
|
static const Rule rules[] = {
|
||||||
|
- /* app_id title tags mask isfloating monitor */
|
||||||
|
- { "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" */
|
||||||
|
+ /* app_id title tags mask isfloating skipfocus monitor */
|
||||||
|
+ { "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 */
|
||||||
|
/* default/example rule: can be changed but cannot be eliminated; at least one rule must exist */
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index cca1ea4..7c6938e 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -158,7 +158,7 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, skipfocus;
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -248,6 +248,7 @@ typedef struct {
|
||||||
|
const char *title;
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating;
|
||||||
|
+ int skipfocus;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
@@ -533,6 +534,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) {
|
||||||
|
@@ -1526,6 +1528,13 @@ focusclient(Client *c, LayerSurface *l, 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);
|
||||||
|
@@ -1958,11 +1967,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
|
||||||
Reference in New Issue
Block a user