mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-26 17:54:17 +00:00
update my patches
This commit is contained in:
parent
2d1d755897
commit
b34818c2b4
@ -1,27 +0,0 @@
|
||||
### Description
|
||||
All floating windows are centered, like the center patch, but without a rule.
|
||||
|
||||
|
||||
### Changelog
|
||||
|
||||
2023-11-24:
|
||||
- A variable `center_relative_to_monitor` has been added, allowing the user to choose whether to center relative to the monitor or relative to the window area.
|
||||
|
||||
<details>
|
||||
<summary>Explanation of center_relative_to_monitor:</summary>
|
||||
<pre>
|
||||
The "Monitor area" refers to the space enclosed by the green rectangle, while the "Window area" refers to the space enclosed by the red
|
||||
rectangle.
|
||||
<img src="https://i.imgur.com/xhejzPh.png"/>
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
### Download
|
||||
- [2023-11-24](https://github.com/djpohly/dwl/compare/main...wochap:alwayscenter.patch)
|
||||
- [2023-09-02](https://github.com/djpohly/dwl/compare/main...mortezadadgar:alwayscenter.patch)
|
||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-alwayscenter.patch)
|
||||
- [2021-04-17](https://github.com/djpohly/dwl/compare/main...guidocella:alwayscenter.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocell)
|
||||
- [wochap](https://github.com/wochap)
|
||||
@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Add a keybinding that toggles centering Alacritty horizontally when it's the only window, while still tiling multiple windows.
|
||||
|
||||
### Download
|
||||
- [2020-12-14](https://github.com/djpohly/dwl/compare/main...guidocella:center-terminal.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocell)
|
||||
@ -9,4 +9,4 @@ Makes layout, mwfact and nmaster individual for every tag.
|
||||
- [2022-03-20](https://github.com/djpohly/dwl/compare/main...guidocella:pertag.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocella)
|
||||
- [Bonicgamer](https://github.com/Bonicgamer)
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds `shiftview` function that allows to cycle through tags.
|
||||
|
||||
### Download
|
||||
- [2022-07-06](https://github.com/djpohly/dwl/compare/main...guidocella:shiftview.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocella)
|
||||
@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds a rule option to switch to the configured tag when a window opens, then switch back when it closes.
|
||||
|
||||
### Download
|
||||
- [2021-04-17](https://github.com/djpohly/dwl/compare/main...guidocella:switchtotag.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocella)
|
||||
25
alwayscenter/alwayscenter.patch
Normal file
25
alwayscenter/alwayscenter.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 6f241273b58643396fd052027c8cde6f815376c8 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 16 Jan 2024 18:14:50 +0100
|
||||
Subject: [PATCH] center floating windows
|
||||
|
||||
---
|
||||
dwl.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index f25ac2f..9058ce2 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -450,6 +450,8 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
}
|
||||
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
|
||||
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
|
||||
102
center-terminal/center-terminal.patch
Normal file
102
center-terminal/center-terminal.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 24710beb90ecd512f36510ffbd95b45076be5873 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 16 Jan 2024 18:49:59 +0100
|
||||
Subject: [PATCH] add a keybinding to center the terminal
|
||||
|
||||
Add a keybinding that toggles centering the terminally horizontally when
|
||||
it's the only window, while still tiling multiple windows.
|
||||
|
||||
This limits the width of long text making it easier to read, and avoids
|
||||
covering the wallpaper more than necessary.
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 19 +++++++++++++++++++
|
||||
2 files changed, 20 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a85ca27..2055df9 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -139,6 +139,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
+ { MODKEY, XKB_KEY_v, togglecenter, {0} },
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 8ecdeb0..559c726 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <strings.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@@ -134,6 +135,7 @@ typedef struct {
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
+ bool centered;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
} Client;
|
||||
|
||||
@@ -318,6 +320,7 @@ 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 togglecenter(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
@@ -389,6 +392,8 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
+static bool center;
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -455,6 +460,8 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
||||
+ if (!strcasecmp(appid, termcmd[0]))
|
||||
+ c->centered = true;
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
|
||||
@@ -2509,6 +2516,11 @@ tile(Monitor *m)
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
+ if (n == 1 && center && c->centered) {
|
||||
+ resize(c, (struct wlr_box){.x = m->w.width / 4, .y = m->w.y,
|
||||
+ .width = m->w.width / 2, .height = m->w.height - 2 * c->bw}, 0);
|
||||
+ return;
|
||||
+ }
|
||||
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||
my += c->geom.height;
|
||||
@@ -2521,6 +2533,13 @@ tile(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+togglecenter(const Arg *arg)
|
||||
+{
|
||||
+ center = !center;
|
||||
+ tile(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
togglefloating(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.43.0
|
||||
|
||||
77
shiftview/shiftview.patch
Normal file
77
shiftview/shiftview.patch
Normal file
@ -0,0 +1,77 @@
|
||||
From 1bfd33f2429f99090bfde96ef26c9e028ef8ed9a Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 16 Jan 2024 18:53:51 +0100
|
||||
Subject: [PATCH] cycle through tags
|
||||
|
||||
---
|
||||
config.def.h | 4 ++++
|
||||
shiftview.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 39 insertions(+)
|
||||
create mode 100644 shiftview.c
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..8d77ec0 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -117,6 +117,8 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
static const char *termcmd[] = { "foot", NULL };
|
||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
||||
|
||||
+#include "shiftview.c"
|
||||
+
|
||||
static const Key keys[] = {
|
||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||
/* modifier key function argument */
|
||||
@@ -130,6 +132,8 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||
+ { MODKEY, XKB_KEY_a, shiftview, { .i = -1 } },
|
||||
+ { MODKEY, XKB_KEY_semicolon, shiftview, { .i = 1 } },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
diff --git a/shiftview.c b/shiftview.c
|
||||
new file mode 100644
|
||||
index 0000000..2275564
|
||||
--- /dev/null
|
||||
+++ b/shiftview.c
|
||||
@@ -0,0 +1,35 @@
|
||||
+// "arg->i" stores the number of tags to shift right (positive value)
|
||||
+// or left (negative value)
|
||||
+void
|
||||
+shiftview(const Arg *arg)
|
||||
+{
|
||||
+ Arg a;
|
||||
+ Client *c;
|
||||
+ size_t ntags = tagcount;
|
||||
+ bool visible = false;
|
||||
+ int i = arg->i;
|
||||
+ int count = 0;
|
||||
+ int nextseltags, curseltags = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ do {
|
||||
+ if (i > 0) // left circular shift
|
||||
+ nextseltags = (curseltags << i) | (curseltags >> (ntags - i));
|
||||
+ else // right circular shift
|
||||
+ nextseltags = curseltags >> (-i) | (curseltags << (ntags + i));
|
||||
+
|
||||
+ // Check if the tag is visible
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (c->mon == selmon && nextseltags & c->tags) {
|
||||
+ visible = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ i += arg->i;
|
||||
+ } while (!visible && ++count <= ntags);
|
||||
+
|
||||
+ if (count <= ntags) {
|
||||
+ a.i = nextseltags;
|
||||
+ view(&a);
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.43.0
|
||||
|
||||
77
switchtotag/switchtotag.patch
Normal file
77
switchtotag/switchtotag.patch
Normal file
@ -0,0 +1,77 @@
|
||||
From b7618500ee1cf95f2e264cb0380b5332a79ffacb Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 16 Jan 2024 18:58:34 +0100
|
||||
Subject: [PATCH] allow switching to the configured tag when a window opens
|
||||
|
||||
Add a rule option to switch to the configured tag when a window opens,
|
||||
then switch back when it closes.
|
||||
---
|
||||
config.def.h | 6 +++---
|
||||
dwl.c | 11 +++++++++++
|
||||
2 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..055ec93 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -21,11 +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 switchtotag isfloating monitor */
|
||||
/* examples:
|
||||
- { "Gimp", NULL, 0, 1, -1 },
|
||||
+ { "Gimp", NULL, 0, 0, 1, -1 },
|
||||
+ { "firefox", NULL, 1 << 8, 1, 0, -1 },
|
||||
*/
|
||||
- { "firefox", NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index f25ac2f..2874dc9 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -134,6 +134,7 @@ typedef struct {
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
+ int switchtotag;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
} Client;
|
||||
|
||||
@@ -217,6 +218,7 @@ typedef struct {
|
||||
const char *id;
|
||||
const char *title;
|
||||
uint32_t tags;
|
||||
+ bool switchtotag;
|
||||
int isfloating;
|
||||
int monitor;
|
||||
} Rule;
|
||||
@@ -448,6 +450,11 @@ applyrules(Client *c)
|
||||
if (r->monitor == i++)
|
||||
mon = m;
|
||||
}
|
||||
+ if (r->switchtotag) {
|
||||
+ c->switchtotag = selmon->tagset[selmon->seltags];
|
||||
+ mon->seltags ^= 1;
|
||||
+ mon->tagset[selmon->seltags] = r->tags & TAGMASK;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
||||
@@ -2577,6 +2584,10 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||
wlr_scene_node_destroy(&c->scene->node);
|
||||
printstatus();
|
||||
motionnotify(0);
|
||||
+ if (c->switchtotag) {
|
||||
+ Arg a = { .ui = c->switchtotag };
|
||||
+ view(&a);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.43.0
|
||||
|
||||
26
toggle-layout-immediately/toggle-layout-immediately.patch
Normal file
26
toggle-layout-immediately/toggle-layout-immediately.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 03a35fec47bd1a42b75b3373e15d0649ad562267 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 16 Jan 2024 19:11:18 +0100
|
||||
Subject: [PATCH] allow toggling the layout before selecting a different one
|
||||
|
||||
---
|
||||
dwl.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index f25ac2f..49364f8 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -865,7 +865,8 @@ createmon(struct wl_listener *listener, void *data)
|
||||
m->m.y = r->y;
|
||||
m->mfact = r->mfact;
|
||||
m->nmaster = r->nmaster;
|
||||
- m->lt[0] = m->lt[1] = r->lt;
|
||||
+ m->lt[0] = r->lt;
|
||||
+ m->lt[1] = &layouts[LENGTH(layouts) > 1 && r->lt != &layouts[1]];
|
||||
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
|
||||
wlr_output_state_set_scale(&state, r->scale);
|
||||
wlr_output_state_set_transform(&state, r->rr);
|
||||
--
|
||||
2.43.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user