mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-11-04 04:03:18 +00:00
Compare commits
5
Commits
ac60875541
...
a733201614
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a733201614 | ||
|
|
3ff8f1731f | ||
|
|
1725192f63 | ||
|
|
eca40ea3ed | ||
|
|
ef95baef73 |
@@ -8,7 +8,8 @@ There are also two functions that can be bound to a `Key` or `Button`,
|
|||||||
2. `toggledimmingclient`: Which toggles dimming for the focused window, as if the client had `neverdim` applied to it. This overwrites an applied `Rule`.
|
2. `toggledimmingclient`: Which toggles dimming for the focused window, as if the client had `neverdim` applied to it. This overwrites an applied `Rule`.
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [2026-03-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused.patch)
|
- [2026-09-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20260927.patch)
|
||||||
|
- [2026-03-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20260310.patch)
|
||||||
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20240918.patch)
|
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20240918.patch)
|
||||||
- [2024-09-03](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20240903.patch)
|
- [2024-09-03](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20240903.patch)
|
||||||
- [2024-07-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20240714.patch)
|
- [2024-07-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dim-unfocused/dim-unfocused-20240714.patch)
|
||||||
|
|||||||
@@ -0,0 +1,221 @@
|
|||||||
|
diff --git a/client.h b/client.h
|
||||||
|
index d9f90bb..7a7792d 100644
|
||||||
|
--- a/client.h
|
||||||
|
+++ b/client.h
|
||||||
|
@@ -318,6 +318,12 @@ client_set_border_color(Client *c, const float color[static 4])
|
||||||
|
wlr_scene_rect_set_color(c->border[i], color);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void
|
||||||
|
+client_set_dimmer_state(Client *c, const int dim)
|
||||||
|
+{
|
||||||
|
+ wlr_scene_node_set_enabled(&c->dimmer->node, DIMOPT && !c->neverdim && dim);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static inline void
|
||||||
|
client_set_fullscreen(Client *c, int fullscreen)
|
||||||
|
{
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..96a020a 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -10,6 +10,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const float rootcolor[] = COLOR(0x222222ff);
|
||||||
|
static const float bordercolor[] = COLOR(0x444444ff);
|
||||||
|
static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
+static const float unfocuseddim[] = COLOR(0x00000088);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
@@ -168,5 +169,6 @@ static const Key keys[] = {
|
||||||
|
static const Button buttons[] = {
|
||||||
|
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
|
||||||
|
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
|
||||||
|
+ { MODKEY|ShiftMask, BTN_MIDDLE, toggledimmingclient, {0} },
|
||||||
|
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
|
||||||
|
};
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 101a45f..d6b129a 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -109,6 +109,7 @@ typedef struct {
|
||||||
|
Monitor *mon;
|
||||||
|
struct wlr_scene_tree *scene;
|
||||||
|
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
||||||
|
+ struct wlr_scene_rect *dimmer;
|
||||||
|
struct wlr_scene_tree *scene_surface;
|
||||||
|
struct wl_list link;
|
||||||
|
struct wl_list flink;
|
||||||
|
@@ -138,7 +139,7 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, neverdim;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
@@ -228,6 +229,7 @@ typedef struct {
|
||||||
|
const char *title;
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating;
|
||||||
|
+ int neverdim;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
@@ -335,6 +337,8 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
static void tagmon(const Arg *arg);
|
||||||
|
static void tile(Monitor *m);
|
||||||
|
+static void toggledimming(const Arg *arg);
|
||||||
|
+static void toggledimmingclient(const Arg *arg);
|
||||||
|
static void togglefloating(const Arg *arg);
|
||||||
|
static void togglefullscreen(const Arg *arg);
|
||||||
|
static void toggletag(const Arg *arg);
|
||||||
|
@@ -406,6 +410,7 @@ static struct wlr_output_layout *output_layout;
|
||||||
|
static struct wlr_box sgeom;
|
||||||
|
static struct wl_list mons;
|
||||||
|
static Monitor *selmon;
|
||||||
|
+static int DIMOPT = 1;
|
||||||
|
|
||||||
|
/* global event handlers */
|
||||||
|
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
||||||
|
@@ -491,6 +496,7 @@ applyrules(Client *c)
|
||||||
|
if ((!r->title || strstr(title, r->title))
|
||||||
|
&& (!r->id || strstr(appid, r->id))) {
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
+ c->neverdim = r-> neverdim;
|
||||||
|
newtags |= r->tags;
|
||||||
|
i = 0;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
@@ -1433,8 +1439,10 @@ focusclient(Client *c, int lift)
|
||||||
|
|
||||||
|
/* Don't change border color if there is an exclusive focus or we are
|
||||||
|
* handling a drag operation */
|
||||||
|
- if (!exclusive_focus && !seat->drag)
|
||||||
|
+ if (!exclusive_focus && !seat->drag) {
|
||||||
|
client_set_border_color(c, focuscolor);
|
||||||
|
+ client_set_dimmer_state(c, 0);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Deactivate old client if focus is changing */
|
||||||
|
@@ -1452,7 +1460,7 @@ focusclient(Client *c, int lift)
|
||||||
|
* and probably other clients */
|
||||||
|
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
||||||
|
client_set_border_color(old_c, bordercolor);
|
||||||
|
-
|
||||||
|
+ client_set_dimmer_state(old_c, 1);
|
||||||
|
client_activate_surface(old, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1739,8 +1747,7 @@ void
|
||||||
|
mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
|
- Client *p = NULL;
|
||||||
|
- Client *w, *c = wl_container_of(listener, c, map);
|
||||||
|
+ Client *p, *w, *d, *c = wl_container_of(listener, c, map);
|
||||||
|
Monitor *m;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
@@ -1774,6 +1781,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
c->border[i]->node.data = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ c->dimmer = wlr_scene_rect_create(c->scene, 0, 0, unfocuseddim);
|
||||||
|
+ c->dimmer->node.data = c;
|
||||||
|
+ client_set_dimmer_state(c, 1);
|
||||||
|
+
|
||||||
|
/* Initialize client geometry with room for border */
|
||||||
|
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT);
|
||||||
|
c->geom.width += 2 * c->bw;
|
||||||
|
@@ -1792,6 +1803,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
setmon(c, p->mon, p->tags);
|
||||||
|
} else {
|
||||||
|
applyrules(c);
|
||||||
|
+ d = focustop(selmon);
|
||||||
|
+ if (d) {
|
||||||
|
+ client_set_dimmer_state(d, 0);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
printstatus();
|
||||||
|
|
||||||
|
@@ -2218,7 +2233,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||||
|
c->geom = geo;
|
||||||
|
applybounds(c, bbox);
|
||||||
|
|
||||||
|
- /* Update scene-graph, including borders */
|
||||||
|
+ /* Update scene-graph, including borders and dimmer*/
|
||||||
|
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
|
||||||
|
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||||
|
wlr_scene_rect_set_size(c->border[0], c->geom.width, c->bw);
|
||||||
|
@@ -2228,6 +2243,8 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||||
|
wlr_scene_node_set_position(&c->border[1]->node, 0, c->geom.height - c->bw);
|
||||||
|
wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw);
|
||||||
|
wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw);
|
||||||
|
+ wlr_scene_rect_set_size(c->dimmer, c->geom.width - 2*c->bw, c-> geom.height - 2*c->bw);
|
||||||
|
+ wlr_scene_node_set_position(&c->dimmer->node, c->bw, c->bw);
|
||||||
|
|
||||||
|
/* this is a no-op if size hasn't changed */
|
||||||
|
c->resize = client_set_size(c, c->geom.width - 2 * c->bw,
|
||||||
|
@@ -2745,6 +2762,27 @@ tile(Monitor *m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void toggledimming(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ DIMOPT ^= 1;
|
||||||
|
+ wl_list_for_each(c, &clients, link)
|
||||||
|
+ {
|
||||||
|
+ client_set_dimmer_state(c, 1);
|
||||||
|
+ }
|
||||||
|
+ c = focustop(selmon);
|
||||||
|
+ if (c)
|
||||||
|
+ client_set_dimmer_state(c, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+toggledimmingclient(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel = focustop(selmon);
|
||||||
|
+ if (sel)
|
||||||
|
+ sel -> neverdim ^= 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
togglefloating(const Arg *arg)
|
||||||
|
{
|
||||||
|
@@ -3022,9 +3060,29 @@ xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
|
Client *c = NULL;
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
int layer;
|
||||||
|
-
|
||||||
|
+ struct wlr_scene_node *hidden_dimmers[32];
|
||||||
|
+ int hidden_count = 0;
|
||||||
|
for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) {
|
||||||
|
- if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny)))
|
||||||
|
+ node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny);
|
||||||
|
+
|
||||||
|
+ while (node && node->type == WLR_SCENE_NODE_RECT && node->data) {
|
||||||
|
+ Client *hit_c = node->data;
|
||||||
|
+ /* Verify the node is actually a client's dimmer */
|
||||||
|
+ if (hit_c->type != LayerShell && hit_c->dimmer && &hit_c->dimmer->node == node) {
|
||||||
|
+ if (hidden_count < 32) {
|
||||||
|
+ wlr_scene_node_set_enabled(node, 0);
|
||||||
|
+ hidden_dimmers[hidden_count++] = node;
|
||||||
|
+ node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for(int i=0; i<hidden_count; i++)
|
||||||
|
+ wlr_scene_node_set_enabled(hidden_dimmers[i], 1);
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (node->type == WLR_SCENE_NODE_BUFFER)
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
diff --git a/client.h b/client.h
|
||||||
|
index eb1bb47..c41e287 100644
|
||||||
|
--- a/client.h
|
||||||
|
+++ b/client.h
|
||||||
|
@@ -347,6 +347,12 @@ client_set_border_color(Client *c, const float color[static 4])
|
||||||
|
wlr_scene_rect_set_color(c->border[i], color);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void
|
||||||
|
+client_set_dimmer_state(Client *c, const int dim)
|
||||||
|
+{
|
||||||
|
+ wlr_scene_node_set_enabled(&c->dimmer->node, DIMOPT && !c->neverdim && dim);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static inline void
|
||||||
|
client_set_fullscreen(Client *c, int fullscreen)
|
||||||
|
{
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a4019d3..bf829c6 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -11,6 +11,7 @@ static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
static const float rootcolor[] = COLOR(0x222222ff);
|
||||||
|
static const float bordercolor[] = COLOR(0x444444ff);
|
||||||
|
static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
+static const float unfocuseddim[] = COLOR(0x00000088);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
@@ -168,6 +169,7 @@ static const Key keys[] = {
|
||||||
|
static const Button buttons[] = {
|
||||||
|
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
|
||||||
|
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
|
||||||
|
+ { MODKEY|ShiftMask, BTN_MIDDLE, toggledimmingclient, {0} },
|
||||||
|
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index cca1ea4..af6371b 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -121,6 +121,7 @@ typedef struct {
|
||||||
|
Monitor *mon;
|
||||||
|
struct wlr_scene_tree *scene;
|
||||||
|
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
||||||
|
+ struct wlr_scene_rect *dimmer;
|
||||||
|
struct wlr_scene_tree *scene_surface;
|
||||||
|
struct wl_list link;
|
||||||
|
struct wl_list flink;
|
||||||
|
@@ -158,7 +159,7 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, neverdim;
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -248,6 +249,7 @@ typedef struct {
|
||||||
|
const char *title;
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating;
|
||||||
|
+ int neverdim;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
@@ -357,6 +359,8 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
static void tagmon(const Arg *arg);
|
||||||
|
static void tile(Monitor *m);
|
||||||
|
+static void toggledimming(const Arg *arg);
|
||||||
|
+static void toggledimmingclient(const Arg *arg);
|
||||||
|
static void togglefloating(const Arg *arg);
|
||||||
|
static void togglefullscreen(const Arg *arg);
|
||||||
|
static void toggletag(const Arg *arg);
|
||||||
|
@@ -431,6 +435,7 @@ static struct wlr_box sgeom;
|
||||||
|
static struct wl_list mons;
|
||||||
|
static Monitor *selmon;
|
||||||
|
static int consumed[KEY_MAX + 1];
|
||||||
|
+static int DIMOPT = 1;
|
||||||
|
|
||||||
|
/* global event handlers */
|
||||||
|
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
||||||
|
@@ -533,6 +538,7 @@ applyrules(Client *c)
|
||||||
|
if ((!r->title || strstr(title, r->title))
|
||||||
|
&& (!r->id || strstr(appid, r->id))) {
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
+ c->neverdim = r-> neverdim;
|
||||||
|
newtags |= r->tags;
|
||||||
|
i = 0;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
@@ -1550,8 +1556,10 @@ focusclient(Client *c, LayerSurface *l, int lift)
|
||||||
|
* handling a drag operation */
|
||||||
|
if (!(old_l && old_l->layer_surface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||||
|
&& !(old_c && client_wants_focus(old_c))
|
||||||
|
- && !seat->drag)
|
||||||
|
+ && !seat->drag) {
|
||||||
|
client_set_border_color(c, focuscolor);
|
||||||
|
+ client_set_dimmer_state(c, 0);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If an overlay is focused, don't focus or activate the client,
|
||||||
|
@@ -1566,8 +1574,10 @@ focusclient(Client *c, LayerSurface *l, int lift)
|
||||||
|
|
||||||
|
if (focused_client && focused_client != c && !(c && client_is_unmanaged(c))) {
|
||||||
|
struct wlr_surface *s = client_surface(focused_client);
|
||||||
|
- if (c)
|
||||||
|
+ if (c) {
|
||||||
|
client_set_border_color(focused_client, bordercolor);
|
||||||
|
+ client_set_dimmer_state(focused_client, 1);
|
||||||
|
+ }
|
||||||
|
if (s && s->mapped)
|
||||||
|
client_activate_surface(s, 0);
|
||||||
|
focused_client = NULL;
|
||||||
|
@@ -1887,7 +1897,7 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
|
Client *p = NULL;
|
||||||
|
- Client *w, *c = wl_container_of(listener, c, map);
|
||||||
|
+ Client *w, *d, *c = wl_container_of(listener, c, map);
|
||||||
|
Monitor *m;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
@@ -1923,6 +1933,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
c->border[i]->node.data = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ c->dimmer = wlr_scene_rect_create(c->scene, 0, 0, unfocuseddim);
|
||||||
|
+ c->dimmer->node.data = c;
|
||||||
|
+ client_set_dimmer_state(c, 1);
|
||||||
|
+
|
||||||
|
/* Initialize client geometry with room for border */
|
||||||
|
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
|
||||||
|
WLR_EDGE_RIGHT);
|
||||||
|
@@ -1954,6 +1968,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
setmon(c, p->mon, p->tags);
|
||||||
|
} else {
|
||||||
|
applyrules(c);
|
||||||
|
+ d = focustop(selmon);
|
||||||
|
+ if (d) {
|
||||||
|
+ client_set_dimmer_state(d, 0);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
printstatus();
|
||||||
|
|
||||||
|
@@ -2398,7 +2416,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||||
|
c->geom = geo;
|
||||||
|
applybounds(c, bbox);
|
||||||
|
|
||||||
|
- /* Update scene-graph, including borders */
|
||||||
|
+ /* Update scene-graph, including borders and dimmer*/
|
||||||
|
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
|
||||||
|
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||||
|
wlr_scene_rect_set_size(c->border[0], c->geom.width, c->bw);
|
||||||
|
@@ -2408,6 +2426,8 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||||
|
wlr_scene_node_set_position(&c->border[1]->node, 0, c->geom.height - c->bw);
|
||||||
|
wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw);
|
||||||
|
wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw);
|
||||||
|
+ wlr_scene_rect_set_size(c->dimmer, c->geom.width - 2*c->bw, c-> geom.height - 2*c->bw);
|
||||||
|
+ wlr_scene_node_set_position(&c->dimmer->node, c->bw, c->bw);
|
||||||
|
|
||||||
|
client_set_size(c, c->geom.width - 2 * c->bw, c->geom.height - 2 * c->bw);
|
||||||
|
client_get_clip(c, &clip);
|
||||||
|
@@ -2935,6 +2955,27 @@ tile(Monitor *m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void toggledimming(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ DIMOPT ^= 1;
|
||||||
|
+ wl_list_for_each(c, &clients, link)
|
||||||
|
+ {
|
||||||
|
+ client_set_dimmer_state(c, 1);
|
||||||
|
+ }
|
||||||
|
+ c = focustop(selmon);
|
||||||
|
+ if (c)
|
||||||
|
+ client_set_dimmer_state(c, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+toggledimmingclient(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel = focustop(selmon);
|
||||||
|
+ if (sel)
|
||||||
|
+ sel -> neverdim ^= 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
togglefloating(const Arg *arg)
|
||||||
|
{
|
||||||
|
@@ -3237,10 +3278,32 @@ xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
|
struct wlr_scene_node *node;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
int layer;
|
||||||
|
+ struct wlr_scene_node *hidden_dimmers[32];
|
||||||
|
+ int hidden_count = 0;
|
||||||
|
|
||||||
|
for (layer = NUM_LAYERS - 1; !surface && layer >= (locked ? LyrBlock : 0); layer--) {
|
||||||
|
- if (layer == LyrIMPopup ||
|
||||||
|
- !(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny)))
|
||||||
|
+ if (layer == LyrIMPopup)
|
||||||
|
+ continue;
|
||||||
|
+ node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny);
|
||||||
|
+
|
||||||
|
+ while (node && node->type == WLR_SCENE_NODE_RECT && node->data) {
|
||||||
|
+ Client *hit_c = node->data;
|
||||||
|
+ /* Verify the node is actually a client's dimmer */
|
||||||
|
+ if (hit_c->type != LayerShell && hit_c->dimmer && &hit_c->dimmer->node == node) {
|
||||||
|
+ if (hidden_count < 32) {
|
||||||
|
+ wlr_scene_node_set_enabled(node, 0);
|
||||||
|
+ hidden_dimmers[hidden_count++] = node;
|
||||||
|
+ node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for(int i=0; i<hidden_count; i++)
|
||||||
|
+ wlr_scene_node_set_enabled(hidden_dimmers[i], 1);
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (node->type == WLR_SCENE_NODE_BUFFER)
|
||||||
@@ -1 +0,0 @@
|
|||||||
09
|
|
||||||
@@ -4,7 +4,8 @@ Arranges windows in a grid. Except it adjusts the number of windows in the first
|
|||||||
On widescreens (w > 2*h), it splits to three columns before splitting rows.
|
On widescreens (w > 2*h), it splits to three columns before splitting rows.
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid.patch)
|
- [2026-09-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20260927.patch)
|
||||||
|
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20260228.patch)
|
||||||
- [2025-10-31](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20251031.patch)
|
- [2025-10-31](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20251031.patch)
|
||||||
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20240918.patch)
|
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20240918.patch)
|
||||||
- [2024-07-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20240714.patch)
|
- [2024-07-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaplessgrid/gaplessgrid-20240714.patch)
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a4019d3..d596f0c 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -34,6 +34,7 @@ static const Layout layouts[] = {
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
+ { "###", gaplessgrid },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* monitors */
|
||||||
|
@@ -135,6 +136,7 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
+ { MODKEY, XKB_KEY_g, setlayout, {.v = &layouts[3]} },
|
||||||
|
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index cca1ea4..43ab340 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -311,6 +311,7 @@ static void focusstack(const Arg *arg);
|
||||||
|
static Client *focustop(Monitor *m);
|
||||||
|
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||||
|
static void gpureset(struct wl_listener *listener, void *data);
|
||||||
|
+static void gaplessgrid(Monitor *m);
|
||||||
|
static void handlesig(int signo);
|
||||||
|
static void incnmaster(const Arg *arg);
|
||||||
|
static void inputdevice(struct wl_listener *listener, void *data);
|
||||||
|
@@ -1696,6 +1697,56 @@ handlesig(int signo)
|
||||||
|
quit(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+gaplessgrid(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ int n = 0, i = 0, ch, cw, cn, rn, rows, cols;
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each(c, &clients, link)
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating)
|
||||||
|
+ n++;
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* grid dimensions */
|
||||||
|
+ for (cols = 0; cols <= (n / 2); cols++)
|
||||||
|
+ if ((cols * cols) >= n)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if (n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
|
||||||
|
+ cols = 2;
|
||||||
|
+
|
||||||
|
+ /* widescreen is better if 3 columns */
|
||||||
|
+ if (n >= 3 && n <= 6 && (m->w.width / m->w.height) > 1)
|
||||||
|
+ cols = 3;
|
||||||
|
+
|
||||||
|
+ rows = n / cols;
|
||||||
|
+
|
||||||
|
+ /* window geometries */
|
||||||
|
+ cw = cols ? m->w.width / cols : m->w.width;
|
||||||
|
+ cn = 0; /* current column number */
|
||||||
|
+ rn = 0; /* current row number */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ unsigned int cx, cy;
|
||||||
|
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if ((i / rows + 1) > (cols - n % cols))
|
||||||
|
+ rows = n / cols + 1;
|
||||||
|
+ ch = rows ? m->w.height / rows : m->w.height;
|
||||||
|
+ cx = m->w.x + cn * cw;
|
||||||
|
+ cy = m->w.y + rn * ch;
|
||||||
|
+ resize(c, (struct wlr_box) { cx, cy, cw, ch}, 0);
|
||||||
|
+ rn++;
|
||||||
|
+ if (rn >= rows) {
|
||||||
|
+ rn = 0;
|
||||||
|
+ cn++;
|
||||||
|
+ }
|
||||||
|
+ i++;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
incnmaster(const Arg *arg)
|
||||||
|
{
|
||||||
@@ -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
|
||||||
@@ -26,6 +26,7 @@ This patch is inspired from <https://dwm.suckless.org/patches/winview/>. Citing
|
|||||||
> An example of how to insert this line can be found in the default config file template, config.def.h.
|
> An example of how to insert this line can be found in the default config file template, config.def.h.
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
- [2026-09-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview-20260927.patch)
|
||||||
- [2026-03-14 dwl 0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview_dwl_08.patch)
|
- [2026-03-14 dwl 0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview_dwl_08.patch)
|
||||||
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview_dwl_07.patch)
|
- [2024-09-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview_dwl_07.patch)
|
||||||
- [2024-06-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview-20240606.patch)
|
- [2024-06-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/winview/winview-20240606.patch)
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a4019d3..9cbdfe3 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -139,6 +139,7 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||||
|
+ { MODKEY, XKB_KEY_o, winview, {0} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_0, tag, {.ui = ~0} },
|
||||||
|
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index cca1ea4..d3a8d62 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -370,6 +370,7 @@ static void urgent(struct wl_listener *listener, void *data);
|
||||||
|
static void view(const Arg *arg);
|
||||||
|
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||||
|
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||||
|
+static void winview(const Arg *a);
|
||||||
|
static Monitor *xytomon(double x, double y);
|
||||||
|
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
|
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||||
|
@@ -3223,6 +3224,17 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||||
|
wlr_seat_set_capabilities(seat, seat->capabilities | WL_SEAT_CAPABILITY_POINTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+winview(const Arg *a) {
|
||||||
|
+ Arg b = {0};
|
||||||
|
+ Client *sel = focustop(selmon);
|
||||||
|
+ if(!sel)
|
||||||
|
+ return;
|
||||||
|
+ b.ui = sel -> tags;
|
||||||
|
+ view(&b);
|
||||||
|
+ return;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Monitor *
|
||||||
|
xytomon(double x, double y)
|
||||||
|
{
|
||||||
Reference in New Issue
Block a user