update center-terminal, shiftview, switchtotag

This commit is contained in:
Guido Cella 2026-02-09 10:30:29 +01:00
parent 2e03d8ec91
commit 59212b702c
6 changed files with 52 additions and 53 deletions

View File

@ -7,7 +7,7 @@ covering the wallpaper more than necessary.
### Download ### Download
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/center-terminal) - [git branch](https://codeberg.org/guidocella/dwl/src/branch/center-terminal)
- [2024-02-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch) - [2026-02-09](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch)
### Authors ### Authors
- [Guido Cella](https://codeberg.org/guidocella) - [Guido Cella](https://codeberg.org/guidocella)

View File

@ -1,6 +1,6 @@
From 340cc5ef90dfcc495bdad045f3f76ae07405cffd Mon Sep 17 00:00:00 2001 From 897765216ac8567a40654b813379a4e074ca6298 Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Tue, 6 Feb 2024 09:20:48 +0100 Date: Mon, 9 Feb 2026 10:21:33 +0100
Subject: [PATCH] add a keybinding to center the terminal Subject: [PATCH] add a keybinding to center the terminal
Add a keybinding that toggles centering the terminally horizontally when Add a keybinding that toggles centering the terminally horizontally when
@ -14,19 +14,19 @@ covering the wallpaper more than necessary.
2 files changed, 21 insertions(+) 2 files changed, 21 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 22d2171..8229fcc 100644 index 8a6eda0..8c35c40 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -142,6 +142,7 @@ static const Key keys[] = { @@ -138,6 +138,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_space, setlayout, {0} }, { MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} }, { MODKEY, XKB_KEY_e, togglefullscreen, {0} },
+ { MODKEY, XKB_KEY_v, togglecenter, {0} }, + { MODKEY, XKB_KEY_v, togglecenter, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} }, { MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 12f441e..3b15748 100644 index 44f3ad9..9ee397a 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
@ -72,7 +72,7 @@ index 12f441e..3b15748 100644
c->isfloating |= client_is_float_type(c); c->isfloating |= client_is_float_type(c);
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
@@ -2730,6 +2738,11 @@ tile(Monitor *m) @@ -2731,6 +2739,11 @@ tile(Monitor *m)
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue; continue;
if (i < m->nmaster) { if (i < m->nmaster) {
@ -84,7 +84,7 @@ index 12f441e..3b15748 100644
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw, 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); .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
my += c->geom.height; my += c->geom.height;
@@ -2742,6 +2755,13 @@ tile(Monitor *m) @@ -2743,6 +2756,13 @@ tile(Monitor *m)
} }
} }
@ -99,5 +99,5 @@ index 12f441e..3b15748 100644
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
-- --
2.49.0 2.52.0

View File

@ -3,7 +3,7 @@ Add keybindings to cycle through tags with visible clients.
### Download ### Download
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/shiftview) - [git branch](https://codeberg.org/guidocella/dwl/src/branch/shiftview)
- [2024-01-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/shiftview/shiftview.patch) - [2026-02-09](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/shiftview/shiftview.patch)
### Authors ### Authors
- [Guido Cella](https://codeberg.org/guidocella) - [Guido Cella](https://codeberg.org/guidocella)

View File

@ -1,4 +1,4 @@
From 40f9140742277d0298988990264f4b6a738f8122 Mon Sep 17 00:00:00 2001 From ce4217d8ee9c28ba76ca34fae7a7c3ef1aceecb0 Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Sat, 27 Jan 2024 22:43:29 +0100 Date: Sat, 27 Jan 2024 22:43:29 +0100
Subject: [PATCH] cycle through tags Subject: [PATCH] cycle through tags
@ -10,27 +10,27 @@ Subject: [PATCH] cycle through tags
create mode 100644 shiftview.c create mode 100644 shiftview.c
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 9009517..8d77ec0 100644 index 8a6eda0..fd80703 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -117,6 +117,8 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA @@ -118,6 +118,8 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
static const char *termcmd[] = { "foot", NULL }; static const char *termcmd[] = { "foot", NULL };
static const char *menucmd[] = { "bemenu-run", NULL }; static const char *menucmd[] = { "wmenu-run", NULL };
+#include "shiftview.c" +#include "shiftview.c"
+ +
static const Key keys[] = { static const Key keys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ /* Note that Shift changes certain key codes: 2 -> at, etc. */
/* modifier key function argument */ /* modifier key function argument */
@@ -130,6 +132,8 @@ static const Key keys[] = { @@ -131,6 +133,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} }, { MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} }, { MODKEY, XKB_KEY_Tab, view, {0} },
+ { MODKEY, XKB_KEY_a, shiftview, { .i = -1 } }, + { MODKEY, XKB_KEY_a, shiftview, { .i = -1 } },
+ { MODKEY, XKB_KEY_semicolon, shiftview, { .i = 1 } }, + { MODKEY, XKB_KEY_semicolon, shiftview, { .i = 1 } },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_c, killclient, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
diff --git a/shiftview.c b/shiftview.c diff --git a/shiftview.c b/shiftview.c
new file mode 100644 new file mode 100644
index 0000000..fa53db0 index 0000000..fa53db0
@ -72,5 +72,5 @@ index 0000000..fa53db0
+ } + }
+} +}
-- --
2.43.0 2.52.0

View File

@ -3,7 +3,7 @@ Add a rule option to switch to the configured tag when a window opens, then swit
### Download ### Download
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/switchtotag) - [git branch](https://codeberg.org/guidocella/dwl/src/branch/switchtotag)
- [2024-09-30](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/switchtotag/switchtotag.patch) - [2026-02-09](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/switchtotag/switchtotag.patch)
### Authors ### Authors
- [Guido Cella](https://codeberg.org/guidocella) - [Guido Cella](https://codeberg.org/guidocella)

View File

@ -1,4 +1,4 @@
From 08cfc2eceb34316cfd7eaf591a8a631e3d58ff3a Mon Sep 17 00:00:00 2001 From bfcfb26b00cb93a359469cb8817861439818b430 Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Mon, 30 Sep 2024 08:40:25 +0200 Date: Mon, 30 Sep 2024 08:40:25 +0200
Subject: [PATCH] allow switching to the configured tag when a window opens Subject: [PATCH] allow switching to the configured tag when a window opens
@ -11,28 +11,27 @@ then switch back when it closes.
2 files changed, 22 insertions(+), 7 deletions(-) 2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 22d2171..52ea128 100644 index 8a6eda0..59e3ac5 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -22,10 +22,10 @@ static int log_level = WLR_ERROR; @@ -21,9 +21,9 @@ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You ca
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[] = { static const Rule rules[] = {
- /* app_id title tags mask isfloating monitor */ - /* app_id title tags mask isfloating monitor */
+ /* app_id title tags mask switchtotag isfloating monitor */
/* examples: */
- { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */ - { "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" */ - { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
+ { "Gimp_EXAMPLE", NULL, 0, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */ + /* app_id title tags mask switchtotag isfloating monitor */
+ { "firefox_EXAMPLE", NULL, 1 << 8, 1, 0, -1 }, /* Start on ONLY tag "9" */ + { "Gimp_EXAMPLE", NULL, 0, 0 1, -1 }, /* Start on currently visible tags floating, not tiled */
+ { "firefox_EXAMPLE", NULL, 1 << 8, 1 0, -1 }, /* Start on ONLY tag "9" */
/* default/example rule: can be changed but cannot be eliminated; at least one rule must exist */
}; };
/* layout(s) */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index dc0c861..621b614 100644 index 44f3ad9..7a97d94 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -142,6 +142,7 @@ typedef struct { @@ -138,6 +138,7 @@ typedef struct {
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
@ -40,7 +39,7 @@ index dc0c861..621b614 100644
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -230,6 +231,7 @@ typedef struct { @@ -226,6 +227,7 @@ typedef struct {
const char *id; const char *id;
const char *title; const char *title;
uint32_t tags; uint32_t tags;
@ -48,7 +47,7 @@ index dc0c861..621b614 100644
int isfloating; int isfloating;
int monitor; int monitor;
} Rule; } Rule;
@@ -245,7 +247,7 @@ typedef struct { @@ -241,7 +243,7 @@ typedef struct {
/* function declarations */ /* function declarations */
static void applybounds(Client *c, struct wlr_box *bbox); static void applybounds(Client *c, struct wlr_box *bbox);
@ -57,7 +56,7 @@ index dc0c861..621b614 100644
static void arrange(Monitor *m); static void arrange(Monitor *m);
static void arrangelayer(Monitor *m, struct wl_list *list, static void arrangelayer(Monitor *m, struct wl_list *list,
struct wlr_box *usable_area, int exclusive); struct wlr_box *usable_area, int exclusive);
@@ -449,7 +451,7 @@ applybounds(Client *c, struct wlr_box *bbox) @@ -474,7 +476,7 @@ applybounds(Client *c, struct wlr_box *bbox)
} }
void void
@ -66,7 +65,7 @@ index dc0c861..621b614 100644
{ {
/* rule matching */ /* rule matching */
const char *appid, *title; const char *appid, *title;
@@ -472,6 +474,11 @@ applyrules(Client *c) @@ -496,6 +498,11 @@ applyrules(Client *c)
if (r->monitor == i++) if (r->monitor == i++)
mon = m; mon = m;
} }
@ -77,9 +76,9 @@ index dc0c861..621b614 100644
+ } + }
} }
} }
setmon(c, mon, newtags);
@@ -795,7 +802,7 @@ commitnotify(struct wl_listener *listener, void *data) @@ -864,7 +871,7 @@ commitnotify(struct wl_listener *listener, void *data)
* a different monitor based on its title this will likely select * a different monitor based on its title, this will likely select
* a wrong monitor. * a wrong monitor.
*/ */
- applyrules(c); - applyrules(c);
@ -87,7 +86,7 @@ index dc0c861..621b614 100644
if (c->mon) { if (c->mon) {
client_set_scale(client_surface(c), c->mon->wlr_output->scale); client_set_scale(client_surface(c), c->mon->wlr_output->scale);
} }
@@ -1733,7 +1740,7 @@ mapnotify(struct wl_listener *listener, void *data) @@ -1790,7 +1797,7 @@ mapnotify(struct wl_listener *listener, void *data)
c->isfloating = 1; c->isfloating = 1;
setmon(c, p->mon, p->tags); setmon(c, p->mon, p->tags);
} else { } else {
@ -96,7 +95,7 @@ index dc0c861..621b614 100644
} }
printstatus(); printstatus();
@@ -2769,6 +2776,14 @@ unmapnotify(struct wl_listener *listener, void *data) @@ -2831,6 +2838,14 @@ unmapnotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->flink); wl_list_remove(&c->flink);
} }
@ -112,5 +111,5 @@ index dc0c861..621b614 100644
printstatus(); printstatus();
motionnotify(0, NULL, 0, 0, 0, 0); motionnotify(0, NULL, 0, 0, 0, 0);
-- --
2.46.0 2.52.0