mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-09-19 05:42:51 +00:00
update center-terminal
This commit is contained in:
@@ -7,7 +7,7 @@ covering the wallpaper more than necessary.
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/center-terminal)
|
||||
- [2026-02-09](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch)
|
||||
- [2026-09-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://codeberg.org/guidocella)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 897765216ac8567a40654b813379a4e074ca6298 Mon Sep 17 00:00:00 2001
|
||||
From 974db1c4a01a38e2c2af9460e4d9c5f48e7974f7 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Mon, 9 Feb 2026 10:21:33 +0100
|
||||
Subject: [PATCH] add a keybinding to center the terminal
|
||||
@@ -14,7 +14,7 @@ covering the wallpaper more than necessary.
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8a6eda0..8c35c40 100644
|
||||
index 13c5322..aef03cb 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -138,6 +138,7 @@ static const Key keys[] = {
|
||||
@@ -23,13 +23,13 @@ index 8a6eda0..8c35c40 100644
|
||||
{ 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|WLR_MODIFIER_SHIFT, XKB_KEY_0, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 44f3ad9..9ee397a 100644
|
||||
index f7bda0b..cfdd4d1 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -37,15 +37,15 @@ index 44f3ad9..9ee397a 100644
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@@ -138,6 +139,7 @@ typedef struct {
|
||||
@@ -158,6 +159,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;
|
||||
|
||||
@@ -334,6 +336,7 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||
typedef struct {
|
||||
@@ -354,6 +356,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);
|
||||
@@ -53,16 +53,16 @@ index 44f3ad9..9ee397a 100644
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
@@ -436,6 +439,8 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
|
||||
static struct wl_listener start_drag = {.notify = startdrag};
|
||||
@@ -460,6 +463,8 @@ static struct wl_listener start_drag = {.notify = startdrag};
|
||||
static struct wl_listener new_session_lock = {.notify = locksession};
|
||||
static struct wl_listener new_foreign_toplevel_capture_request = {.notify = capturerequest};
|
||||
|
||||
+static bool center;
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -499,6 +504,9 @@ applyrules(Client *c)
|
||||
@@ -534,6 +539,9 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ index 44f3ad9..9ee397a 100644
|
||||
c->isfloating |= client_is_float_type(c);
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
@@ -2731,6 +2739,11 @@ tile(Monitor *m)
|
||||
@@ -2886,6 +2894,11 @@ tile(Monitor *m)
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
@@ -84,7 +84,7 @@ index 44f3ad9..9ee397a 100644
|
||||
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;
|
||||
@@ -2743,6 +2756,13 @@ tile(Monitor *m)
|
||||
@@ -2898,6 +2911,13 @@ tile(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,5 +99,5 @@ index 44f3ad9..9ee397a 100644
|
||||
togglefloating(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.52.0
|
||||
2.55.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user