mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-06-10 03:01:34 -04:00
my-dwl patches
This commit is contained in:
parent
a2d03cf618
commit
20173e837f
7 changed files with 8797 additions and 0 deletions
1
patches/btrtile-v0.7-gaps.patch
Normal file
1
patches/btrtile-v0.7-gaps.patch
Normal file
|
|
@ -0,0 +1 @@
|
|||
Not found.
|
||||
8239
patches/btrtile-v0.8-gaps.patch
Normal file
8239
patches/btrtile-v0.8-gaps.patch
Normal file
File diff suppressed because it is too large
Load diff
98
patches/focusdir.patch
Normal file
98
patches/focusdir.patch
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
From a0e71a687b7fcaebdaf1da80c09bf5563bff46b1 Mon Sep 17 00:00:00 2001
|
||||
From: ldev <ldev@ldev.eu.org>
|
||||
Date: Mon, 12 Feb 2024 21:50:24 +0100
|
||||
Subject: [PATCH] focusdir
|
||||
|
||||
---
|
||||
config.def.h | 4 ++++
|
||||
dwl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 49 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..2a1a82e 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -124,6 +124,10 @@ static const Key keys[] = {
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_h, focusdir, {.ui = 0} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_l, focusdir, {.ui = 1} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_k, focusdir, {.ui = 2} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_j, focusdir, {.ui = 3} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf02a6d..64d5de7 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* See LICENSE file for copyright and license details.
|
||||
*/
|
||||
+#include <limits.h>
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
@@ -268,6 +269,7 @@ static Monitor *dirtomon(enum wlr_direction dir);
|
||||
static void focusclient(Client *c, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
+static void focusdir(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void handlesig(int signo);
|
||||
@@ -1271,6 +1273,49 @@ focusstack(const Arg *arg)
|
||||
focusclient(c, 1);
|
||||
}
|
||||
|
||||
+void focusdir(const Arg *arg)
|
||||
+{
|
||||
+ /* Focus the left, right, up, down client relative to the current focused client on selmon */
|
||||
+ Client *c, *sel = focustop(selmon);
|
||||
+ if (!sel || sel->isfullscreen)
|
||||
+ return;
|
||||
+
|
||||
+ int dist=INT_MAX;
|
||||
+ Client *newsel = NULL;
|
||||
+ int newdist=INT_MAX;
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (!VISIBLEON(c, selmon))
|
||||
+ continue; /* skip non visible windows */
|
||||
+
|
||||
+ if (arg->ui == 0 && sel->geom.x <= c->geom.x) {
|
||||
+ /* Client isn't on our left */
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (arg->ui == 1 && sel->geom.x >= c->geom.x) {
|
||||
+ /* Client isn't on our right */
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (arg->ui == 2 && sel->geom.y <= c->geom.y) {
|
||||
+ /* Client isn't above us */
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (arg->ui == 3 && sel->geom.y >= c->geom.y) {
|
||||
+ /* Client isn't below us */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ dist=abs(sel->geom.x-c->geom.x)+abs(sel->geom.y-c->geom.y);
|
||||
+ if (dist < newdist){
|
||||
+ newdist = dist;
|
||||
+ newsel=c;
|
||||
+ }
|
||||
+ }
|
||||
+ if (newsel != NULL){
|
||||
+ focusclient(newsel, 1);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* We probably should change the name of this, it sounds like
|
||||
* will focus the topmost client of this mon, when actually will
|
||||
* only return that client */
|
||||
--
|
||||
2.43.0
|
||||
|
||||
127
patches/gaps.patch
Normal file
127
patches/gaps.patch
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
From 50e3dd4746b6cb719efb9f8213b94ac52a5320d9 Mon Sep 17 00:00:00 2001
|
||||
From: peesock <kcormn@gmail.com>
|
||||
Date: Mon, 24 Jun 2024 20:06:42 -0700
|
||||
Subject: [PATCH] gaps!
|
||||
|
||||
Co-authored-by: sewn <sewn@disroot.org>
|
||||
Co-authored-by: serenevoid <ajuph9224@gmail.com>
|
||||
---
|
||||
config.def.h | 4 ++++
|
||||
dwl.c | 34 ++++++++++++++++++++++++++--------
|
||||
2 files changed, 30 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..b388b4e 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -6,6 +6,9 @@
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
+static int gaps = 1; /* 1 means gaps between windows are added */
|
||||
+static const unsigned int gappx = 10; /* gap pixel between windows */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const float rootcolor[] = COLOR(0x222222ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
@@ -135,6 +138,7 @@ 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_g, togglegaps, {0} },
|
||||
{ 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/dwl.c b/dwl.c
|
||||
index dc0437e..dc851df 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -199,6 +199,7 @@ struct Monitor {
|
||||
struct wlr_box w; /* window area, layout-relative */
|
||||
struct wl_list layers[4]; /* LayerSurface.link */
|
||||
const Layout *lt[2];
|
||||
+ int gaps;
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
uint32_t tagset[2];
|
||||
@@ -336,6 +337,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
+static void togglegaps(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -949,6 +951,8 @@ createmon(struct wl_listener *listener, void *data)
|
||||
|
||||
wlr_output_state_init(&state);
|
||||
/* Initialize monitor state using configured rules */
|
||||
+ m->gaps = gaps;
|
||||
+
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
for (r = monrules; r < END(monrules); r++) {
|
||||
if (!r->name || strstr(wlr_output->name, r->name)) {
|
||||
@@ -2638,7 +2642,7 @@ tagmon(const Arg *arg)
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
- unsigned int mw, my, ty;
|
||||
+ unsigned int h, r, e = m->gaps, mw, my, ty;
|
||||
int i, n = 0;
|
||||
Client *c;
|
||||
|
||||
@@ -2647,23 +2651,30 @@ tile(Monitor *m)
|
||||
n++;
|
||||
if (n == 0)
|
||||
return;
|
||||
+ if (smartgaps == n)
|
||||
+ e = 0;
|
||||
|
||||
if (n > m->nmaster)
|
||||
- mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||
+ mw = m->nmaster ? (int)roundf((m->w.width + gappx*e) * m->mfact) : 0;
|
||||
else
|
||||
mw = m->w.width;
|
||||
- i = my = ty = 0;
|
||||
+ i = 0;
|
||||
+ my = ty = gappx*e;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
- 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;
|
||||
+ r = MIN(n, m->nmaster) - i;
|
||||
+ h = (m->w.height - my - gappx*e - gappx*e * (r - 1)) / r;
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x + gappx*e, .y = m->w.y + my,
|
||||
+ .width = mw - 2*gappx*e, .height = h}, 0);
|
||||
+ my += c->geom.height + gappx*e;
|
||||
} else {
|
||||
+ r = n - i;
|
||||
+ h = (m->w.height - ty - gappx*e - gappx*e * (r - 1)) / r;
|
||||
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
|
||||
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
|
||||
- ty += c->geom.height;
|
||||
+ .width = m->w.width - mw - gappx*e, .height = h}, 0);
|
||||
+ ty += c->geom.height + gappx*e;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -2686,6 +2697,13 @@ togglefullscreen(const Arg *arg)
|
||||
setfullscreen(sel, !sel->isfullscreen);
|
||||
}
|
||||
|
||||
+void
|
||||
+togglegaps(const Arg *arg)
|
||||
+{
|
||||
+ selmon->gaps = !selmon->gaps;
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.45.2
|
||||
|
||||
170
patches/pertag.patch
Normal file
170
patches/pertag.patch
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
From d3b551ffe3ec85e16341962e322150b81af6722f Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 31 Jul 2024 08:27:26 -0500
|
||||
Subject: [PATCH] makes layout, mwfact and nmaster individual for every tag
|
||||
|
||||
inspiration: https://github.com/djpohly/dwl/wiki/pertag
|
||||
---
|
||||
dwl.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 70 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 145fd01..2f364bc 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -102,6 +102,7 @@ typedef struct {
|
||||
const Arg arg;
|
||||
} Button;
|
||||
|
||||
+typedef struct Pertag Pertag;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
@@ -199,6 +200,7 @@ struct Monitor {
|
||||
struct wlr_box w; /* window area, layout-relative */
|
||||
struct wl_list layers[4]; /* LayerSurface.link */
|
||||
const Layout *lt[2];
|
||||
+ Pertag *pertag;
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
uint32_t tagset[2];
|
||||
@@ -427,6 +429,14 @@ static xcb_atom_t netatom[NetLast];
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
|
||||
+struct Pertag {
|
||||
+ unsigned int curtag, prevtag; /* current and previous tag */
|
||||
+ int nmasters[TAGCOUNT + 1]; /* number of windows in master area */
|
||||
+ float mfacts[TAGCOUNT + 1]; /* mfacts per tag */
|
||||
+ unsigned int sellts[TAGCOUNT + 1]; /* selected layouts */
|
||||
+ const Layout *ltidxs[TAGCOUNT + 1][2]; /* matrix of tags and layouts indexes */
|
||||
+};
|
||||
+
|
||||
/* function implementations */
|
||||
void
|
||||
applybounds(Client *c, struct wlr_box *bbox)
|
||||
@@ -712,6 +722,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||
wlr_scene_output_destroy(m->scene_output);
|
||||
|
||||
+ free(m->pertag);
|
||||
closemon(m);
|
||||
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||
free(m);
|
||||
@@ -983,6 +994,18 @@ createmon(struct wl_listener *listener, void *data)
|
||||
wl_list_insert(&mons, &m->link);
|
||||
printstatus();
|
||||
|
||||
+ m->pertag = calloc(1, sizeof(Pertag));
|
||||
+ m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
+
|
||||
+ for (i = 0; i <= TAGCOUNT; i++) {
|
||||
+ m->pertag->nmasters[i] = m->nmaster;
|
||||
+ m->pertag->mfacts[i] = m->mfact;
|
||||
+
|
||||
+ m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
+ m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
+ m->pertag->sellts[i] = m->sellt;
|
||||
+ }
|
||||
+
|
||||
/* The xdg-protocol specifies:
|
||||
*
|
||||
* If the fullscreened surface is not opaque, the compositor must make
|
||||
@@ -1472,7 +1495,7 @@ incnmaster(const Arg *arg)
|
||||
{
|
||||
if (!arg || !selmon)
|
||||
return;
|
||||
- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -2305,9 +2328,9 @@ setlayout(const Arg *arg)
|
||||
if (!selmon)
|
||||
return;
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
- selmon->sellt ^= 1;
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
if (arg && arg->v)
|
||||
- selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
@@ -2324,7 +2347,7 @@ setmfact(const Arg *arg)
|
||||
f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f;
|
||||
if (f < 0.1 || f > 0.9)
|
||||
return;
|
||||
- selmon->mfact = f;
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -2701,9 +2724,29 @@ void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
uint32_t newtagset;
|
||||
+ size_t i;
|
||||
if (!(newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0))
|
||||
return;
|
||||
|
||||
+ if (newtagset == (uint32_t)~0) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* test if the user did not select the same tag */
|
||||
+ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+
|
||||
+ /* apply settings for this view */
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
@@ -2892,11 +2935,33 @@ urgent(struct wl_listener *listener, void *data)
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
+ size_t i, tmptag;
|
||||
+
|
||||
if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
- if (arg->ui & TAGMASK)
|
||||
+ if (arg->ui & ~0) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+
|
||||
+ if (arg->ui == TAGMASK)
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ else {
|
||||
+ for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ tmptag = selmon->pertag->prevtag;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = tmptag;
|
||||
+ }
|
||||
+
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
--
|
||||
2.45.2
|
||||
|
||||
91
patches/rotatetags.patch
Normal file
91
patches/rotatetags.patch
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
From 308c668010bb7526ea40ad12dbaa1af62f9d7421 Mon Sep 17 00:00:00 2001
|
||||
From: korei999 <ju7t1xe@gmail.com>
|
||||
Date: Tue, 23 Jan 2024 12:01:48 +0200
|
||||
Subject: [PATCH] add rotatetags patch
|
||||
|
||||
---
|
||||
config.def.h | 13 ++++++++++++-
|
||||
dwl.c | 29 +++++++++++++++++++++++++++++
|
||||
2 files changed, 41 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..a80207a 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -14,6 +14,13 @@ static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
|
||||
+enum {
|
||||
+ VIEW_L = -1,
|
||||
+ VIEW_R = 1,
|
||||
+ SHIFT_L = -2,
|
||||
+ SHIFT_R = 2,
|
||||
+} RotateTags;
|
||||
+
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
#define TAGCOUNT (9)
|
||||
|
||||
@@ -125,7 +132,11 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
- { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_i, incnmaster, {.i = -1} },
|
||||
+ { MODKEY, XKB_KEY_a, rotatetags, {.i = VIEW_L} },
|
||||
+ { MODKEY, XKB_KEY_d, rotatetags, {.i = VIEW_R} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_a, rotatetags, {.i = SHIFT_L} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_d, rotatetags, {.i = SHIFT_R} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf02a6d..e737e34 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -332,6 +332,7 @@ 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);
|
||||
static void zoom(const Arg *arg);
|
||||
+static void rotatetags(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
@@ -2798,6 +2799,34 @@ zoom(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
+static void
|
||||
+rotatetags(const Arg *arg)
|
||||
+{
|
||||
+ Arg newarg;
|
||||
+ int i = arg->i;
|
||||
+ int nextseltags = 0, curseltags = selmon->tagset[selmon->seltags];
|
||||
+ bool shift = false;
|
||||
+
|
||||
+ switch(abs(i)) {
|
||||
+ default: break;
|
||||
+ case SHIFT_R:
|
||||
+ shift = true;
|
||||
+ break;
|
||||
+ };
|
||||
+
|
||||
+ if (i > 0)
|
||||
+ nextseltags = (curseltags << 1) | (curseltags >> (TAGCOUNT - 1));
|
||||
+ else
|
||||
+ nextseltags = (curseltags >> 1) | (curseltags << (TAGCOUNT - 1));
|
||||
+
|
||||
+ newarg.i = nextseltags;
|
||||
+
|
||||
+ if (shift)
|
||||
+ tag(&newarg);
|
||||
+ else
|
||||
+ view(&newarg);
|
||||
+}
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
void
|
||||
activatex11(struct wl_listener *listener, void *data)
|
||||
--
|
||||
2.43.0
|
||||
|
||||
71
patches/warpcursor.patch
Normal file
71
patches/warpcursor.patch
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
From 4951ccc89dac2b557994b2f6c3aacb2398e2d1b1 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Collerson <benc@benc.cc>
|
||||
Date: Thu, 4 Jan 2024 20:30:01 +1000
|
||||
Subject: [PATCH] warpcursor
|
||||
|
||||
---
|
||||
dwl.c | 27 +++++++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 145fd018..f7ad6c13 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -347,6 +347,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 warpcursor(const Client *c);
|
||||
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);
|
||||
@@ -514,6 +515,7 @@ arrange(Monitor *m)
|
||||
m->lt[m->sellt]->arrange(m);
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
checkidleinhibitor(NULL);
|
||||
+ warpcursor(focustop(selmon));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1323,6 +1325,10 @@ focusclient(Client *c, int lift)
|
||||
if (locked)
|
||||
return;
|
||||
|
||||
+ /* Warp cursor to center of client if it is outside */
|
||||
+ if (lift)
|
||||
+ warpcursor(c);
|
||||
+
|
||||
/* Raise client in stacking order if requested */
|
||||
if (c && lift)
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
@@ -2927,6 +2933,27 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||
wlr_cursor_map_input_to_output(cursor, &pointer.base, event->suggested_output);
|
||||
}
|
||||
|
||||
+void
|
||||
+warpcursor(const Client *c) {
|
||||
+ if (cursor_mode != CurNormal) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!c && selmon) {
|
||||
+ wlr_cursor_warp_closest(cursor,
|
||||
+ NULL,
|
||||
+ selmon->w.x + selmon->w.width / 2.0 ,
|
||||
+ selmon->w.y + selmon->w.height / 2.0);
|
||||
+ }
|
||||
+ else if ( c && (cursor->x < c->geom.x ||
|
||||
+ cursor->x > c->geom.x + c->geom.width ||
|
||||
+ cursor->y < c->geom.y ||
|
||||
+ cursor->y > c->geom.y + c->geom.height))
|
||||
+ wlr_cursor_warp_closest(cursor,
|
||||
+ NULL,
|
||||
+ c->geom.x + c->geom.width / 2.0,
|
||||
+ c->geom.y + c->geom.height / 2.0);
|
||||
+}
|
||||
+
|
||||
Monitor *
|
||||
xytomon(double x, double y)
|
||||
{
|
||||
--
|
||||
2.45.2
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue