center-terminal: rebase

This commit is contained in:
Guido Cella 2025-01-27 12:19:12 +01:00
parent 4a869141fa
commit a727409aca

View File

@ -1,4 +1,4 @@
From 5646d7e7d933a2e7a667767c3fde89c91697c4ea Mon Sep 17 00:00:00 2001 From dfaafc1624438d2157cbb15b496e8177544491e0 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: Tue, 6 Feb 2024 09:20:48 +0100
Subject: [PATCH] add a keybinding to center the terminal Subject: [PATCH] add a keybinding to center the terminal
@ -14,10 +14,10 @@ covering the wallpaper more than necessary.
2 files changed, 20 insertions(+) 2 files changed, 20 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a85ca27..2055df9 100644 index 22d2171..8229fcc 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -139,6 +139,7 @@ static const Key keys[] = { @@ -142,6 +142,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} },
@ -26,10 +26,10 @@ index a85ca27..2055df9 100644
{ 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 002349a..4582413 100644 index ad21e1b..b126b32 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -7,6 +7,7 @@ @@ -8,6 +8,7 @@
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -37,7 +37,7 @@ index 002349a..4582413 100644
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@@ -135,6 +136,7 @@ typedef struct { @@ -138,6 +139,7 @@ typedef struct {
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
@ -45,7 +45,7 @@ index 002349a..4582413 100644
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -319,6 +321,7 @@ static void startdrag(struct wl_listener *listener, void *data); @@ -334,6 +336,7 @@ static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg); static void tag(const Arg *arg);
static void tagmon(const Arg *arg); static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
@ -53,16 +53,16 @@ index 002349a..4582413 100644
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
@@ -392,6 +395,8 @@ static struct wlr_box sgeom; @@ -436,6 +439,8 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
static struct wl_list mons; static struct wl_listener start_drag = {.notify = startdrag};
static Monitor *selmon; static struct wl_listener new_session_lock = {.notify = locksession};
+static bool center; +static bool center;
+ +
#ifdef XWAYLAND #ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data); static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data);
@@ -457,6 +462,8 @@ applyrules(Client *c) @@ -499,6 +504,8 @@ applyrules(Client *c)
} }
} }
} }
@ -71,7 +71,7 @@ index 002349a..4582413 100644
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
@@ -2519,6 +2526,11 @@ tile(Monitor *m) @@ -2720,6 +2727,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) {
@ -83,7 +83,7 @@ index 002349a..4582413 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;
@@ -2531,6 +2543,13 @@ tile(Monitor *m) @@ -2732,6 +2744,13 @@ tile(Monitor *m)
} }
} }
@ -98,5 +98,5 @@ index 002349a..4582413 100644
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
-- --
2.43.0 2.47.1