Merge branch 'main' into main

This commit is contained in:
Rammah Alensari 2024-06-12 06:07:13 +00:00
commit 2f1d826d2a
45 changed files with 907 additions and 1037 deletions

View File

@ -24,8 +24,8 @@ Since dwl is still taking shape, patches may need to be updated after larger cha
2. Create a branch in your Codeberg `dwl` repository for the patch you are generating and maintaining. 2. Create a branch in your Codeberg `dwl` repository for the patch you are generating and maintaining.
## Contributing Patches to `dwl-patches` ## Contributing Patches to `dwl-patches`
1. If you do not have it already, add the remote for the main dwl repository in your local copy: 1. If you do not have it already, add the remote for the main dwl repository in your local copy and fetch it:
`git remote add upstream https://codeberg.org/dwl/dwl` `git remote add --fetch upstream https://codeberg.org/dwl/dwl`
2. In your local repository of dwl, create a .patch file 2. In your local repository of dwl, create a .patch file
`git format-patch upstream/main...<branch-name> --stdout > PATCHNAME.patch` `git format-patch upstream/main...<branch-name> --stdout > PATCHNAME.patch`
3. Fork [https://codeberg.org/dwl/dwl-patches][dwl-patches] 3. Fork [https://codeberg.org/dwl/dwl-patches][dwl-patches]

View File

@ -3,7 +3,7 @@ Automatically center floating windows.
### Download ### Download
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter) - [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter)
- [2024-06-01](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch) - [2024-06-05](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch)
### Authors ### Authors
- [Guido Cella](https://codeberg.org/guidocella) - [Guido Cella](https://codeberg.org/guidocella)

View File

@ -1,27 +1,38 @@
From 5a96a47d708e94f1789daed2c1342279aa930d2f Mon Sep 17 00:00:00 2001 From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Sat, 1 Jun 2024 23:46:06 +0200 Date: Wed, 5 Jun 2024 12:05:16 +0200
Subject: [PATCH] center floating windows Subject: [PATCH] center floating windows
--- ---
dwl.c | 4 ++++ dwl.c | 8 ++++++++
1 file changed, 4 insertions(+) 1 file changed, 8 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 52bfbc8..c912b04 100644 index 6f041a0..79ace52 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -1618,6 +1618,10 @@ mapnotify(struct wl_listener *listener, void *data) @@ -472,6 +472,10 @@ applyrules(Client *c)
}
}
}
+ if (mon) {
+ 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;
+ }
setmon(c, mon, newtags);
}
@@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data)
* try to apply rules for them */
if ((p = client_get_parent(c))) {
c->isfloating = 1;
+ if (p->mon) {
+ c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
+ c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
+ }
setmon(c, p->mon, p->tags);
} else { } else {
applyrules(c); applyrules(c);
}
+ if (c->mon) {
+ c->geom.x = (c->mon->w.width - c->geom.width) / 2 + c->mon->m.x;
+ c->geom.y = (c->mon->w.height - c->geom.height) / 2 + c->mon->m.y;
+ }
printstatus();
unset_fullscreen:
-- --
2.45.1 2.45.1

View File

@ -5,7 +5,7 @@ Note: Commands from array are executed using execvp(). So if you need to execute
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart) - [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart)
- [2024-03-31](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From 51d56a433f23e13ac711b283a03c7903068febf6 Mon Sep 17 00:00:00 2001 From 1ea0c8b1ef7fe1c1506d0e475f4c047e78aac79b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me> <leohdz172@proton.me>
Date: Sat, 8 Jul 2023 17:11:36 -0600 Date: Sat, 8 Jul 2023 17:11:36 -0600
@ -15,10 +15,10 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
2 files changed, 61 insertions(+), 5 deletions(-) 2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..3585711 100644 index a784eb4f..247a25d2 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al @@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
/* logging */ /* logging */
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
@ -31,12 +31,12 @@ index a8ed61d..3585711 100644
+ +
static const Rule rules[] = { static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */ /* app_id title tags mask isfloating monitor */
/* examples: /* examples: */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..bbbef2b 100644 index 6f041a0d..a88c8844 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -236,6 +236,7 @@ static void arrange(Monitor *m); @@ -247,6 +247,7 @@ 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);
static void arrangelayers(Monitor *m); static void arrangelayers(Monitor *m);
@ -44,7 +44,7 @@ index 10d5a5b..bbbef2b 100644
static void axisnotify(struct wl_listener *listener, void *data); static void axisnotify(struct wl_listener *listener, void *data);
static void buttonpress(struct wl_listener *listener, void *data); static void buttonpress(struct wl_listener *listener, void *data);
static void chvt(const Arg *arg); static void chvt(const Arg *arg);
@@ -403,6 +404,9 @@ static xcb_atom_t netatom[NetLast]; @@ -426,6 +427,9 @@ static xcb_atom_t netatom[NetLast];
/* attempt to encapsulate suck into one file */ /* attempt to encapsulate suck into one file */
#include "client.h" #include "client.h"
@ -54,7 +54,7 @@ index 10d5a5b..bbbef2b 100644
/* function implementations */ /* function implementations */
void void
applybounds(Client *c, struct wlr_box *bbox) applybounds(Client *c, struct wlr_box *bbox)
@@ -533,6 +537,27 @@ arrangelayers(Monitor *m) @@ -574,6 +578,27 @@ arrangelayers(Monitor *m)
} }
} }
@ -82,7 +82,7 @@ index 10d5a5b..bbbef2b 100644
void void
axisnotify(struct wl_listener *listener, void *data) axisnotify(struct wl_listener *listener, void *data)
{ {
@@ -630,11 +655,21 @@ checkidleinhibitor(struct wlr_surface *exclude) @@ -671,11 +696,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
void void
cleanup(void) cleanup(void)
{ {
@ -104,7 +104,7 @@ index 10d5a5b..bbbef2b 100644
if (child_pid > 0) { if (child_pid > 0) {
kill(child_pid, SIGTERM); kill(child_pid, SIGTERM);
waitpid(child_pid, NULL, 0); waitpid(child_pid, NULL, 0);
@@ -1294,18 +1329,31 @@ void @@ -1434,18 +1469,31 @@ void
handlesig(int signo) handlesig(int signo)
{ {
if (signo == SIGCHLD) { if (signo == SIGCHLD) {
@ -141,7 +141,7 @@ index 10d5a5b..bbbef2b 100644
} else if (signo == SIGINT || signo == SIGTERM) { } else if (signo == SIGINT || signo == SIGTERM) {
quit(NULL); quit(NULL);
} }
@@ -1965,6 +2013,7 @@ run(char *startup_cmd) @@ -2136,6 +2184,7 @@ run(char *startup_cmd)
die("startup: backend_start"); die("startup: backend_start");
/* Now that the socket exists and the backend is started, run the startup command */ /* Now that the socket exists and the backend is started, run the startup command */
@ -150,5 +150,5 @@ index 10d5a5b..bbbef2b 100644
int piperw[2]; int piperw[2];
if (pipe(piperw) < 0) if (pipe(piperw) < 0)
-- --
2.43.0 2.45.2

View File

@ -14,7 +14,7 @@ slstatus -s | dwl
### Download ### Download
- [git branch](https://codeberg.org/sewn/dwl/src/branch/bar) - [git branch](https://codeberg.org/sewn/dwl/src/branch/bar)
- [2024-05-28](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar/bar.patch) - [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar/bar.patch)
Below is a preview of the patch. Below is a preview of the patch.

View File

@ -1,16 +1,16 @@
From a53e23e1fe72e46eac00c428360b7ce679eadb4b Mon Sep 17 00:00:00 2001 From ebe8a7aca8684c66da54abb50c630f4ad9cb233e Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org> From: sewn <sewn@disroot.org>
Date: Tue, 28 May 2024 13:25:00 +0300 Date: Mon, 10 Jun 2024 14:41:35 +0300
Subject: [PATCH] Implement dwm bar clone Subject: [PATCH] Implement dwm bar clone
--- ---
LICENSE.drwl | 22 +++ LICENSE.drwl | 22 +++
LICENSE.utf8dec | 25 ++++ LICENSE.utf8dec | 25 ++++
Makefile | 2 +- Makefile | 2 +-
config.def.h | 29 +++- config.def.h | 28 +++-
drwl.h | 142 +++++++++++++++++++ drwl.h | 142 ++++++++++++++++++
dwl.c | 364 ++++++++++++++++++++++++++++++++++++++---------- dwl.c | 380 ++++++++++++++++++++++++++++++++++++++----------
6 files changed, 503 insertions(+), 81 deletions(-) 6 files changed, 518 insertions(+), 81 deletions(-)
create mode 100644 LICENSE.drwl create mode 100644 LICENSE.drwl
create mode 100644 LICENSE.utf8dec create mode 100644 LICENSE.utf8dec
create mode 100644 drwl.h create mode 100644 drwl.h
@ -88,10 +88,10 @@ index a67fdd3..5578ae2 100644
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 8847e58..0be3ad0 100644 index 8847e58..d0bb5bc 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -7,15 +7,25 @@ @@ -7,15 +7,24 @@
static const int sloppyfocus = 1; /* focus follows mouse */ 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 bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 1; /* border pixel of windows */
@ -107,7 +107,6 @@ index 8847e58..0be3ad0 100644
+static const int showbar = 1; /* 0 means no bar */ +static const int showbar = 1; /* 0 means no bar */
+static const int topbar = 1; /* 0 means bottom bar */ +static const int topbar = 1; /* 0 means bottom bar */
+static const char *fonts[] = {"monospace:size=10"}; +static const char *fonts[] = {"monospace:size=10"};
+static const char *fontattrs = "dpi=96";
+static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; +static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
+static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff }; +static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff };
+static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff }; +static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff };
@ -119,7 +118,7 @@ index 8847e58..0be3ad0 100644
/* logging */ /* logging */
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
@@ -122,6 +132,7 @@ static const Key keys[] = { @@ -122,6 +131,7 @@ static const Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
@ -127,7 +126,7 @@ index 8847e58..0be3ad0 100644
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
@@ -165,7 +176,15 @@ static const Key keys[] = { @@ -165,7 +175,15 @@ static const Key keys[] = {
}; };
static const Button buttons[] = { static const Button buttons[] = {
@ -295,7 +294,7 @@ index 0000000..613551e
+ return x + (render ? w : 0); + return x + (render ? w : 0);
+} +}
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index bf763df..0268772 100644 index bf763df..cd484bd 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
@ -334,7 +333,7 @@ index bf763df..0268772 100644
+#define TAGMASK ((1u << LENGTH(tags)) - 1) +#define TAGMASK ((1u << LENGTH(tags)) - 1)
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L))) #define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0) #define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
+#define TEXTW(text) (drwl_text(NULL, font, 0, 0, 0, 0, 0, text, NULL, NULL) + lrpad) +#define TEXTW(mon, text) (drwl_text(NULL, mon->font, 0, 0, 0, 0, 0, text, NULL, NULL) + mon->lrpad)
/* enums */ /* enums */
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */ enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
@ -360,20 +359,26 @@ index bf763df..0268772 100644
struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */ struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */
struct wl_listener frame; struct wl_listener frame;
struct wl_listener destroy; struct wl_listener destroy;
@@ -195,6 +204,7 @@ struct Monitor { @@ -195,6 +204,11 @@ struct Monitor {
struct wl_listener destroy_lock_surface; struct wl_listener destroy_lock_surface;
struct wlr_session_lock_surface_v1 *lock_surface; struct wlr_session_lock_surface_v1 *lock_surface;
struct wlr_box m; /* monitor area, layout-relative */ struct wlr_box m; /* monitor area, layout-relative */
+ struct wlr_box b; /* bar area */ + struct {
+ int width, height;
+ int real_width, real_height; /* non-scaled */
+ float scale;
+ } b; /* bar area */
struct wlr_box w; /* window area, layout-relative */ struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface.link */ struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2]; const Layout *lt[2];
@@ -204,9 +214,16 @@ struct Monitor { @@ -204,9 +218,18 @@ struct Monitor {
float mfact; float mfact;
int gamma_lut_changed; int gamma_lut_changed;
int nmaster; int nmaster;
+ int showbar; + int showbar;
char ltsymbol[16]; char ltsymbol[16];
+ struct fcft_font *font;
+ int lrpad;
}; };
+typedef struct { +typedef struct {
@ -385,7 +390,7 @@ index bf763df..0268772 100644
typedef struct { typedef struct {
const char *name; const char *name;
float mfact; float mfact;
@@ -247,6 +264,10 @@ static void arrangelayer(Monitor *m, struct wl_list *list, @@ -247,6 +270,10 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
struct wlr_box *usable_area, int exclusive); struct wlr_box *usable_area, int exclusive);
static void arrangelayers(Monitor *m); static void arrangelayers(Monitor *m);
static void axisnotify(struct wl_listener *listener, void *data); static void axisnotify(struct wl_listener *listener, void *data);
@ -396,7 +401,7 @@ index bf763df..0268772 100644
static void buttonpress(struct wl_listener *listener, void *data); static void buttonpress(struct wl_listener *listener, void *data);
static void chvt(const Arg *arg); static void chvt(const Arg *arg);
static void checkidleinhibitor(struct wlr_surface *exclude); static void checkidleinhibitor(struct wlr_surface *exclude);
@@ -278,6 +299,8 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data); @@ -278,6 +305,8 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
static void destroysessionlock(struct wl_listener *listener, void *data); static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionmgr(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir); static Monitor *dirtomon(enum wlr_direction dir);
@ -405,7 +410,7 @@ index bf763df..0268772 100644
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
@@ -306,7 +329,6 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int @@ -306,7 +335,6 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int
static void outputmgrtest(struct wl_listener *listener, void *data); static void outputmgrtest(struct wl_listener *listener, void *data);
static void pointerfocus(Client *c, struct wlr_surface *surface, static void pointerfocus(Client *c, struct wlr_surface *surface,
double sx, double sy, uint32_t time); double sx, double sy, uint32_t time);
@ -413,7 +418,7 @@ index bf763df..0268772 100644
static void quit(const Arg *arg); static void quit(const Arg *arg);
static void rendermon(struct wl_listener *listener, void *data); static void rendermon(struct wl_listener *listener, void *data);
static void requestdecorationmode(struct wl_listener *listener, void *data); static void requestdecorationmode(struct wl_listener *listener, void *data);
@@ -327,9 +349,11 @@ static void setsel(struct wl_listener *listener, void *data); @@ -327,9 +355,11 @@ static void setsel(struct wl_listener *listener, void *data);
static void setup(void); static void setup(void);
static void spawn(const Arg *arg); static void spawn(const Arg *arg);
static void startdrag(struct wl_listener *listener, void *data); static void startdrag(struct wl_listener *listener, void *data);
@ -425,21 +430,18 @@ index bf763df..0268772 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);
@@ -338,6 +362,7 @@ static void unlocksession(struct wl_listener *listener, void *data); @@ -338,6 +368,7 @@ static void unlocksession(struct wl_listener *listener, void *data);
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data); static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
static void unmapnotify(struct wl_listener *listener, void *data); static void unmapnotify(struct wl_listener *listener, void *data);
static void updatemons(struct wl_listener *listener, void *data); static void updatemons(struct wl_listener *listener, void *data);
+static void updatebardims(Monitor *m); +static void updatebar(Monitor *m);
static void updatetitle(struct wl_listener *listener, void *data); static void updatetitle(struct wl_listener *listener, void *data);
static void urgent(struct wl_listener *listener, void *data); static void urgent(struct wl_listener *listener, void *data);
static void view(const Arg *arg); static void view(const Arg *arg);
@@ -405,6 +430,18 @@ static struct wlr_box sgeom; @@ -405,6 +436,15 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
+static struct fcft_font *font;
+static int bh;
+static int lrpad;
+static char stext[256]; +static char stext[256];
+static struct wl_event_source *status_event_source; +static struct wl_event_source *status_event_source;
+ +
@ -452,19 +454,19 @@ index bf763df..0268772 100644
#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);
@@ -531,6 +568,11 @@ arrangelayers(Monitor *m) @@ -531,6 +571,11 @@ arrangelayers(Monitor *m)
if (!m->wlr_output->enabled) if (!m->wlr_output->enabled)
return; return;
+ if (m->showbar) { + if (m->showbar) {
+ usable_area.height -= m->b.height; + usable_area.height -= m->b.real_height;
+ usable_area.y += topbar ? m->b.height : 0; + usable_area.y += topbar ? m->b.real_height : 0;
+ } + }
+ +
/* Arrange exclusive surfaces from top->bottom */ /* Arrange exclusive surfaces from top->bottom */
for (i = 3; i >= 0; i--) for (i = 3; i >= 0; i--)
arrangelayer(m, &m->layers[i], &usable_area, 1); arrangelayer(m, &m->layers[i], &usable_area, 1);
@@ -573,17 +615,77 @@ axisnotify(struct wl_listener *listener, void *data) @@ -573,17 +618,77 @@ axisnotify(struct wl_listener *listener, void *data)
event->delta_discrete, event->source); event->delta_discrete, event->source);
} }
@ -526,14 +528,14 @@ index bf763df..0268772 100644
+ (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) { + (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
+ x = selmon->m.x; + x = selmon->m.x;
+ do + do
+ x += TEXTW(tags[i]); + x += TEXTW(selmon, tags[i]);
+ while (cursor->x >= x && ++i < LENGTH(tags)); + while (cursor->x >= x && ++i < LENGTH(tags));
+ if (i < LENGTH(tags)) { + if (i < LENGTH(tags)) {
+ click = ClkTagBar; + click = ClkTagBar;
+ arg.ui = 1 << i; + arg.ui = 1 << i;
+ } else if (cursor->x < x + TEXTW(selmon->ltsymbol)) + } else if (cursor->x < x + TEXTW(selmon, selmon->ltsymbol))
+ click = ClkLtSymbol; + click = ClkLtSymbol;
+ else if (cursor->x > selmon->w.width - (int)TEXTW(stext)) + else if (cursor->x > selmon->w.width - (int)TEXTW(selmon, stext))
+ click = ClkStatus; + click = ClkStatus;
+ else + else
+ click = ClkTitle; + click = ClkTitle;
@ -542,7 +544,7 @@ index bf763df..0268772 100644
switch (event->state) { switch (event->state) {
case WLR_BUTTON_PRESSED: case WLR_BUTTON_PRESSED:
cursor_mode = CurPressed; cursor_mode = CurPressed;
@@ -592,16 +694,14 @@ buttonpress(struct wl_listener *listener, void *data) @@ -592,16 +697,14 @@ buttonpress(struct wl_listener *listener, void *data)
break; break;
/* Change focus if the button was _pressed_ over a client */ /* Change focus if the button was _pressed_ over a client */
@ -562,17 +564,26 @@ index bf763df..0268772 100644
return; return;
} }
} }
@@ -675,6 +775,9 @@ cleanup(void) @@ -675,6 +778,9 @@ cleanup(void)
/* Destroy after the wayland display (when the monitors are already destroyed) /* Destroy after the wayland display (when the monitors are already destroyed)
to avoid destroying them with an invalid scene output. */ to avoid destroying them with an invalid scene output. */
wlr_scene_node_destroy(&scene->tree.node); wlr_scene_node_destroy(&scene->tree.node);
+ +
+ fcft_destroy(font); +
+ fcft_fini(); + fcft_fini();
} }
void void
@@ -726,7 +829,7 @@ closemon(Monitor *m) @@ -690,6 +796,8 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_layer_surface_v1_destroy(l->layer_surface);
}
+ fcft_destroy(m->font);
+
wl_list_remove(&m->destroy.link);
wl_list_remove(&m->frame.link);
wl_list_remove(&m->link);
@@ -726,7 +834,7 @@ closemon(Monitor *m)
setmon(c, selmon, c->tags); setmon(c, selmon, c->tags);
} }
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
@ -581,14 +592,14 @@ index bf763df..0268772 100644
} }
void void
@@ -912,8 +1015,13 @@ createmon(struct wl_listener *listener, void *data) @@ -912,8 +1020,13 @@ createmon(struct wl_listener *listener, void *data)
wlr_output_commit_state(wlr_output, &state); wlr_output_commit_state(wlr_output, &state);
wlr_output_state_finish(&state); wlr_output_state_finish(&state);
+ m->scene_buffer = wlr_scene_buffer_create(layers[LyrBottom], NULL); + m->scene_buffer = wlr_scene_buffer_create(layers[LyrBottom], NULL);
+ m->scene_buffer->point_accepts_input = bar_accepts_input; + m->scene_buffer->point_accepts_input = bar_accepts_input;
+ m->showbar = showbar; + m->showbar = showbar;
+ updatebardims(m); + updatebar(m);
+ +
wl_list_insert(&mons, &m->link); wl_list_insert(&mons, &m->link);
- printstatus(); - printstatus();
@ -596,59 +607,58 @@ index bf763df..0268772 100644
/* The xdg-protocol specifies: /* The xdg-protocol specifies:
* *
@@ -1233,6 +1341,98 @@ dirtomon(enum wlr_direction dir) @@ -1233,6 +1346,99 @@ dirtomon(enum wlr_direction dir)
return selmon; return selmon;
} }
+void +void
+drawbar(Monitor *mon) +drawbar(Monitor *m)
+{ +{
+ int x, w, tw = 0; + int x, w, tw = 0;
+ int sel; + int sel;
+ int boxs = font->height / 9; + int boxs = m->font->height / 9;
+ int boxw = font->height / 6 + 2; + int boxw = m->font->height / 6 + 2;
+ uint32_t i, occ = 0, urg = 0; + uint32_t i, occ = 0, urg = 0;
+ uint32_t stride, size; + uint32_t stride, size;
+ pixman_image_t *pix; + pixman_image_t *pix;
+ Client *c; + Client *c;
+ Buffer *buf; + Buffer *buf;
+ +
+ if (!mon || !mon->showbar) + if (!m->showbar)
+ return; + return;
+ +
+ stride = mon->b.width * 4; + stride = m->b.width * 4;
+ size = stride * mon->b.height; + size = stride * m->b.height;
+ +
+ buf = ecalloc(1, sizeof(Buffer) + size); + buf = ecalloc(1, sizeof(Buffer) + size);
+ buf->stride = stride; + buf->stride = stride;
+ wlr_buffer_init(&buf->base, &buffer_impl, mon->b.width, mon->b.height); + wlr_buffer_init(&buf->base, &buffer_impl, m->b.width, m->b.height);
+ +
+ pix = pixman_image_create_bits( + pix = pixman_image_create_bits(
+ PIXMAN_a8r8g8b8, mon->b.width, mon->b.height, buf->data, stride); + PIXMAN_a8r8g8b8, m->b.width, m->b.height, buf->data, stride);
+ +
+ /* draw status first so it can be overdrawn by tags later */ + /* draw status first so it can be overdrawn by tags later */
+ if (mon == selmon) { + if (m == selmon) {
+ if (stext[0] == '\0') + if (stext[0] == '\0')
+ strncpy(stext, "dwl-"VERSION, sizeof(stext)); + strncpy(stext, "dwl-"VERSION, sizeof(stext));
+ tw = TEXTW(stext) - lrpad; + tw = TEXTW(m, stext) - m->lrpad;
+ drwl_text(pix, font, mon->b.width - tw, 0, tw, mon->b.height, 0, + drwl_text(pix, m->font, m->b.width - tw, 0, tw, m->b.height, 0,
+ stext, &normbarfg, &normbarbg); + stext, &normbarfg, &normbarbg);
+ } + }
+ +
+ wl_list_for_each(c, &clients, link) { + wl_list_for_each(c, &clients, link) {
+ if (c->mon != mon) + if (c->mon != m)
+ continue; + continue;
+ occ |= c->tags; + occ |= c->tags;
+ if (c->isurgent) + if (c->isurgent)
+ urg |= c->tags; + urg |= c->tags;
+ } + }
+ c = focustop(mon);
+ x = 0; + x = 0;
+ for (i = 0; i < LENGTH(tags); i++) { + for (i = 0; i < LENGTH(tags); i++) {
+ w = TEXTW(tags[i]); + w = TEXTW(m, tags[i]);
+ sel = mon->tagset[mon->seltags] & 1 << i; + sel = m->tagset[m->seltags] & 1 << i;
+ +
+ drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, tags[i], + drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i],
+ urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg), + urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg),
+ urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg)); + urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg));
+ +
@ -659,27 +669,29 @@ index bf763df..0268772 100644
+ x += w; + x += w;
+ } + }
+ +
+ w = TEXTW(mon->ltsymbol); + w = TEXTW(m, m->ltsymbol);
+ x = drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, + x = drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2,
+ mon->ltsymbol, &normbarfg, &normbarbg); + m->ltsymbol, &normbarfg, &normbarbg);
+ +
+ if ((w = mon->b.width - tw - x) > mon->b.height) { + if ((w = m->b.width - tw - x) > m->b.height) {
+ if (c != NULL) { + if ((c = focustop(m)) != NULL) {
+ drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, + drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2,
+ client_get_title(c), + client_get_title(c),
+ mon == selmon ? &selbarfg : &normbarfg, + m == selmon ? &selbarfg : &normbarfg,
+ (mon == selmon && c) ? &selbarbg : &normbarbg); + (m == selmon && c) ? &selbarbg : &normbarbg);
+ if (c && c->isfloating) + if (c && c->isfloating)
+ drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0, + drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0,
+ mon == selmon ? &selbarfg : &normbarfg); + m == selmon ? &selbarfg : &normbarfg);
+ } else + } else
+ drwl_rect(pix, x, 0, w, mon->b.height, 1, &normbarbg); + drwl_rect(pix, x, 0, w, m->b.height, 1, &normbarbg);
+ } + }
+ +
+ pixman_image_unref(pix); + pixman_image_unref(pix);
+ wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x, + wlr_scene_buffer_set_dest_size(m->scene_buffer,
+ mon->m.y + (topbar ? 0 : mon->m.height - mon->b.height)); + m->b.real_width, m->b.real_height);
+ wlr_scene_buffer_set_buffer(mon->scene_buffer, &buf->base); + wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x,
+ m->m.y + (topbar ? 0 : m->m.height - m->b.real_height));
+ wlr_scene_buffer_set_buffer(m->scene_buffer, &buf->base);
+ wlr_buffer_drop(&buf->base); + wlr_buffer_drop(&buf->base);
+} +}
+ +
@ -695,7 +707,7 @@ index bf763df..0268772 100644
void void
focusclient(Client *c, int lift) focusclient(Client *c, int lift)
{ {
@@ -1290,7 +1490,7 @@ focusclient(Client *c, int lift) @@ -1290,7 +1496,7 @@ focusclient(Client *c, int lift)
client_activate_surface(old, 0); client_activate_surface(old, 0);
} }
} }
@ -704,7 +716,7 @@ index bf763df..0268772 100644
if (!c) { if (!c) {
/* With no client, all we have left is to clear focus */ /* With no client, all we have left is to clear focus */
@@ -1618,7 +1818,7 @@ mapnotify(struct wl_listener *listener, void *data) @@ -1618,7 +1824,7 @@ mapnotify(struct wl_listener *listener, void *data)
} else { } else {
applyrules(c); applyrules(c);
} }
@ -713,7 +725,7 @@ index bf763df..0268772 100644
unset_fullscreen: unset_fullscreen:
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
@@ -1904,46 +2104,6 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, @@ -1904,46 +2110,6 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
wlr_seat_pointer_notify_motion(seat, time, sx, sy); wlr_seat_pointer_notify_motion(seat, time, sx, sy);
} }
@ -760,7 +772,7 @@ index bf763df..0268772 100644
void void
quit(const Arg *arg) quit(const Arg *arg)
@@ -2074,23 +2234,14 @@ run(char *startup_cmd) @@ -2074,23 +2240,14 @@ run(char *startup_cmd)
/* Now that the socket exists and the backend is started, run the startup command */ /* Now that the socket exists and the backend is started, run the startup command */
if (startup_cmd) { if (startup_cmd) {
@ -785,7 +797,7 @@ index bf763df..0268772 100644
/* At this point the outputs are initialized, choose initial selmon based on /* At this point the outputs are initialized, choose initial selmon based on
* cursor position, and set default cursor image */ * cursor position, and set default cursor image */
@@ -2155,7 +2306,7 @@ setfloating(Client *c, int floating) @@ -2155,7 +2312,7 @@ setfloating(Client *c, int floating)
(p && p->isfullscreen) ? LyrFS (p && p->isfullscreen) ? LyrFS
: c->isfloating ? LyrFloat : LyrTile]); : c->isfloating ? LyrFloat : LyrTile]);
arrange(c->mon); arrange(c->mon);
@ -794,7 +806,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2178,7 +2329,7 @@ setfullscreen(Client *c, int fullscreen) @@ -2178,7 +2335,7 @@ setfullscreen(Client *c, int fullscreen)
resize(c, c->prev, 0); resize(c, c->prev, 0);
} }
arrange(c->mon); arrange(c->mon);
@ -803,7 +815,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2203,7 +2354,7 @@ setlayout(const Arg *arg) @@ -2203,7 +2360,7 @@ setlayout(const Arg *arg)
selmon->lt[selmon->sellt] = (Layout *)arg->v; selmon->lt[selmon->sellt] = (Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
arrange(selmon); arrange(selmon);
@ -812,17 +824,12 @@ index bf763df..0268772 100644
} }
/* arg > 1.0 will set mfact absolutely */ /* arg > 1.0 will set mfact absolutely */
@@ -2506,6 +2657,17 @@ setup(void) @@ -2506,6 +2663,12 @@ setup(void)
wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend)); wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend));
+ fcft_init(FCFT_LOG_COLORIZE_AUTO, 0, FCFT_LOG_CLASS_ERROR); + fcft_init(FCFT_LOG_COLORIZE_AUTO, 0, FCFT_LOG_CLASS_ERROR);
+ fcft_set_scaling_filter(FCFT_SCALING_FILTER_LANCZOS3); + fcft_set_scaling_filter(FCFT_SCALING_FILTER_LANCZOS3);
+ if (!(font = fcft_from_name(LENGTH(fonts), fonts, fontattrs)))
+ die("Could not load font");
+
+ lrpad = font->height;
+ bh = font->height + 2;
+ +
+ status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy), + status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
+ STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL); + STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
@ -830,7 +837,7 @@ index bf763df..0268772 100644
/* Make sure XWayland clients don't connect to the parent X server, /* Make sure XWayland clients don't connect to the parent X server,
* e.g when running in the x11 backend or the wayland backend and the * e.g when running in the x11 backend or the wayland backend and the
* compositor has Xwayland support */ * compositor has Xwayland support */
@@ -2530,6 +2692,7 @@ void @@ -2530,6 +2693,7 @@ void
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (fork() == 0) { if (fork() == 0) {
@ -838,7 +845,7 @@ index bf763df..0268772 100644
dup2(STDERR_FILENO, STDOUT_FILENO); dup2(STDERR_FILENO, STDOUT_FILENO);
setsid(); setsid();
execvp(((char **)arg->v)[0], (char **)arg->v); execvp(((char **)arg->v)[0], (char **)arg->v);
@@ -2548,6 +2711,30 @@ startdrag(struct wl_listener *listener, void *data) @@ -2548,6 +2712,30 @@ startdrag(struct wl_listener *listener, void *data)
LISTEN_STATIC(&drag->icon->events.destroy, destroydragicon); LISTEN_STATIC(&drag->icon->events.destroy, destroydragicon);
} }
@ -869,7 +876,7 @@ index bf763df..0268772 100644
void void
tag(const Arg *arg) tag(const Arg *arg)
{ {
@@ -2558,7 +2745,7 @@ tag(const Arg *arg) @@ -2558,7 +2746,7 @@ tag(const Arg *arg)
sel->tags = arg->ui & TAGMASK; sel->tags = arg->ui & TAGMASK;
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
arrange(selmon); arrange(selmon);
@ -878,7 +885,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2603,6 +2790,14 @@ tile(Monitor *m) @@ -2603,6 +2791,14 @@ tile(Monitor *m)
} }
} }
@ -893,7 +900,7 @@ index bf763df..0268772 100644
void void
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
@@ -2631,7 +2826,7 @@ toggletag(const Arg *arg) @@ -2631,7 +2827,7 @@ toggletag(const Arg *arg)
sel->tags = newtags; sel->tags = newtags;
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
arrange(selmon); arrange(selmon);
@ -902,7 +909,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2644,7 +2839,7 @@ toggleview(const Arg *arg) @@ -2644,7 +2840,7 @@ toggleview(const Arg *arg)
selmon->tagset[selmon->seltags] = newtagset; selmon->tagset[selmon->seltags] = newtagset;
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
arrange(selmon); arrange(selmon);
@ -911,7 +918,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2692,7 +2887,7 @@ unmapnotify(struct wl_listener *listener, void *data) @@ -2692,7 +2888,7 @@ unmapnotify(struct wl_listener *listener, void *data)
} }
wlr_scene_node_destroy(&c->scene->node); wlr_scene_node_destroy(&c->scene->node);
@ -920,30 +927,45 @@ index bf763df..0268772 100644
motionnotify(0, NULL, 0, 0, 0, 0); motionnotify(0, NULL, 0, 0, 0, 0);
} }
@@ -2788,6 +2983,12 @@ updatemons(struct wl_listener *listener, void *data) @@ -2788,6 +2984,12 @@ updatemons(struct wl_listener *listener, void *data)
} }
} }
+ /* Update bar */ + /* Update bar */
+ wl_list_for_each(m, &mons, link) { + wl_list_for_each(m, &mons, link) {
+ updatebardims(m); + updatebar(m);
+ drawbar(m); + drawbar(m);
+ } + }
+ +
/* FIXME: figure out why the cursor image is at 0,0 after turning all /* FIXME: figure out why the cursor image is at 0,0 after turning all
* the monitors on. * the monitors on.
* Move the cursor image where it used to be. It does not generate a * Move the cursor image where it used to be. It does not generate a
@@ -2798,12 +2999,21 @@ updatemons(struct wl_listener *listener, void *data) @@ -2798,12 +3000,36 @@ updatemons(struct wl_listener *listener, void *data)
wlr_output_manager_v1_set_configuration(output_mgr, config); wlr_output_manager_v1_set_configuration(output_mgr, config);
} }
+void +void
+updatebardims(Monitor *m) +updatebar(Monitor *m)
+{ +{
+ int rw, rh; + int rw, rh;
+ wlr_output_effective_resolution(m->wlr_output, &rw, &rh); + char fontattrs[12];
+
+ wlr_output_transformed_resolution(m->wlr_output, &rw, &rh);
+ m->b.width = rw; + m->b.width = rw;
+ m->b.height = bh; + m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale);
+
+ if (m->b.scale == m->wlr_output->scale && m->font)
+ return;
+
+ fcft_destroy(m->font);
+ snprintf(fontattrs, sizeof(fontattrs), "dpi=%.2f", 96. * m->wlr_output->scale);
+ if (!(m->font = fcft_from_name(LENGTH(fonts), fonts, fontattrs)))
+ die("Could not load font");
+
+ m->b.scale = m->wlr_output->scale;
+ m->lrpad = m->font->height;
+ m->b.height = m->font->height + 2;
+ m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale);
+} +}
+ +
void void
@ -956,7 +978,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2816,7 +3026,7 @@ urgent(struct wl_listener *listener, void *data) @@ -2816,7 +3042,7 @@ urgent(struct wl_listener *listener, void *data)
return; return;
c->isurgent = 1; c->isurgent = 1;
@ -965,7 +987,7 @@ index bf763df..0268772 100644
if (client_surface(c)->mapped) if (client_surface(c)->mapped)
client_set_border_color(c, urgentcolor); client_set_border_color(c, urgentcolor);
@@ -2832,7 +3042,7 @@ view(const Arg *arg) @@ -2832,7 +3058,7 @@ view(const Arg *arg)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
arrange(selmon); arrange(selmon);
@ -974,7 +996,7 @@ index bf763df..0268772 100644
} }
void void
@@ -2871,6 +3081,7 @@ xytonode(double x, double y, struct wlr_surface **psurface, @@ -2871,6 +3097,7 @@ xytonode(double x, double y, struct wlr_surface **psurface,
{ {
struct wlr_scene_node *node, *pnode; struct wlr_scene_node *node, *pnode;
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
@ -982,7 +1004,7 @@ index bf763df..0268772 100644
Client *c = NULL; Client *c = NULL;
LayerSurface *l = NULL; LayerSurface *l = NULL;
int layer; int layer;
@@ -2879,9 +3090,12 @@ xytonode(double x, double y, struct wlr_surface **psurface, @@ -2879,9 +3106,12 @@ xytonode(double x, double y, struct wlr_surface **psurface,
if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny))) if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny)))
continue; continue;
@ -998,7 +1020,7 @@ index bf763df..0268772 100644
/* Walk the tree to find a node that knows the client */ /* Walk the tree to find a node that knows the client */
for (pnode = node; pnode && !c; pnode = &pnode->parent->node) for (pnode = node; pnode && !c; pnode = &pnode->parent->node)
c = pnode->data; c = pnode->data;
@@ -3020,7 +3234,7 @@ sethints(struct wl_listener *listener, void *data) @@ -3020,7 +3250,7 @@ sethints(struct wl_listener *listener, void *data)
return; return;
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);

View File

@ -3,7 +3,7 @@
Add a border around the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) similar to how a client is given a border. Add a border around the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) similar to how a client is given a border.
### Download ### Download
- [2024-04-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barborder/barborder.patch) (bar 2024-04-14) - [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barborder/barborder.patch) (bar 2024-06-10)
### Authors ### Authors
- [sewn](https://codeberg.org/sewn) - [sewn](https://codeberg.org/sewn)

View File

@ -1,6 +1,6 @@
From 38dd71e51784ab68261d9c0479a4579d419315f1 Mon Sep 17 00:00:00 2001 From 1589ba9e16216e13dcc77e08b638f86ba41d47eb Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org> From: sewn <sewn@disroot.org>
Date: Sun, 14 Apr 2024 08:47:04 +0300 Date: Mon, 10 Jun 2024 14:59:12 +0300
Subject: [PATCH] add border to bar Subject: [PATCH] add border to bar
--- ---
@ -9,7 +9,7 @@ Subject: [PATCH] add border to bar
2 files changed, 18 insertions(+), 12 deletions(-) 2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 0be3ad0..e5e595a 100644 index d0bb5bc..9387dea 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
@ -21,65 +21,65 @@ index 0be3ad0..e5e595a 100644
static const float rootcolor[] = COLOR(0x000000ff); static const float rootcolor[] = COLOR(0x000000ff);
static const float bordercolor[] = COLOR(0x444444ff); static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff); static const float focuscolor[] = COLOR(0x005577ff);
@@ -19,6 +19,7 @@ static const int showbar = 1; /* 0 means no bar */ @@ -18,6 +18,7 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = {"monospace:size=10"}; static const char *fonts[] = {"monospace:size=10"};
static const char *fontattrs = "dpi=96";
+static pixman_color_t borderbar = { 0x5555, 0x7777, 0x0000, 0xffff }; +static pixman_color_t borderbar = { 0x5555, 0x7777, 0x0000, 0xffff };
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff }; static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff };
static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff }; static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff };
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 54273ae..3153bfd 100644 index cd484bd..679409f 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -1344,7 +1344,8 @@ dirtomon(enum wlr_direction dir) @@ -1349,7 +1349,8 @@ dirtomon(enum wlr_direction dir)
void void
drawbar(Monitor *mon) drawbar(Monitor *m)
{ {
- int x, w, tw = 0; - int x, w, tw = 0;
+ int x, y = borderpx, w, tw = 0; + int x, y = borderpx, w, tw = 0;
+ int mh, mw; + int mh, mw;
int sel; int sel;
int boxs = font->height / 9; int boxs = m->font->height / 9;
int boxw = font->height / 6 + 2; int boxw = m->font->height / 6 + 2;
@@ -1357,6 +1358,8 @@ drawbar(Monitor *mon) @@ -1362,6 +1363,8 @@ drawbar(Monitor *m)
if (!mon || !mon->showbar) if (!m->showbar)
return; return;
+ mh = mon->b.height - borderpx * 2; + mh = m->b.height - borderpx * 2;
+ mw = mon->b.width - borderpx * 2; + mw = m->b.width - borderpx * 2;
stride = mon->b.width * 4; stride = m->b.width * 4;
size = stride * mon->b.height; size = stride * m->b.height;
@@ -1367,12 +1370,14 @@ drawbar(Monitor *mon) @@ -1372,12 +1375,14 @@ drawbar(Monitor *m)
pix = pixman_image_create_bits( pix = pixman_image_create_bits(
PIXMAN_a8r8g8b8, mon->b.width, mon->b.height, buf->data, stride); PIXMAN_a8r8g8b8, m->b.width, m->b.height, buf->data, stride);
+ drwl_rect(pix, 0, 0, mon->b.width, mon->b.height, 1, &borderbar); + drwl_rect(pix, 0, 0, m->b.width, m->b.height, 1, &borderbar);
+ +
/* draw status first so it can be overdrawn by tags later */ /* draw status first so it can be overdrawn by tags later */
if (mon == selmon) { if (m == selmon) {
if (stext[0] == '\0') if (stext[0] == '\0')
strncpy(stext, "dwl-"VERSION, sizeof(stext)); strncpy(stext, "dwl-"VERSION, sizeof(stext));
tw = TEXTW(stext) - lrpad; tw = TEXTW(m, stext) - m->lrpad;
- drwl_text(pix, font, mon->b.width - tw, 0, tw, mon->b.height, 0, - drwl_text(pix, m->font, m->b.width - tw, 0, tw, m->b.height, 0,
+ drwl_text(pix, font, borderpx + mw - tw, y, tw, mh, 0, + drwl_text(pix, m->font, borderpx + mw - tw, y, tw, mh, 0,
stext, &normbarfg, &normbarbg); stext, &normbarfg, &normbarbg);
} }
@@ -1384,37 +1389,37 @@ drawbar(Monitor *mon) @@ -1388,37 +1393,37 @@ drawbar(Monitor *m)
if (c->isurgent)
urg |= c->tags; urg |= c->tags;
} }
c = focustop(mon);
- x = 0; - x = 0;
+ x = borderpx; + x = borderpx;
for (i = 0; i < LENGTH(tags); i++) { for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]); w = TEXTW(m, tags[i]);
sel = mon->tagset[mon->seltags] & 1 << i; sel = m->tagset[m->seltags] & 1 << i;
- drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, tags[i], - drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i],
+ drwl_text(pix, font, x, y, w, mh, lrpad / 2, tags[i], + drwl_text(pix, m->font, x, y, w, mh, m->lrpad / 2, tags[i],
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg), urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg),
urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg)); urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg));
@ -91,38 +91,38 @@ index 54273ae..3153bfd 100644
x += w; x += w;
} }
w = TEXTW(mon->ltsymbol); w = TEXTW(m, m->ltsymbol);
- x = drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, - x = drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2,
+ x = drwl_text(pix, font, x, y, w, mh, lrpad / 2, + x = drwl_text(pix, m->font, x, y, w, mh, m->lrpad / 2,
mon->ltsymbol, &normbarfg, &normbarbg); m->ltsymbol, &normbarfg, &normbarbg);
- if ((w = mon->b.width - tw - x) > mon->b.height) { - if ((w = m->b.width - tw - x) > m->b.height) {
+ if ((w = mw - tw - x + borderpx) > mh) { + if ((w = mw - tw - x + borderpx) > mh) {
if (c != NULL) { if ((c = focustop(m)) != NULL) {
- drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, - drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2,
+ drwl_text(pix, font, x, y, w, mh, lrpad / 2, + drwl_text(pix, m->font, x, y, w, mh, m->lrpad / 2,
c ? client_get_title(c) : NULL, client_get_title(c),
mon == selmon ? &selbarfg : &normbarfg, m == selmon ? &selbarfg : &normbarfg,
(mon == selmon && c) ? &selbarbg : &normbarbg); (m == selmon && c) ? &selbarbg : &normbarbg);
if (c && c->isfloating) if (c && c->isfloating)
- drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0, - drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0,
+ drwl_rect(pix, x + boxs, y + boxs, boxw, boxw, 0, + drwl_rect(pix, x + boxs, y + boxs, boxw, boxw, 0,
mon == selmon ? &selbarfg : &normbarfg); m == selmon ? &selbarfg : &normbarfg);
} else { } else
- drwl_rect(pix, x, 0, w, mon->b.height, 1, &normbarbg); - drwl_rect(pix, x, 0, w, m->b.height, 1, &normbarbg);
+ drwl_rect(pix, x, y, w, mh, 1, &normbarbg); + drwl_rect(pix, x, y, w, mh, 1, &normbarbg);
} }
pixman_image_unref(pix);
@@ -3020,7 +3025,7 @@ updatebar(Monitor *m)
m->b.scale = m->wlr_output->scale;
m->lrpad = m->font->height;
- m->b.height = m->font->height + 2;
+ m->b.height = m->font->height + 2 + borderpx * 2;
m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale);
} }
@@ -2664,7 +2669,7 @@ setup(void)
die("Could not load font");
lrpad = font->height;
- bh = font->height + 2;
+ bh = font->height + 2 + borderpx * 2;
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
-- --
2.44.0 2.45.0

View File

@ -1,7 +1,7 @@
From e70e53575b313ce1d63052795ac5722ee7e92d8a Mon Sep 17 00:00:00 2001 From 0b471d8b8adbd79802beb035270f68c92465284c Mon Sep 17 00:00:00 2001
From: oak <oak@petrifiedoak.com> From: oak <oak@petrifiedoak.com>
Date: Thu, 16 May 2024 13:00:18 +0200 Date: Mon, 10 Jun 2024 21:25:56 +0200
Subject: [PATCH] Implement barheight patch Subject: [PATCH] Implement barheight
--- ---
config.def.h | 1 + config.def.h | 1 +
@ -9,7 +9,7 @@ Subject: [PATCH] Implement barheight patch
2 files changed, 2 insertions(+), 1 deletion(-) 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index b09d85b..6d467c3 100644 index c4ab801..869cb7a 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -17,6 +17,7 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca @@ -17,6 +17,7 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
@ -18,21 +18,21 @@ index b09d85b..6d467c3 100644
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
+static const int user_bh = 0; /* 0 means that dwl will calculate bar height, >= 1 means dwl will use user_bh as bar height */ +static const int user_bh = 0; /* 0 means that dwl will calculate bar height, >= 1 means dwl will use user_bh as bar height */
static const char *fonts[] = {"monospace:size=10"}; static const char *fonts[] = {"monospace:size=10"};
static const char *fontattrs = "dpi=96";
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff };
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 2145e55..770c94f 100644 index 61c5727..49eded9 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -2664,7 +2664,7 @@ setup(void) @@ -3037,7 +3037,7 @@ updatebar(Monitor *m)
die("Could not load font");
lrpad = font->height; m->b.scale = m->wlr_output->scale;
- bh = font->height + 2; m->lrpad = m->font->height;
+ bh = user_bh ? user_bh : font->height + 2; - m->b.height = m->font->height + 2;
+ m->b.height = user_bh ? user_bh : m->font->height + 2;
m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale);
}
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
-- --
2.44.0 2.44.0

View File

@ -3,7 +3,7 @@
Add vertical and horizontal space between the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) and the edge of the screen. Add vertical and horizontal space between the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) and the edge of the screen.
### Download ### Download
- [2024-04-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch) (bar 2024-04-14) - [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch) (bar 2024-06-10)
### Authors ### Authors
- [sewn](https://codeberg.org/sewn) - [sewn](https://codeberg.org/sewn)

View File

@ -1,15 +1,16 @@
From 7fe1a19287e1f40d90efd0c3b314c178cb27a571 Mon Sep 17 00:00:00 2001 From 69af490e9ad6213463c043db736547bffddd77d2 Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org> From: sewn <sewn@disroot.org>
Date: Sun, 14 Apr 2024 08:02:56 +0300 Date: Mon, 10 Jun 2024 16:33:52 +0300
Subject: [PATCH] port barpadding patch to bar for dwl Subject: [PATCH] add vertical and horizontal spacing to bar
https://dwm.suckless.org/patches/barpadding/
--- ---
config.def.h | 2 ++ config.def.h | 2 ++
dwl.c | 13 ++++++++----- dwl.c | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-) 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 0be3ad0..423330b 100644 index d0bb5bc..8dc2e85 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -17,6 +17,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca @@ -17,6 +17,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
@ -19,60 +20,43 @@ index 0be3ad0..423330b 100644
+static const int vertpad = 10; /* vertical padding of bar */ +static const int vertpad = 10; /* vertical padding of bar */
+static const int sidepad = 10; /* horizontal padding of bar */ +static const int sidepad = 10; /* horizontal padding of bar */
static const char *fonts[] = {"monospace:size=10"}; static const char *fonts[] = {"monospace:size=10"};
static const char *fontattrs = "dpi=96";
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff };
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 54273ae..b19d1a3 100644 index cd484bd..eec0dd7 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -431,6 +431,7 @@ static struct wl_list mons; @@ -572,8 +572,8 @@ arrangelayers(Monitor *m)
static Monitor *selmon;
static struct fcft_font *font;
+static int vp, sp;
static int bh;
static int lrpad;
static char stext[256];
@@ -569,8 +570,8 @@ arrangelayers(Monitor *m)
return; return;
if (m->showbar) { if (m->showbar) {
- usable_area.height -= m->b.height; - usable_area.height -= m->b.real_height;
- usable_area.y += topbar ? m->b.height : 0; - usable_area.y += topbar ? m->b.real_height : 0;
+ usable_area.height = usable_area.height - vertpad - m->b.height; + usable_area.height -= m->b.real_height + vertpad;
+ usable_area.y = topbar ? usable_area.y + m->b.height + vp : usable_area.y; + usable_area.y += topbar ? m->b.height + vertpad : 0;
} }
/* Arrange exclusive surfaces from top->bottom */ /* Arrange exclusive surfaces from top->bottom */
@@ -1419,8 +1420,8 @@ drawbar(Monitor *mon) @@ -1424,8 +1424,8 @@ drawbar(Monitor *m)
}
pixman_image_unref(pix); pixman_image_unref(pix);
- wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x, wlr_scene_buffer_set_dest_size(m->scene_buffer,
- mon->m.y + (topbar ? 0 : mon->m.height - mon->b.height)); m->b.real_width, m->b.real_height);
+ wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x + sp, - wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x,
+ mon->m.y + vp + (topbar ? 0 : mon->m.height - mon->b.height)); - m->m.y + (topbar ? 0 : m->m.height - m->b.real_height));
wlr_scene_buffer_set_buffer(mon->scene_buffer, &buf->base); + wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x + sidepad,
+ m->m.y + (topbar ? vertpad : m->m.height - m->b.real_height - vertpad));
wlr_scene_buffer_set_buffer(m->scene_buffer, &buf->base);
wlr_buffer_drop(&buf->base); wlr_buffer_drop(&buf->base);
} }
@@ -2665,6 +2666,8 @@ setup(void) @@ -3007,7 +3007,7 @@ updatebar(Monitor *m)
char fontattrs[12];
lrpad = font->height; wlr_output_transformed_resolution(m->wlr_output, &rw, &rh);
bh = font->height + 2;
+ sp = sidepad;
+ vp = (topbar == 1) ? vertpad : - vertpad;
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
@@ -3004,7 +3007,7 @@ updatebardims(Monitor *m)
{
int rw, rh;
wlr_output_effective_resolution(m->wlr_output, &rw, &rh);
- m->b.width = rw; - m->b.width = rw;
+ m->b.width = rw - 2 * sp; + m->b.width = rw - 2 * sidepad;
m->b.height = bh; m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale);
}
if (m->b.scale == m->wlr_output->scale && m->font)
-- --
2.44.0 2.45.0

View File

@ -12,7 +12,7 @@ Additionally, it adds some shortcuts:
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/client-opacity) - [git branch](https://codeberg.org/sevz/dwl/src/branch/client-opacity)
- [2024-03-31](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/client-opacity/client-opacity.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/client-opacity/client-opacity.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From adbc47f25aadfa55d2e042c52f81ba4db08dd57f Mon Sep 17 00:00:00 2001 From 652fd0f8c03724fc7addaa2822913790cbbe89f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me> <leohdz172@proton.me>
Date: Tue, 25 Jul 2023 12:48:22 -0600 Date: Tue, 25 Jul 2023 12:48:22 -0600
@ -10,52 +10,50 @@ Content-Transfer-Encoding: 8bit
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me> Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
--- ---
config.def.h | 10 +++++++--- config.def.h | 9 ++++++---
dwl.c | 38 ++++++++++++++++++++++++++++++++++++++ dwl.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-) 2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..3c79817 100644 index a784eb4f..2e3cdfbb 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff); @@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff); static const float urgentcolor[] = COLOR(0xff0000ff);
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
+static const float default_opacity = 0.75; +static const float default_opacity = 0.75;
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9) #define TAGCOUNT (9)
@@ -21,11 +22,12 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al @@ -21,10 +22,10 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
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 isfloating alpha monitor */ + /* app_id title tags mask isfloating alpha monitor */
/* examples: /* examples: */
- { "Gimp", NULL, 0, 1, -1 }, - { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
+ { "Gimp", NULL, 0, 1, default_alpha, -1 }, - { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
+ { "Alacritty",NULL, 1 << 2, 0, 1.0, -1 }, + { "Gimp_EXAMPLE", NULL, 0, 1, default_opacity, -1 }, /* Start on currently visible tags floating, not tiled */
*/ + { "firefox_EXAMPLE", NULL, 1 << 8, 0, 1.0, -1 }, /* Start on ONLY tag "9" */
- { "firefox", NULL, 1 << 8, 0, -1 },
+ { "firefox", NULL, 1 << 8, 0, default_opacity, -1 },
}; };
/* layout(s) */ /* layout(s) */
@@ -128,6 +130,8 @@ static const Key keys[] = { @@ -130,6 +131,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
+ { MODKEY, XKB_KEY_o, setopacity, {.f = +0.1} }, + { MODKEY, XKB_KEY_o, setopacity, {.f = +0.1f} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, setopacity, {.f = -0.1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, setopacity, {.f = -0.1f} },
{ 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|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 4d19357..1b905ed 100644 index 6f041a0d..83c3cd23 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -133,6 +133,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;
@ -63,7 +61,7 @@ index 4d19357..1b905ed 100644
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -217,6 +218,7 @@ typedef struct { @@ -228,6 +229,7 @@ typedef struct {
const char *title; const char *title;
uint32_t tags; uint32_t tags;
int isfloating; int isfloating;
@ -71,7 +69,7 @@ index 4d19357..1b905ed 100644
int monitor; int monitor;
} Rule; } Rule;
@@ -299,6 +301,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data); @@ -317,6 +319,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
static void requestmonstate(struct wl_listener *listener, void *data); static void requestmonstate(struct wl_listener *listener, void *data);
static void resize(Client *c, struct wlr_box geo, int interact); static void resize(Client *c, struct wlr_box geo, int interact);
static void run(char *startup_cmd); static void run(char *startup_cmd);
@ -79,7 +77,7 @@ index 4d19357..1b905ed 100644
static void setcursor(struct wl_listener *listener, void *data); static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data); static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating); static void setfloating(Client *c, int floating);
@@ -307,6 +310,7 @@ static void setgamma(struct wl_listener *listener, void *data); @@ -325,6 +328,7 @@ static void setgamma(struct wl_listener *listener, void *data);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags); static void setmon(Client *c, Monitor *m, uint32_t newtags);
@ -87,7 +85,7 @@ index 4d19357..1b905ed 100644
static void setpsel(struct wl_listener *listener, void *data); static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data); static void setsel(struct wl_listener *listener, void *data);
static void setup(void); static void setup(void);
@@ -440,6 +444,7 @@ applyrules(Client *c) @@ -464,6 +468,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title)) if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) { && (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
@ -95,15 +93,15 @@ index 4d19357..1b905ed 100644
newtags |= r->tags; newtags |= r->tags;
i = 0; i = 0;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@@ -448,6 +453,7 @@ applyrules(Client *c) @@ -472,6 +477,7 @@ applyrules(Client *c)
} }
} }
} }
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c); + wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
@@ -734,6 +740,9 @@ commitnotify(struct wl_listener *listener, void *data)
@@ -773,6 +779,9 @@ commitnotify(struct wl_listener *listener, void *data)
if (client_surface(c)->mapped && c->mon) if (client_surface(c)->mapped && c->mon)
resize(c, c->geom, (c->isfloating && !c->isfullscreen)); resize(c, c->geom, (c->isfloating && !c->isfullscreen));
@ -113,7 +111,7 @@ index 4d19357..1b905ed 100644
/* mark a pending resize as completed */ /* mark a pending resize as completed */
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
c->resize = 0; c->resize = 0;
@@ -947,6 +956,7 @@ createnotify(struct wl_listener *listener, void *data) @@ -1024,6 +1033,7 @@ createnotify(struct wl_listener *listener, void *data)
c = xdg_surface->data = ecalloc(1, sizeof(*c)); c = xdg_surface->data = ecalloc(1, sizeof(*c));
c->surface.xdg = xdg_surface; c->surface.xdg = xdg_surface;
c->bw = borderpx; c->bw = borderpx;
@ -121,7 +119,7 @@ index 4d19357..1b905ed 100644
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel, wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
@@ -2002,6 +2012,15 @@ run(char *startup_cmd) @@ -2173,6 +2183,15 @@ run(char *startup_cmd)
wl_display_run(dpy); wl_display_run(dpy);
} }
@ -137,7 +135,7 @@ index 4d19357..1b905ed 100644
void void
setcursor(struct wl_listener *listener, void *data) setcursor(struct wl_listener *listener, void *data)
{ {
@@ -2067,6 +2086,7 @@ setfullscreen(Client *c, int fullscreen) @@ -2241,6 +2260,7 @@ setfullscreen(Client *c, int fullscreen)
* client positions are set by the user and cannot be recalculated */ * client positions are set by the user and cannot be recalculated */
resize(c, c->prev, 0); resize(c, c->prev, 0);
} }
@ -145,7 +143,7 @@ index 4d19357..1b905ed 100644
arrange(c->mon); arrange(c->mon);
printstatus(); printstatus();
} }
@@ -2132,6 +2152,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags) @@ -2308,6 +2328,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
} }
@ -169,7 +167,7 @@ index 4d19357..1b905ed 100644
void void
setpsel(struct wl_listener *listener, void *data) setpsel(struct wl_listener *listener, void *data)
{ {
@@ -2842,6 +2879,7 @@ createnotifyx11(struct wl_listener *listener, void *data) @@ -2997,6 +3034,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
c->surface.xwayland = xsurface; c->surface.xwayland = xsurface;
c->type = X11; c->type = X11;
c->bw = borderpx; c->bw = borderpx;
@ -178,5 +176,5 @@ index 4d19357..1b905ed 100644
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11); LISTEN(&xsurface->events.associate, &c->associate, associatex11);
-- --
2.43.0 2.45.2

View File

@ -3,7 +3,7 @@ Generate a coredump if dwl exited abnormally (to be more usefull you need to com
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/coredump) - [git branch](https://codeberg.org/sevz/dwl/src/branch/coredump)
- [2023-11-30](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/coredump/coredump.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/coredump/coredump.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From 38bf34759e5eb3aed9fd14429eee8a1e509c014e Mon Sep 17 00:00:00 2001 From 5ffa5ec3a2a6f90a8a6345c6f1f7b9f197742aad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@protonmail.com> <leohdz172@protonmail.com>
Date: Wed, 5 Oct 2022 23:07:13 -0500 Date: Wed, 5 Oct 2022 23:07:13 -0500
@ -13,7 +13,7 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
1 file changed, 9 insertions(+) 1 file changed, 9 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..62cdb5a 100644 index 6f041a0d..cb52be99 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
@ -24,7 +24,7 @@ index 10d5a5b..62cdb5a 100644
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@@ -334,6 +335,8 @@ static void zoom(const Arg *arg); @@ -353,6 +354,8 @@ static void zoom(const Arg *arg);
/* variables */ /* variables */
static const char broken[] = "broken"; static const char broken[] = "broken";
@ -33,7 +33,7 @@ index 10d5a5b..62cdb5a 100644
static pid_t child_pid = -1; static pid_t child_pid = -1;
static int locked; static int locked;
static void *exclusive_focus; static void *exclusive_focus;
@@ -1972,6 +1975,7 @@ run(char *startup_cmd) @@ -2143,6 +2146,7 @@ run(char *startup_cmd)
if ((child_pid = fork()) < 0) if ((child_pid = fork()) < 0)
die("startup: fork:"); die("startup: fork:");
if (child_pid == 0) { if (child_pid == 0) {
@ -41,7 +41,7 @@ index 10d5a5b..62cdb5a 100644
dup2(piperw[0], STDIN_FILENO); dup2(piperw[0], STDIN_FILENO);
close(piperw[0]); close(piperw[0]);
close(piperw[1]); close(piperw[1]);
@@ -2410,6 +2414,7 @@ void @@ -2547,6 +2551,7 @@ void
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (fork() == 0) { if (fork() == 0) {
@ -49,7 +49,7 @@ index 10d5a5b..62cdb5a 100644
dup2(STDERR_FILENO, STDOUT_FILENO); dup2(STDERR_FILENO, STDOUT_FILENO);
setsid(); setsid();
execvp(((char **)arg->v)[0], (char **)arg->v); execvp(((char **)arg->v)[0], (char **)arg->v);
@@ -2928,6 +2933,10 @@ main(int argc, char *argv[]) @@ -3083,6 +3088,10 @@ main(int argc, char *argv[])
char *startup_cmd = NULL; char *startup_cmd = NULL;
int c; int c;
@ -61,5 +61,5 @@ index 10d5a5b..62cdb5a 100644
if (c == 's') if (c == 's')
startup_cmd = optarg; startup_cmd = optarg;
-- --
2.43.0 2.45.2

View File

@ -6,15 +6,20 @@ Example:
``` ```
static const PassKeypressRule pass_rules[] = { static const PassKeypressRule pass_rules[] = {
ADDPASSRULE("com.obsproject.Studio", MODKEY, XKB_KEY_Home), ADDPASSRULE("com.obsproject.Studio", MODKEY, XKB_KEY_Home),
ADDPASSRULE("discord", 0, XKB_KEY_n),
/* xkb key is case ignored */
}; };
``` ```
will pass `MODKEY + Home` key to obs(flatpak version) regardless of what client is currently focused if any. will pass `MODKEY + Home` key to obs(flatpak version) regardless of what client is currently focused if any.
String "com.obsproject.Studio" should be exact match for appid of the client. To get appid use [dwlmsg](https://codeberg.org/notchoc/dwlmsg), String "com.obsproject.Studio" should be exact match for appid of the client. To get appid use [dwlmsg](https://codeberg.org/notchoc/dwlmsg),
or run stock dwl from a terminal then launch the needed application inside, dwl will print all the info to the stdin. or run stock dwl from a terminal then launch the needed application inside, dwl will print all the info to the stdout.
Note that if popup (like [fuzzel](https://codeberg.org/dnkl/fuzzel)) is focused, no key will be globally passed.
This is done so these menus don't get closed after hitting some of the global keys.
### Download ### Download
- [git branch](https://codeberg.org/korei999/dwl/src/branch/globalkey) - [git branch](https://codeberg.org/korei999/dwl/src/branch/globalkey)
- [2024-06-03](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/globalkey/globalkey.patch) - [2024-06-08](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/globalkey/globalkey.patch)
### Authors ### Authors
- [korei999](https://codeberg.org/korei999) - [korei999](https://codeberg.org/korei999)

View File

@ -1,37 +1,37 @@
From 62ba4065edc0cd10682a32d1ea7b7b066d029e3e Mon Sep 17 00:00:00 2001 From 9c8632f65f0145b5d6bcb4df7830a12eea058838 Mon Sep 17 00:00:00 2001
From: korei999 <ju7t1xe@gmail.com> From: korei999 <ju7t1xe@gmail.com>
Date: Mon, 3 Jun 2024 05:00:55 +0300 Date: Sat, 8 Jun 2024 20:08:22 +0300
Subject: [PATCH] implement globalkey patch Subject: [PATCH] implement globalkey patch
--- ---
config.def.h | 8 ++++++++ config.def.h | 8 ++++++++
dwl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ dwl.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+) 2 files changed, 64 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 8f498d2..c23144b 100644 index a784eb4..59c5267 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -110,6 +110,14 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA @@ -119,6 +119,14 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \ static const char *termcmd[] = { "foot", NULL };
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} } static const char *menucmd[] = { "wmenu-run", NULL };
+#define ADDPASSRULE(S, M, K) {.appid = S, .len = LENGTH(S), .mod = M, .keycode = K} +#define ADDPASSRULE(S, M, K) {.appid = S, .len = LENGTH(S), .key = K}
+
+static const PassKeypressRule pass_rules[] = { +static const PassKeypressRule pass_rules[] = {
+ ADDPASSRULE("com.obsproject.Studio", MODKEY, XKB_KEY_Home), + ADDPASSRULE("com.obsproject.Studio", MODKEY, XKB_KEY_Home),
+ ADDPASSRULE("havoc", 0, XKB_KEY_e), + ADDPASSRULE("com.obsproject.Studio", MODKEY, XKB_KEY_End),
+ /* each instance of havoc will receive input 'e' for example, regardless of which client is focused */ + ADDPASSRULE("com.obsproject.Studio", MODKEY, XKB_KEY_F12),
+ ADDPASSRULE("discord", 0, XKB_KEY_n),
+}; +};
+ +
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ static const Key keys[] = {
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 52bfbc8..d4686d0 100644 index 6f041a0..9625c10 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -217,6 +217,13 @@ typedef struct { @@ -218,6 +218,13 @@ typedef struct {
int x, y; int x, y;
} MonitorRule; } MonitorRule;
@ -39,70 +39,83 @@ index 52bfbc8..d4686d0 100644
+ const char* appid; + const char* appid;
+ size_t len; + size_t len;
+ uint32_t mod; + uint32_t mod;
+ uint32_t keycode; + uint32_t key;
+} PassKeypressRule; +} PassKeypressRule;
+ +
typedef struct { typedef struct {
struct wlr_pointer_constraint_v1 *constraint; struct wlr_pointer_constraint_v1 *constraint;
struct wl_listener destroy; struct wl_listener destroy;
@@ -288,6 +295,7 @@ static void incnmaster(const Arg *arg); @@ -291,6 +298,7 @@ static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym); static int keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data); static void keypress(struct wl_listener *listener, void *data);
+static void keypresspass(struct wlr_keyboard_key_event *event, uint32_t mods, xkb_keysym_t sym); +static void keypressglobal(struct wlr_surface *last_surface, struct wlr_keyboard *keyboard, struct wlr_keyboard_key_event *event, uint32_t mods, xkb_keysym_t keysym);
static void keypressmod(struct wl_listener *listener, void *data); static void keypressmod(struct wl_listener *listener, void *data);
static int keyrepeat(void *data); static int keyrepeat(void *data);
static void killclient(const Arg *arg); static void killclient(const Arg *arg);
@@ -1488,11 +1496,54 @@ keypress(struct wl_listener *listener, void *data) @@ -1516,6 +1524,8 @@ keypress(struct wl_listener *listener, void *data)
/* This event is raised when a key is pressed or released. */
KeyboardGroup *group = wl_container_of(listener, group, key);
struct wlr_keyboard_key_event *event = data;
+ struct wlr_surface *last_surface = seat->keyboard_state.focused_surface;
+ struct wlr_xdg_surface* xdg_surface = NULL;
/* Translate libinput keycode -> xkbcommon */
uint32_t keycode = event->keycode + 8;
@@ -1550,12 +1560,58 @@ keypress(struct wl_listener *listener, void *data)
if (handled)
return; return;
+ /* passed keys won't be repeated */
+ if (last_surface) {
+ xdg_surface = wlr_xdg_surface_try_from_wlr_surface(last_surface);
+ /* don't pass when popup is focused
+ * this is better than having popups (like fuzzel or wmenu) closing while typing in a passed keybind */
+ if (xdg_surface && xdg_surface->role != WLR_XDG_SURFACE_ROLE_POPUP) {
+ keypressglobal(last_surface, &group->wlr_group->keyboard, event, mods, syms[0]);
+ }
+ } else {
+ /* if no surface pass anyway */
+ keypressglobal(last_surface, &group->wlr_group->keyboard, event, mods, syms[0]);
+ }
+
wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard); wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard);
+
+ /* grab the first one sym, there's always one as far as i tested */
+ keypresspass(event, mods, syms[0]);
+
/* Pass unhandled keycodes along to the client. */ /* Pass unhandled keycodes along to the client. */
wlr_seat_keyboard_notify_key(seat, event->time_msec, wlr_seat_keyboard_notify_key(seat, event->time_msec,
event->keycode, event->state); event->keycode, event->state);
} }
+void +void
+keypresspass(struct wlr_keyboard_key_event *event, uint32_t mods, xkb_keysym_t sym) +keypressglobal(struct wlr_surface *last_surface, struct wlr_keyboard *keyboard, struct wlr_keyboard_key_event *event, uint32_t mods, xkb_keysym_t keysym)
+{ +{
+ Client *c = NULL, *savedc = focustop(selmon); + Client *c = NULL, *lastc = focustop(selmon);
+ struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
+ uint32_t keycodes[32] = {0}; + uint32_t keycodes[32] = {0};
+ int reset = false;
+ const char *appid = NULL;
+ +
+ wl_list_for_each(c, &clients, link) {
+ if (c && c != savedc) {
+ const char* appid = client_get_appid(c);
+ if (appid) {
+ for (size_t r = 0; r < LENGTH(pass_rules); r++) { + for (size_t r = 0; r < LENGTH(pass_rules); r++) {
+ if (strncmp(appid, pass_rules[r].appid, pass_rules[r].len) == 0) { + uint32_t rcode = xkb_keysym_to_upper(pass_rules[r].key);
+ + uint32_t pcode = xkb_keysym_to_upper(keysym);
+ if (pass_rules[r].keycode == sym && pass_rules[r].mod == CLEANMASK(mods)) { + /* match key only (case insensitive) ignoring mods */
+ if (rcode == pcode) {
+ wl_list_for_each(c, &clients, link) {
+ if (c && c != lastc) {
+ appid = client_get_appid(c);
+ if (appid && strncmp(appid, pass_rules[r].appid, pass_rules[r].len) == 0) {
+ reset = true;
+ wlr_seat_keyboard_enter(seat, client_surface(c), keycodes, 0, &keyboard->modifiers); + wlr_seat_keyboard_enter(seat, client_surface(c), keycodes, 0, &keyboard->modifiers);
+ wlr_seat_keyboard_notify_key(seat, event->time_msec, event->keycode, event->state); + wlr_seat_keyboard_send_key(seat, event->time_msec, event->keycode, event->state);
+ +
+#ifdef XWAYLAND + goto done;
+ /* https://github.com/hyprwm/Hyprland/blob/main/src/managers/KeybindManager.cpp#L2022 */
+ if (client_is_x11(c)) {
+ seat->keyboard_state.focused_client = NULL;
+ seat->keyboard_state.focused_surface = NULL;
+ }
+#endif
+ }
+ } + }
+ } + }
+ } + }
+ } + }
+ } + }
+ +
+ /* go back to original client, if it existed */ +done:
+ if (savedc) + if (reset)
+ wlr_seat_keyboard_enter(seat, client_surface(savedc), keycodes, 0, &keyboard->modifiers); + wlr_seat_keyboard_enter(seat, last_surface, keycodes, 0, &keyboard->modifiers);
+ else
+ wlr_seat_keyboard_clear_focus(seat);
+} +}
+ +
void void

View File

@ -3,7 +3,7 @@ Hide all clients (and layer surfaces) behind the current client if it is fullscr
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/hide-behind-fullscreen) - [git branch](https://codeberg.org/sevz/dwl/src/branch/hide-behind-fullscreen)
- [2023-11-25](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide-behind-fullscreen/hide-behind-fullscreen.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide-behind-fullscreen/hide-behind-fullscreen.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From da92f84aa261051b410a0ffcfc80b4d6c8c7dfae Mon Sep 17 00:00:00 2001 From a194d37cd31ac780d93fdbf2e3d0ee5ec9c43696 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@protonmail.com> <leohdz172@protonmail.com>
Date: Sun, 10 Apr 2022 22:38:53 -0500 Date: Sun, 10 Apr 2022 22:38:53 -0500
@ -14,23 +14,23 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
2 files changed, 18 insertions(+), 2 deletions(-) 2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..b219c0d 100644 index a784eb4f..50b3cae4 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -12,7 +12,7 @@ static const float bordercolor[] = COLOR(0x444444ff); @@ -12,7 +12,7 @@ static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff); static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff); static const float urgentcolor[] = COLOR(0xff0000ff);
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
-static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ -static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
+static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 0.0}; /* You can also use glsl colors */ +static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 0.0f}; /* You can also use glsl colors */
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9) #define TAGCOUNT (9)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..0b8d03a 100644 index 6f041a0d..c530a3a0 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -455,7 +455,9 @@ applyrules(Client *c) @@ -478,7 +478,9 @@ applyrules(Client *c)
void void
arrange(Monitor *m) arrange(Monitor *m)
{ {
@ -38,12 +38,12 @@ index 10d5a5b..0b8d03a 100644
+ LayerSurface *l; + LayerSurface *l;
+ Client *c, *sel = focustop(selmon); + Client *c, *sel = focustop(selmon);
+ int i; + int i;
wl_list_for_each(c, &clients, link) {
if (c->mon == m) {
wlr_scene_node_set_enabled(&c->scene->node, VISIBLEON(c, m));
@@ -468,6 +470,20 @@ arrange(Monitor *m)
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); if (!m->wlr_output->enabled)
return;
@@ -509,6 +511,20 @@ arrange(Monitor *m)
: c->scene->node.parent);
}
+ if (sel && sel->isfullscreen && VISIBLEON(sel, m)) { + if (sel && sel->isfullscreen && VISIBLEON(sel, m)) {
+ for (i = 3; i > ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i--) + for (i = 3; i > ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i--)
@ -61,7 +61,7 @@ index 10d5a5b..0b8d03a 100644
+ +
if (m->lt[m->sellt]->arrange) if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m); m->lt[m->sellt]->arrange(m);
motionnotify(0); motionnotify(0, NULL, 0, 0, 0, 0);
-- --
2.43.0 2.45.2

View File

@ -3,7 +3,7 @@ Hide all clients behind the focused one in the monocle layout
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/hide-behind-monocle) - [git branch](https://codeberg.org/sevz/dwl/src/branch/hide-behind-monocle)
- [2023-11-25](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide-behind-monocle/hide-behind-monocle.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide-behind-monocle/hide-behind-monocle.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From 1ba8580b2596c14b9305f1e7cb8d88f54367af59 Mon Sep 17 00:00:00 2001 From cd89b1f0c2cc9f5cb7a33d332854f56448616611 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me> <leohdz172@proton.me>
Date: Sat, 8 Jul 2023 17:25:16 -0600 Date: Sat, 8 Jul 2023 17:25:16 -0600
@ -13,10 +13,10 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
1 file changed, 52 insertions(+), 32 deletions(-) 1 file changed, 52 insertions(+), 32 deletions(-)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..07659ea 100644 index 6f041a0d..8c1abc6c 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -267,9 +267,10 @@ static Monitor *dirtomon(enum wlr_direction dir); @@ -284,9 +284,10 @@ static Monitor *dirtomon(enum wlr_direction dir);
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
@ -28,7 +28,7 @@ index 10d5a5b..07659ea 100644
static void incnmaster(const Arg *arg); static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym); static int keybinding(uint32_t mods, xkb_keysym_t sym);
@@ -464,7 +465,7 @@ arrange(Monitor *m) @@ -491,7 +492,7 @@ arrange(Monitor *m)
} }
wlr_scene_node_set_enabled(&m->fullscreen_bg->node, wlr_scene_node_set_enabled(&m->fullscreen_bg->node,
@ -37,7 +37,7 @@ index 10d5a5b..07659ea 100644
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
@@ -700,7 +701,7 @@ closemon(Monitor *m) @@ -739,7 +740,7 @@ closemon(Monitor *m)
if (c->mon == m) if (c->mon == m)
setmon(c, selmon, c->tags); setmon(c, selmon, c->tags);
} }
@ -46,25 +46,25 @@ index 10d5a5b..07659ea 100644
printstatus(); printstatus();
} }
@@ -1030,7 +1031,7 @@ void @@ -1144,7 +1145,7 @@ void
destroydragicon(struct wl_listener *listener, void *data) destroydragicon(struct wl_listener *listener, void *data)
{ {
/* Focus enter isn't sent during drag, so refocus the focused node. */ /* Focus enter isn't sent during drag, so refocus the focused node. */
- focusclient(focustop(selmon), 1); - focusclient(focustop(selmon), 1);
+ focusclient(focustop(selmon, 0), 1); + focusclient(focustop(selmon, 0), 1);
motionnotify(0); motionnotify(0, NULL, 0, 0, 0, 0);
} }
@@ -1066,7 +1067,7 @@ destroylock(SessionLock *lock, int unlock) @@ -1180,7 +1181,7 @@ destroylock(SessionLock *lock, int unlock)
wlr_scene_node_set_enabled(&locked_bg->node, 0); wlr_scene_node_set_enabled(&locked_bg->node, 0);
- focusclient(focustop(selmon), 0); - focusclient(focustop(selmon), 0);
+ focusclient(focustop(selmon, 0), 0); + focusclient(focustop(selmon, 0), 0);
motionnotify(0); motionnotify(0, NULL, 0, 0, 0, 0);
destroy: destroy:
@@ -1095,7 +1096,7 @@ destroylocksurface(struct wl_listener *listener, void *data) @@ -1209,7 +1210,7 @@ destroylocksurface(struct wl_listener *listener, void *data)
surface = wl_container_of(cur_lock->surfaces.next, surface, link); surface = wl_container_of(cur_lock->surfaces.next, surface, link);
client_notify_enter(surface->surface, wlr_seat_get_keyboard(seat)); client_notify_enter(surface->surface, wlr_seat_get_keyboard(seat));
} else if (!locked) { } else if (!locked) {
@ -73,7 +73,7 @@ index 10d5a5b..07659ea 100644
} else { } else {
wlr_seat_keyboard_clear_focus(seat); wlr_seat_keyboard_clear_focus(seat);
} }
@@ -1186,6 +1187,7 @@ focusclient(Client *c, int lift) @@ -1326,6 +1327,7 @@ focusclient(Client *c, int lift)
wl_list_insert(&fstack, &c->flink); wl_list_insert(&fstack, &c->flink);
selmon = c->mon; selmon = c->mon;
c->isurgent = 0; c->isurgent = 0;
@ -81,7 +81,7 @@ index 10d5a5b..07659ea 100644
client_restack_surface(c); client_restack_surface(c);
/* Don't change border color if there is an exclusive focus or we are /* Don't change border color if there is an exclusive focus or we are
@@ -1240,14 +1242,14 @@ focusmon(const Arg *arg) @@ -1380,14 +1382,14 @@ focusmon(const Arg *arg)
selmon = dirtomon(arg->i); selmon = dirtomon(arg->i);
while (!selmon->wlr_output->enabled && i++ < nmons); while (!selmon->wlr_output->enabled && i++ < nmons);
} }
@ -95,10 +95,10 @@ index 10d5a5b..07659ea 100644
/* Focus the next or previous client (in tiling order) on selmon */ /* Focus the next or previous client (in tiling order) on selmon */
- Client *c, *sel = focustop(selmon); - Client *c, *sel = focustop(selmon);
+ Client *c, *sel = focustop(selmon, 0); + Client *c, *sel = focustop(selmon, 0);
if (!sel || sel->isfullscreen) if (!sel || (sel->isfullscreen && !client_has_children(sel)))
return; return;
if (arg->i > 0) { if (arg->i > 0) {
@@ -1273,12 +1275,15 @@ focusstack(const Arg *arg) @@ -1413,12 +1415,15 @@ focusstack(const Arg *arg)
* will focus the topmost client of this mon, when actually will * will focus the topmost client of this mon, when actually will
* only return that client */ * only return that client */
Client * Client *
@ -116,7 +116,7 @@ index 10d5a5b..07659ea 100644
} }
return NULL; return NULL;
} }
@@ -1311,6 +1316,22 @@ handlesig(int signo) @@ -1451,6 +1456,22 @@ handlesig(int signo)
} }
} }
@ -139,7 +139,7 @@ index 10d5a5b..07659ea 100644
void void
incnmaster(const Arg *arg) incnmaster(const Arg *arg)
{ {
@@ -1449,7 +1470,7 @@ keyrepeat(void *data) @@ -1589,7 +1610,7 @@ keyrepeat(void *data)
void void
killclient(const Arg *arg) killclient(const Arg *arg)
{ {
@ -148,7 +148,7 @@ index 10d5a5b..07659ea 100644
if (sel) if (sel)
client_send_close(sel); client_send_close(sel);
} }
@@ -1584,8 +1605,7 @@ monocle(Monitor *m) @@ -1722,8 +1743,7 @@ monocle(Monitor *m)
} }
if (n) if (n)
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n);
@ -158,7 +158,7 @@ index 10d5a5b..07659ea 100644
} }
void void
@@ -1813,7 +1833,7 @@ printstatus(void) @@ -1984,7 +2004,7 @@ printstatus(void)
if (c->isurgent) if (c->isurgent)
urg |= c->tags; urg |= c->tags;
} }
@ -167,7 +167,7 @@ index 10d5a5b..07659ea 100644
title = client_get_title(c); title = client_get_title(c);
appid = client_get_appid(c); appid = client_get_appid(c);
printf("%s title %s\n", m->wlr_output->name, title ? title : broken); printf("%s title %s\n", m->wlr_output->name, title ? title : broken);
@@ -2129,7 +2149,7 @@ setmon(Client *c, Monitor *m, uint32_t newtags) @@ -2305,7 +2325,7 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
setfloating(c, c->isfloating); setfloating(c, c->isfloating);
} }
@ -176,7 +176,7 @@ index 10d5a5b..07659ea 100644
} }
void void
@@ -2431,12 +2451,12 @@ startdrag(struct wl_listener *listener, void *data) @@ -2568,12 +2588,12 @@ startdrag(struct wl_listener *listener, void *data)
void void
tag(const Arg *arg) tag(const Arg *arg)
{ {
@ -191,7 +191,7 @@ index 10d5a5b..07659ea 100644
arrange(selmon); arrange(selmon);
printstatus(); printstatus();
} }
@@ -2444,7 +2464,7 @@ tag(const Arg *arg) @@ -2581,7 +2601,7 @@ tag(const Arg *arg)
void void
tagmon(const Arg *arg) tagmon(const Arg *arg)
{ {
@ -200,7 +200,7 @@ index 10d5a5b..07659ea 100644
if (sel) if (sel)
setmon(sel, dirtomon(arg->i), 0); setmon(sel, dirtomon(arg->i), 0);
} }
@@ -2485,7 +2505,7 @@ tile(Monitor *m) @@ -2623,7 +2643,7 @@ tile(Monitor *m)
void void
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
@ -209,7 +209,7 @@ index 10d5a5b..07659ea 100644
/* return if fullscreen */ /* return if fullscreen */
if (sel && !sel->isfullscreen) if (sel && !sel->isfullscreen)
setfloating(sel, !sel->isfloating); setfloating(sel, !sel->isfloating);
@@ -2494,7 +2514,7 @@ togglefloating(const Arg *arg) @@ -2632,7 +2652,7 @@ togglefloating(const Arg *arg)
void void
togglefullscreen(const Arg *arg) togglefullscreen(const Arg *arg)
{ {
@ -218,7 +218,7 @@ index 10d5a5b..07659ea 100644
if (sel) if (sel)
setfullscreen(sel, !sel->isfullscreen); setfullscreen(sel, !sel->isfullscreen);
} }
@@ -2503,12 +2523,12 @@ void @@ -2641,12 +2661,12 @@ void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {
uint32_t newtags; uint32_t newtags;
@ -233,7 +233,7 @@ index 10d5a5b..07659ea 100644
arrange(selmon); arrange(selmon);
printstatus(); printstatus();
} }
@@ -2521,7 +2541,7 @@ toggleview(const Arg *arg) @@ -2659,7 +2679,7 @@ toggleview(const Arg *arg)
return; return;
selmon->tagset[selmon->seltags] = newtagset; selmon->tagset[selmon->seltags] = newtagset;
@ -242,16 +242,16 @@ index 10d5a5b..07659ea 100644
arrange(selmon); arrange(selmon);
printstatus(); printstatus();
} }
@@ -2545,7 +2565,7 @@ unmaplayersurfacenotify(struct wl_listener *listener, void *data) @@ -2683,7 +2703,7 @@ unmaplayersurfacenotify(struct wl_listener *listener, void *data)
if (l->layer_surface->output && (l->mon = l->layer_surface->output->data)) if (l->layer_surface->output && (l->mon = l->layer_surface->output->data))
arrangelayers(l->mon); arrangelayers(l->mon);
if (l->layer_surface->surface == seat->keyboard_state.focused_surface) if (l->layer_surface->surface == seat->keyboard_state.focused_surface)
- focusclient(focustop(selmon), 1); - focusclient(focustop(selmon), 1);
+ focusclient(focustop(selmon, 0), 1); + focusclient(focustop(selmon, 0), 1);
motionnotify(0); motionnotify(0, NULL, 0, 0, 0, 0);
} }
@@ -2562,7 +2582,7 @@ unmapnotify(struct wl_listener *listener, void *data) @@ -2700,7 +2720,7 @@ unmapnotify(struct wl_listener *listener, void *data)
if (client_is_unmanaged(c)) { if (client_is_unmanaged(c)) {
if (c == exclusive_focus) { if (c == exclusive_focus) {
exclusive_focus = NULL; exclusive_focus = NULL;
@ -260,7 +260,7 @@ index 10d5a5b..07659ea 100644
} }
} else { } else {
wl_list_remove(&c->link); wl_list_remove(&c->link);
@@ -2643,7 +2663,7 @@ updatemons(struct wl_listener *listener, void *data) @@ -2781,7 +2801,7 @@ updatemons(struct wl_listener *listener, void *data)
/* Don't move clients to the left output when plugging monitors */ /* Don't move clients to the left output when plugging monitors */
arrange(m); arrange(m);
/* make sure fullscreen clients have the right size */ /* make sure fullscreen clients have the right size */
@ -269,7 +269,7 @@ index 10d5a5b..07659ea 100644
resize(c, m->m, 0); resize(c, m->m, 0);
/* Try to re-set the gamma LUT when updating monitors, /* Try to re-set the gamma LUT when updating monitors,
@@ -2659,7 +2679,7 @@ updatemons(struct wl_listener *listener, void *data) @@ -2797,7 +2817,7 @@ updatemons(struct wl_listener *listener, void *data)
if (!c->mon && client_surface(c)->mapped) if (!c->mon && client_surface(c)->mapped)
setmon(c, selmon, c->tags); setmon(c, selmon, c->tags);
} }
@ -278,7 +278,7 @@ index 10d5a5b..07659ea 100644
if (selmon->lock_surface) { if (selmon->lock_surface) {
client_notify_enter(selmon->lock_surface->surface, client_notify_enter(selmon->lock_surface->surface,
wlr_seat_get_keyboard(seat)); wlr_seat_get_keyboard(seat));
@@ -2681,7 +2701,7 @@ void @@ -2819,7 +2839,7 @@ void
updatetitle(struct wl_listener *listener, void *data) updatetitle(struct wl_listener *listener, void *data)
{ {
Client *c = wl_container_of(listener, c, set_title); Client *c = wl_container_of(listener, c, set_title);
@ -287,7 +287,7 @@ index 10d5a5b..07659ea 100644
printstatus(); printstatus();
} }
@@ -2691,7 +2711,7 @@ urgent(struct wl_listener *listener, void *data) @@ -2829,7 +2849,7 @@ urgent(struct wl_listener *listener, void *data)
struct wlr_xdg_activation_v1_request_activate_event *event = data; struct wlr_xdg_activation_v1_request_activate_event *event = data;
Client *c = NULL; Client *c = NULL;
toplevel_from_wlr_surface(event->surface, &c, NULL); toplevel_from_wlr_surface(event->surface, &c, NULL);
@ -296,7 +296,7 @@ index 10d5a5b..07659ea 100644
return; return;
c->isurgent = 1; c->isurgent = 1;
@@ -2709,7 +2729,7 @@ view(const Arg *arg) @@ -2847,7 +2867,7 @@ view(const Arg *arg)
selmon->seltags ^= 1; /* toggle sel tagset */ selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK) if (arg->ui & TAGMASK)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
@ -305,7 +305,7 @@ index 10d5a5b..07659ea 100644
arrange(selmon); arrange(selmon);
printstatus(); printstatus();
} }
@@ -2767,7 +2787,7 @@ xytonode(double x, double y, struct wlr_surface **psurface, @@ -2918,7 +2938,7 @@ xytonode(double x, double y, struct wlr_surface **psurface,
void void
zoom(const Arg *arg) zoom(const Arg *arg)
{ {
@ -314,7 +314,7 @@ index 10d5a5b..07659ea 100644
if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange || sel->isfloating) if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange || sel->isfloating)
return; return;
@@ -2880,7 +2900,7 @@ sethints(struct wl_listener *listener, void *data) @@ -3035,7 +3055,7 @@ sethints(struct wl_listener *listener, void *data)
{ {
Client *c = wl_container_of(listener, c, set_hints); Client *c = wl_container_of(listener, c, set_hints);
struct wlr_surface *surface = client_surface(c); struct wlr_surface *surface = client_surface(c);
@ -324,5 +324,5 @@ index 10d5a5b..07659ea 100644
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
-- --
2.43.0 2.45.2

View File

@ -4,7 +4,7 @@ Prevent [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) from drawing tags w
It also stops drawing empty rectangles on the bar for non-vacant tags as there is no need anymore to distinguish vacant tags and it offers a more visible contrast than if there were filled/empty rectangles. It also stops drawing empty rectangles on the bar for non-vacant tags as there is no need anymore to distinguish vacant tags and it offers a more visible contrast than if there were filled/empty rectangles.
### Download ### Download
- [2024-04-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide_vacant_tags/hide_vacant_tags.patch) (bar 2024-04-14) - [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide_vacant_tags/hide_vacant_tags.patch) (bar 2024-06-10)
### Authors ### Authors
- [sewn](https://codeberg.org/sewn) - [sewn](https://codeberg.org/sewn)

View File

@ -1,17 +1,18 @@
From 6337cf36554eda98f3d160ef4fdd12eb042f4120 Mon Sep 17 00:00:00 2001 From be3ef9ff5373e004cd8ed564a9671cd190e1db40 Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org> From: sewn <sewn@disroot.org>
Date: Sun, 14 Apr 2024 07:58:53 +0300 Date: Mon, 10 Jun 2024 14:50:07 +0300
Subject: [PATCH] port hide vacant tags patch Subject: [PATCH] hide vacant tags
https://dwm.suckless.org/patches/hide_vacant_tags/
--- ---
dwl.c | 25 ++++++++++++++++--------- dwl.c | 23 ++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-) 1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 54273ae..7db6273 100644 index cd484bd..de474a6 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -651,7 +651,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) { @@ -654,7 +654,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) {
void void
buttonpress(struct wl_listener *listener, void *data) buttonpress(struct wl_listener *listener, void *data)
{ {
@ -20,46 +21,43 @@ index 54273ae..7db6273 100644
unsigned int click; unsigned int click;
struct wlr_pointer_button_event *event = data; struct wlr_pointer_button_event *event = data;
struct wlr_keyboard *keyboard; struct wlr_keyboard *keyboard;
@@ -672,9 +672,17 @@ buttonpress(struct wl_listener *listener, void *data) @@ -675,9 +675,16 @@ buttonpress(struct wl_listener *listener, void *data)
if ((node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) && if (!c && (node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) &&
(buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) { (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
x = selmon->m.x; x = selmon->m.x;
- do - do
- x += TEXTW(tags[i]);
- while (cursor->x >= x && ++i < LENGTH(tags));
+ wl_list_for_each(c, &clients, link) { + wl_list_for_each(c, &clients, link) {
+ if (c->mon != selmon) + if (c->mon != selmon)
+ continue; + continue;
+ occ |= c->tags == TAGMASK ? 0 : c->tags; + occ |= c->tags == TAGMASK ? 0 : c->tags;
+ } + }
+ do { + do {
+ /* Do not reserve space for vacant tags */
+ if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i)) + if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i))
+ continue; + continue;
+ x += TEXTW(tags[i]); x += TEXTW(selmon, tags[i]);
- while (cursor->x >= x && ++i < LENGTH(tags));
+ } while (cursor->x >= x && ++i < LENGTH(tags)); + } while (cursor->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) { if (i < LENGTH(tags)) {
click = ClkTagBar; click = ClkTagBar;
arg.ui = 1 << i; arg.ui = 1 << i;
@@ -1379,13 +1387,16 @@ drawbar(Monitor *mon) @@ -1384,23 +1391,21 @@ drawbar(Monitor *m)
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (c->mon != mon) if (c->mon != m)
continue; continue;
- occ |= c->tags; - occ |= c->tags;
+ occ |= c->tags == TAGMASK ? 0 : c->tags; + occ |= c->tags == TAGMASK ? 0 : c->tags;
if (c->isurgent) if (c->isurgent)
urg |= c->tags; urg |= c->tags;
} }
c = focustop(mon);
x = 0; x = 0;
for (i = 0; i < LENGTH(tags); i++) { for (i = 0; i < LENGTH(tags); i++) {
+ /* Do not draw vacant tags */ - w = TEXTW(m, tags[i]);
+ if(!(occ & 1 << i || mon->tagset[mon->seltags] & 1 << i)) sel = m->tagset[m->seltags] & 1 << i;
+ if(!(occ & 1 << i || sel))
+ continue; + continue;
w = TEXTW(tags[i]); + w = TEXTW(m, tags[i]);
sel = mon->tagset[mon->seltags] & 1 << i;
@@ -1393,10 +1404,6 @@ drawbar(Monitor *mon) drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i],
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg), urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg),
urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg)); urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg));
@ -71,5 +69,5 @@ index 54273ae..7db6273 100644
} }
-- --
2.44.0 2.45.0

View File

@ -1,4 +1,4 @@
From 5bbb9d70ab0a8322d1556ac0983eb3140b1c5dcd Mon Sep 17 00:00:00 2001 From 8f08405c8b620f00be765d98edc2ee4bd0b71e58 Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me> From: choc <notchoc@proton.me>
Date: Mon, 23 Oct 2023 10:35:17 +0800 Date: Mon, 23 Oct 2023 10:35:17 +0800
Subject: [PATCH] implement dwl-ipc-unstable-v2 Subject: [PATCH] implement dwl-ipc-unstable-v2
@ -45,10 +45,10 @@ index a67fdd3..2b45b2c 100644
config.h: config.h:
cp config.def.h $@ cp config.def.h $@
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 9009517..3467fed 100644 index a784eb4..d615bf2 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -122,6 +122,7 @@ static const Key keys[] = { @@ -124,6 +124,7 @@ static const Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
@ -57,7 +57,7 @@ index 9009517..3467fed 100644
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index d508d79..5f8af37 100644 index 6f041a0..5e7f342 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -64,6 +64,7 @@ @@ -64,6 +64,7 @@
@ -81,7 +81,7 @@ index d508d79..5f8af37 100644
typedef struct { typedef struct {
uint32_t mod; uint32_t mod;
xkb_keysym_t keysym; xkb_keysym_t keysym;
@@ -186,6 +193,7 @@ typedef struct { @@ -187,6 +194,7 @@ typedef struct {
struct Monitor { struct Monitor {
struct wl_list link; struct wl_list link;
@ -89,9 +89,9 @@ index d508d79..5f8af37 100644
struct wlr_output *wlr_output; struct wlr_output *wlr_output;
struct wlr_scene_output *scene_output; struct wlr_scene_output *scene_output;
struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */ struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */
@@ -278,6 +286,17 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data); @@ -281,6 +289,17 @@ static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionmgr(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data);
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir); static Monitor *dirtomon(enum wlr_direction dir);
+static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id); +static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id);
+static void dwl_ipc_manager_destroy(struct wl_resource *resource); +static void dwl_ipc_manager_destroy(struct wl_resource *resource);
@ -107,7 +107,7 @@ index d508d79..5f8af37 100644
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
@@ -330,6 +349,7 @@ static void startdrag(struct wl_listener *listener, void *data); @@ -333,6 +352,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);
@ -115,7 +115,7 @@ index d508d79..5f8af37 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);
@@ -405,6 +425,9 @@ static struct wlr_box sgeom; @@ -407,6 +427,9 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
@ -125,7 +125,7 @@ index d508d79..5f8af37 100644
#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);
@@ -684,6 +707,10 @@ cleanupmon(struct wl_listener *listener, void *data) @@ -698,6 +721,10 @@ cleanupmon(struct wl_listener *listener, void *data)
LayerSurface *l, *tmp; LayerSurface *l, *tmp;
size_t i; size_t i;
@ -136,7 +136,7 @@ index d508d79..5f8af37 100644
/* m->layers[i] are intentionally not unlinked */ /* m->layers[i] are intentionally not unlinked */
for (i = 0; i < LENGTH(m->layers); i++) { for (i = 0; i < LENGTH(m->layers); i++) {
wl_list_for_each_safe(l, tmp, &m->layers[i], link) wl_list_for_each_safe(l, tmp, &m->layers[i], link)
@@ -876,6 +903,8 @@ createmon(struct wl_listener *listener, void *data) @@ -927,6 +954,8 @@ createmon(struct wl_listener *listener, void *data)
m = wlr_output->data = ecalloc(1, sizeof(*m)); m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output; m->wlr_output = wlr_output;
@ -145,7 +145,7 @@ index d508d79..5f8af37 100644
for (i = 0; i < LENGTH(m->layers); i++) for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]); wl_list_init(&m->layers[i]);
@@ -1233,6 +1262,190 @@ dirtomon(enum wlr_direction dir) @@ -1296,6 +1325,190 @@ dirtomon(enum wlr_direction dir)
return selmon; return selmon;
} }
@ -336,7 +336,7 @@ index d508d79..5f8af37 100644
void void
focusclient(Client *c, int lift) focusclient(Client *c, int lift)
{ {
@@ -1905,41 +2118,9 @@ void @@ -1971,41 +2184,9 @@ void
printstatus(void) printstatus(void)
{ {
Monitor *m = NULL; Monitor *m = NULL;
@ -380,7 +380,7 @@ index d508d79..5f8af37 100644
} }
void void
@@ -2502,6 +2683,7 @@ setup(void) @@ -2522,6 +2703,7 @@ setup(void)
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest); LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend)); wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend));
@ -388,7 +388,7 @@ index d508d79..5f8af37 100644
/* Make sure XWayland clients don't connect to the parent X server, /* Make sure XWayland clients don't connect to the parent X server,
* e.g when running in the x11 backend or the wayland backend and the * e.g when running in the x11 backend or the wayland backend and the
@@ -2600,6 +2782,13 @@ tile(Monitor *m) @@ -2620,6 +2802,13 @@ tile(Monitor *m)
} }
} }
@ -590,5 +590,5 @@ index 0000000..0a6e7e5
+ </interface> + </interface>
+</protocol> +</protocol>
-- --
2.44.0 2.43.0

View File

@ -3,7 +3,7 @@ Use keycodes instead of keysyms. This way, input is independent from keyboard la
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/keycodes) - [git branch](https://codeberg.org/sevz/dwl/src/branch/keycodes)
- [2023-11-25](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/keycodes/keycodes.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/keycodes/keycodes.patch)
### Config after patching ### Config after patching
(run in DWL source directory) (run in DWL source directory)
@ -11,7 +11,6 @@ Use keycodes instead of keysyms. This way, input is independent from keyboard la
export XKB_DEFAULT_VARIANT=yourbestkeyboardlayout export XKB_DEFAULT_VARIANT=yourbestkeyboardlayout
cc -lxkbcommon -o generate-keys generate-keys.c cc -lxkbcommon -o generate-keys generate-keys.c
./generate-keys ./generate-keys
sudo make install
``` ```
### Authors ### Authors

View File

@ -1,4 +1,4 @@
From 8e58ce22afe6a7cca34ff69d8862c89497156f40 Mon Sep 17 00:00:00 2001 From bf026b489f4de99030b424226a6b5877fcbc26ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me> <leohdz172@proton.me>
Date: Fri, 4 Jun 2021 16:51:01 -0500 Date: Fri, 4 Jun 2021 16:51:01 -0500
@ -16,10 +16,10 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
create mode 100644 keys.h create mode 100644 keys.h
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..40e13af 100644 index a784eb4f..8af07495 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -104,11 +104,11 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA @@ -106,11 +106,11 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */ /* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_ALT #define MODKEY WLR_MODIFIER_ALT
@ -34,9 +34,9 @@ index a8ed61d..40e13af 100644
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
@@ -117,51 +117,52 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA @@ -119,51 +119,52 @@ 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 "keys.h" +#include "keys.h"
static const Key keys[] = { static const Key keys[] = {
@ -48,8 +48,8 @@ index a8ed61d..40e13af 100644
- { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, - { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
- { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, - { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
- { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, - { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
- { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, - { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
- { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, - { 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|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, - { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
@ -82,8 +82,8 @@ index a8ed61d..40e13af 100644
+ { MODKEY, Key_k, focusstack, {.i = -1} }, + { MODKEY, Key_k, focusstack, {.i = -1} },
+ { MODKEY, Key_i, incnmaster, {.i = +1} }, + { MODKEY, Key_i, incnmaster, {.i = +1} },
+ { MODKEY, Key_d, incnmaster, {.i = -1} }, + { MODKEY, Key_d, incnmaster, {.i = -1} },
+ { MODKEY, Key_h, setmfact, {.f = -0.05} }, + { MODKEY, Key_h, setmfact, {.f = -0.05f} },
+ { MODKEY, Key_l, setmfact, {.f = +0.05} }, + { MODKEY, Key_l, setmfact, {.f = +0.05f} },
+ { MODKEY, Key_Return, zoom, {0} }, + { MODKEY, Key_Return, zoom, {0} },
+ { MODKEY, Key_Tab, view, {0} }, + { MODKEY, Key_Tab, view, {0} },
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_c, killclient, {0} }, + { MODKEY|WLR_MODIFIER_SHIFT, Key_c, killclient, {0} },
@ -127,10 +127,10 @@ index a8ed61d..40e13af 100644
static const Button buttons[] = { static const Button buttons[] = {
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..33fb251 100644 index 6f041a0d..ba743c6d 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -138,7 +138,7 @@ typedef struct { @@ -143,7 +143,7 @@ typedef struct {
typedef struct { typedef struct {
uint32_t mod; uint32_t mod;
@ -139,7 +139,7 @@ index 10d5a5b..33fb251 100644
void (*func)(const Arg *); void (*func)(const Arg *);
const Arg arg; const Arg arg;
} Key; } Key;
@@ -147,9 +147,8 @@ typedef struct { @@ -152,9 +152,8 @@ typedef struct {
struct wl_list link; struct wl_list link;
struct wlr_keyboard_group *wlr_group; struct wlr_keyboard_group *wlr_group;
@ -151,7 +151,7 @@ index 10d5a5b..33fb251 100644
struct wl_event_source *key_repeat_source; struct wl_event_source *key_repeat_source;
struct wl_listener modifiers; struct wl_listener modifiers;
@@ -272,7 +271,7 @@ static void fullscreennotify(struct wl_listener *listener, void *data); @@ -289,7 +288,7 @@ static void fullscreennotify(struct wl_listener *listener, void *data);
static void handlesig(int signo); static void handlesig(int signo);
static void incnmaster(const Arg *arg); static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
@ -160,7 +160,7 @@ index 10d5a5b..33fb251 100644
static void keypress(struct wl_listener *listener, void *data); static void keypress(struct wl_listener *listener, void *data);
static void keypressmod(struct wl_listener *listener, void *data); static void keypressmod(struct wl_listener *listener, void *data);
static int keyrepeat(void *data); static int keyrepeat(void *data);
@@ -1351,7 +1350,7 @@ inputdevice(struct wl_listener *listener, void *data) @@ -1491,7 +1490,7 @@ inputdevice(struct wl_listener *listener, void *data)
} }
int int
@ -169,7 +169,7 @@ index 10d5a5b..33fb251 100644
{ {
/* /*
* Here we handle compositor keybindings. This is when the compositor is * Here we handle compositor keybindings. This is when the compositor is
@@ -1361,7 +1360,7 @@ keybinding(uint32_t mods, xkb_keysym_t sym) @@ -1501,7 +1500,7 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
const Key *k; const Key *k;
for (k = keys; k < END(keys); k++) { for (k = keys; k < END(keys); k++) {
if (CLEANMASK(mods) == CLEANMASK(k->mod) if (CLEANMASK(mods) == CLEANMASK(k->mod)
@ -178,7 +178,7 @@ index 10d5a5b..33fb251 100644
k->func(&k->arg); k->func(&k->arg);
return 1; return 1;
} }
@@ -1372,17 +1371,12 @@ keybinding(uint32_t mods, xkb_keysym_t sym) @@ -1512,17 +1511,12 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
void void
keypress(struct wl_listener *listener, void *data) keypress(struct wl_listener *listener, void *data)
{ {
@ -196,7 +196,7 @@ index 10d5a5b..33fb251 100644
int handled = 0; int handled = 0;
uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard); uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard);
@@ -1391,19 +1385,16 @@ keypress(struct wl_listener *listener, void *data) @@ -1531,19 +1525,16 @@ keypress(struct wl_listener *listener, void *data)
/* On _press_ if there is no active screen locker, /* On _press_ if there is no active screen locker,
* attempt to process a compositor keybinding. */ * attempt to process a compositor keybinding. */
@ -220,7 +220,7 @@ index 10d5a5b..33fb251 100644
wl_event_source_timer_update(group->key_repeat_source, 0); wl_event_source_timer_update(group->key_repeat_source, 0);
} }
@@ -1433,15 +1424,13 @@ int @@ -1573,15 +1564,13 @@ int
keyrepeat(void *data) keyrepeat(void *data)
{ {
KeyboardGroup *group = data; KeyboardGroup *group = data;
@ -240,7 +240,7 @@ index 10d5a5b..33fb251 100644
} }
diff --git a/keys.h b/keys.h diff --git a/keys.h b/keys.h
new file mode 100644 new file mode 100644
index 0000000..e732f80 index 00000000..e732f806
--- /dev/null --- /dev/null
+++ b/keys.h +++ b/keys.h
@@ -0,0 +1,242 @@ @@ -0,0 +1,242 @@
@ -487,10 +487,10 @@ index 0000000..e732f80
+#define Key_XF86WWAN 254 +#define Key_XF86WWAN 254
+#define Key_XF86RFKill 255 +#define Key_XF86RFKill 255
-- --
2.43.0 2.45.2
From 9d24eaa9b2bd2c87c975882cd0b2adba978db564 Mon Sep 17 00:00:00 2001 From 0498877c2bc6fd08b15fcefb9599e27728617e7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me> <leohdz172@proton.me>
Date: Sun, 19 Mar 2023 15:50:07 -0600 Date: Sun, 19 Mar 2023 15:50:07 -0600
@ -507,7 +507,7 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
diff --git a/generate-keys.c b/generate-keys.c diff --git a/generate-keys.c b/generate-keys.c
new file mode 100644 new file mode 100644
index 0000000..83458fb index 00000000..83458fb7
--- /dev/null --- /dev/null
+++ b/generate-keys.c +++ b/generate-keys.c
@@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
@ -594,5 +594,5 @@ index 0000000..83458fb
+ xkb_context_unref(context); + xkb_context_unref(context);
+} +}
-- --
2.43.0 2.45.2

View File

@ -3,7 +3,7 @@ Show the master area to the right.
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/master-right) - [git branch](https://codeberg.org/sevz/dwl/src/branch/master-right)
- [2023-11-25](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/master-right/master-right.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/master-right/master-right.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From 4693a27d3c435883743f60dbe3c0c523bdc1a0cc Mon Sep 17 00:00:00 2001 From 7df91a900570684ee6ac31a95296cd60a32b00b6 Mon Sep 17 00:00:00 2001
From: Sevz17 <leohdz172@outlook.com> From: Sevz17 <leohdz172@outlook.com>
Date: Fri, 25 Jun 2021 19:50:56 -0500 Date: Fri, 25 Jun 2021 19:50:56 -0500
Subject: [PATCH] show master area to the right Subject: [PATCH] show master area to the right
@ -12,10 +12,10 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
1 file changed, 3 insertions(+), 2 deletions(-) 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..5ae2605 100644 index 6f041a0d..14b2ae3c 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -2470,11 +2470,12 @@ tile(Monitor *m) @@ -2608,11 +2608,12 @@ 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) {
@ -31,5 +31,5 @@ index 10d5a5b..5ae2605 100644
ty += c->geom.height; ty += c->geom.height;
} }
-- --
2.43.0 2.45.2

View File

@ -3,7 +3,7 @@ Allows activating numlock or capslock at startup
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/numlock-capslock) - [git branch](https://codeberg.org/sevz/dwl/src/branch/numlock-capslock)
- [2023-11-25](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/numlock-capslock/numlock-capslock.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/numlock-capslock/numlock-capslock.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,6 +1,6 @@
From f8761928cc1eb5c9c694cf43cf6442579ea40150 Mon Sep 17 00:00:00 2001 From 488c815beb51352138e51e885ba7967222156450 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@protonmail.com> <leohdz172@proton.me>
Date: Sun, 4 Apr 2021 19:56:09 -0500 Date: Sun, 4 Apr 2021 19:56:09 -0500
Subject: [PATCH] add option to enable numlock/capslock Subject: [PATCH] add option to enable numlock/capslock
MIME-Version: 1.0 MIME-Version: 1.0
@ -10,14 +10,14 @@ Content-Transfer-Encoding: 8bit
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me> Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
--- ---
config.def.h | 4 ++++ config.def.h | 4 ++++
dwl.c | 31 ++++++++++++++++++++++++++----- dwl.c | 19 +++++++++++++++++++
2 files changed, 30 insertions(+), 5 deletions(-) 2 files changed, 23 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..87f91d7 100644 index a784eb4f..04792167 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -56,6 +56,10 @@ static const struct xkb_rule_names xkb_rules = { @@ -57,6 +57,10 @@ static const struct xkb_rule_names xkb_rules = {
.options = NULL, .options = NULL,
}; };
@ -29,7 +29,7 @@ index a8ed61d..87f91d7 100644
static const int repeat_delay = 600; static const int repeat_delay = 600;
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..962748b 100644 index 6f041a0d..7da38ce1 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
@ -40,7 +40,7 @@ index 10d5a5b..962748b 100644
#include <wlr/render/allocator.h> #include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
@@ -336,6 +337,7 @@ static void zoom(const Arg *arg); @@ -355,6 +356,7 @@ static void zoom(const Arg *arg);
static const char broken[] = "broken"; static const char broken[] = "broken";
static pid_t child_pid = -1; static pid_t child_pid = -1;
static int locked; static int locked;
@ -48,34 +48,19 @@ index 10d5a5b..962748b 100644
static void *exclusive_focus; static void *exclusive_focus;
static struct wl_display *dpy; static struct wl_display *dpy;
static struct wlr_backend *backend; static struct wlr_backend *backend;
@@ -768,6 +770,8 @@ createkeyboard(struct wlr_keyboard *keyboard) @@ -806,6 +808,8 @@ createkeyboard(struct wlr_keyboard *keyboard)
wlr_keyboard_set_keymap(keyboard, kb_group.wlr_group->keyboard.keymap); /* Set the keymap to match the group keymap */
wlr_keyboard_set_repeat_info(keyboard, repeat_rate, repeat_delay); wlr_keyboard_set_keymap(keyboard, kb_group->wlr_group->keyboard.keymap);
+ wlr_keyboard_notify_modifiers(keyboard, 0, 0, locked_mods, 0); + wlr_keyboard_notify_modifiers(keyboard, 0, 0, locked_mods, 0);
+ +
/* Add the new keyboard to the group */ /* Add the new keyboard to the group */
wlr_keyboard_group_add_keyboard(kb_group.wlr_group, keyboard); wlr_keyboard_group_add_keyboard(kb_group->wlr_group, keyboard);
} }
@@ -2354,13 +2358,9 @@ setup(void) @@ -827,6 +831,21 @@ createkeyboardgroup(void)
XKB_KEYMAP_COMPILE_NO_FLAGS)))
die("failed to compile keymap"); die("failed to compile keymap");
+ wlr_seat_set_keyboard(seat, &kb_group.wlr_group->keyboard); wlr_keyboard_set_keymap(&group->wlr_group->keyboard, keymap);
wlr_keyboard_set_keymap(&kb_group.wlr_group->keyboard, keymap);
wlr_keyboard_set_keymap(&vkb_group.wlr_group->keyboard, keymap);
- xkb_keymap_unref(keymap);
- xkb_context_unref(context);
-
- wlr_keyboard_set_repeat_info(&kb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
- wlr_keyboard_set_repeat_info(&vkb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
/* Set up listeners for keyboard events */
LISTEN(&kb_group.wlr_group->keyboard.events.key, &kb_group.key, keypress);
@@ -2368,6 +2368,27 @@ setup(void)
LISTEN(&vkb_group.wlr_group->keyboard.events.key, &vkb_group.key, keypress);
LISTEN(&vkb_group.wlr_group->keyboard.events.modifiers, &vkb_group.modifiers, keypressmod);
+ if (numlock) { + if (numlock) {
+ xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM); + xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
+ if (mod_index != XKB_MOD_INVALID) + if (mod_index != XKB_MOD_INVALID)
@ -89,17 +74,11 @@ index 10d5a5b..962748b 100644
+ } + }
+ +
+ if (locked_mods) + if (locked_mods)
+ wlr_keyboard_notify_modifiers(&kb_group.wlr_group->keyboard, 0, 0, locked_mods, 0); + wlr_keyboard_notify_modifiers(&group->wlr_group->keyboard, 0, 0, locked_mods, 0);
+ +
+ xkb_keymap_unref(keymap); xkb_keymap_unref(keymap);
+ xkb_context_unref(context); xkb_context_unref(context);
+
+ wlr_keyboard_set_repeat_info(&kb_group.wlr_group->keyboard, repeat_rate, repeat_delay); --
+ wlr_keyboard_set_repeat_info(&vkb_group.wlr_group->keyboard, repeat_rate, repeat_delay); 2.45.2
+
kb_group.key_repeat_source = wl_event_loop_add_timer(
wl_display_get_event_loop(dpy), keyrepeat, &kb_group);
vkb_group.key_repeat_source = wl_event_loop_add_timer(
--
2.43.0

View File

@ -5,7 +5,7 @@ Tip to find the names: Grep for `device_name` and add a line after it to print t
### Download ### Download
- [git branch](https://codeberg.org/nullsystem/dwl/src/branch/main_perinputconfig) - [git branch](https://codeberg.org/nullsystem/dwl/src/branch/main_perinputconfig)
- [2024-03-31](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/perinputconfig/perinputconfig.patch) - [2024-06-08](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/perinputconfig/perinputconfig.patch)
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/perinputconfig/perinputconfig-v0.5.patch) - [v0.5](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/perinputconfig/perinputconfig-v0.5.patch)
### Authors ### Authors

View File

@ -1,21 +1,40 @@
From a73544fecf1f4076957b24bfa01af03d250bc28d Mon Sep 17 00:00:00 2001 From c268707811fb5d8244115f23a0430f024e4e11a9 Mon Sep 17 00:00:00 2001
From: nullsystem <nullsystem.aongp@slmail.me> From: nullsystem <nullsystem.aongp@slmail.me>
Date: Sun, 31 Mar 2024 13:53:38 +0100 Date: Sat, 8 Jun 2024 11:30:34 +0100
Subject: [PATCH 1/2] perinputconfig - set configuration per input Subject: [PATCH] perinputconfig - 2024-06-08 Update
- Array replaced singular variables for configuration * Array replaced singular variables for configuration
- Only applies to enable-state, acceleration profile, and speed * Only applies to enable-state, acceleration profile, and speed
- Like EX: Rules, requires NULL/default set at the end * Like EX: Rules, requires NULL/default set at the end
* Keyboards can now also set by name
--- ---
config.def.h | 28 ++++++++++++++++++---------- config.def.h | 36 +++++++++++++---------
dwl.c | 20 +++++++++++++++++--- dwl.c | 87 +++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 35 insertions(+), 13 deletions(-) 2 files changed, 95 insertions(+), 28 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 9009517..84c0f6b 100644 index a784eb4..c733137 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -83,23 +83,31 @@ LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER @@ -49,12 +49,13 @@ static const MonitorRule monrules[] = {
};
/* keyboard */
-static const struct xkb_rule_names xkb_rules = {
- /* can specify fields: rules, model, layout, variant, options */
+/* NOTE: Always include a fallback rule at the end (name as NULL) */
+static const KeyboardRule kbrules[] = {
+ /* name rules model layout variant options */
/* example:
- .options = "ctrl:nocaps",
+ { "keyboard", NULL, NULL, "us,de", NULL, "ctrl:nocaps" },
*/
- .options = NULL,
+ { NULL, NULL, NULL, NULL, NULL, NULL },
};
static const int repeat_rate = 25;
@@ -84,24 +85,31 @@ LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
/* You can choose between: /* You can choose between:
@ -36,15 +55,15 @@ index 9009517..84c0f6b 100644
+accel_profile: You can choose between: +accel_profile: You can choose between:
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
+ -*/
+NOTE: Always include a fallback rule at the end (name as NULL)
*/
-static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE; -static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
-static const double accel_speed = 0.0; -static const double accel_speed = 0.0;
-/* You can choose between: -/* You can choose between:
-LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle -LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
-LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right -LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
-*/ +NOTE: Always include a fallback rule at the end (name as NULL)
*/
-static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM; -static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
+static const InputRule inputrules[] = { +static const InputRule inputrules[] = {
+ /* name send_events_mode accel_profile accel_speed*/ + /* name send_events_mode accel_profile accel_speed*/
@ -58,10 +77,10 @@ index 9009517..84c0f6b 100644
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */ /* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_ALT #define MODKEY WLR_MODIFIER_ALT
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 5867b0c..ebc0180 100644 index 6f041a0..0673a05 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -239,6 +239,13 @@ typedef struct { @@ -240,6 +240,22 @@ typedef struct {
struct wl_listener destroy; struct wl_listener destroy;
} SessionLock; } SessionLock;
@ -71,11 +90,116 @@ index 5867b0c..ebc0180 100644
+ enum libinput_config_accel_profile accel_profile; + enum libinput_config_accel_profile accel_profile;
+ double accel_speed; + double accel_speed;
+} InputRule; +} InputRule;
+
+typedef struct {
+ const char *name;
+ const char *rules;
+ const char *model;
+ const char *layout;
+ const char *variant;
+ const char *options;
+} KeyboardRule;
+ +
/* function declarations */ /* function declarations */
static void applybounds(Client *c, struct wlr_box *bbox); static void applybounds(Client *c, struct wlr_box *bbox);
static void applyrules(Client *c); static void applyrules(Client *c);
@@ -991,10 +998,17 @@ createnotify(struct wl_listener *listener, void *data) @@ -259,7 +275,7 @@ static void commitnotify(struct wl_listener *listener, void *data);
static void createdecoration(struct wl_listener *listener, void *data);
static void createidleinhibitor(struct wl_listener *listener, void *data);
static void createkeyboard(struct wlr_keyboard *keyboard);
-static KeyboardGroup *createkeyboardgroup(void);
+static KeyboardGroup *createkeyboardgroup(struct xkb_rule_names *new_xkb_rules);
static void createlayersurface(struct wl_listener *listener, void *data);
static void createlocksurface(struct wl_listener *listener, void *data);
static void createmon(struct wl_listener *listener, void *data);
@@ -396,7 +412,7 @@ static struct wlr_session_lock_v1 *cur_lock;
static struct wl_listener lock_listener = {.notify = locksession};
static struct wlr_seat *seat;
-static KeyboardGroup *kb_group;
+static struct wl_list kb_groups;
static struct wlr_surface *held_grab;
static unsigned int cursor_mode;
static Client *grabc;
@@ -671,6 +687,8 @@ checkidleinhibitor(struct wlr_surface *exclude)
void
cleanup(void)
{
+ KeyboardGroup *kb_group;
+
#ifdef XWAYLAND
wlr_xwayland_destroy(xwayland);
xwayland = NULL;
@@ -683,7 +701,8 @@ cleanup(void)
wlr_xcursor_manager_destroy(cursor_mgr);
wlr_output_layout_destroy(output_layout);
- destroykeyboardgroup(&kb_group->destroy, NULL);
+ wl_list_for_each(kb_group, &kb_groups, link)
+ destroykeyboardgroup(&kb_group->destroy, NULL);
wl_display_destroy(dpy);
/* Destroy after the wayland display (when the monitors are already destroyed)
@@ -803,6 +822,30 @@ createidleinhibitor(struct wl_listener *listener, void *data)
void
createkeyboard(struct wlr_keyboard *keyboard)
{
+ KeyboardGroup *kb_group;
+ const char *device_name = "";
+ const KeyboardRule *krule = NULL;
+ struct libinput_device *device = NULL;
+
+ if (wlr_input_device_is_libinput(&keyboard->base)
+ && (device = wlr_libinput_get_device_handle(&keyboard->base))) {
+ device_name = libinput_device_get_name(device);
+ }
+ for (krule = kbrules; krule < END(kbrules); krule++) {
+ if (!krule->name || strstr(device_name, krule->name))
+ break;
+ }
+ if (krule) {
+ struct xkb_rule_names xkb_rules;
+ xkb_rules.rules = krule->rules;
+ xkb_rules.model = krule->model;
+ xkb_rules.layout = krule->layout;
+ xkb_rules.variant = krule->variant;
+ xkb_rules.options = krule->options;
+ kb_group = createkeyboardgroup(&xkb_rules);
+ } else
+ wl_list_for_each(kb_group, &kb_groups, link);
+
/* Set the keymap to match the group keymap */
wlr_keyboard_set_keymap(keyboard, kb_group->wlr_group->keyboard.keymap);
@@ -811,11 +854,16 @@ createkeyboard(struct wlr_keyboard *keyboard)
}
KeyboardGroup *
-createkeyboardgroup(void)
+createkeyboardgroup(struct xkb_rule_names *new_xkb_rules)
{
KeyboardGroup *group = ecalloc(1, sizeof(*group));
struct xkb_context *context;
struct xkb_keymap *keymap;
+ struct xkb_rule_names xkb_rules;
+
+ memset(&xkb_rules, 0, sizeof(struct xkb_rule_names));
+ if (new_xkb_rules)
+ xkb_rules = *new_xkb_rules;
group->wlr_group = wlr_keyboard_group_create();
group->wlr_group->data = group;
@@ -845,6 +893,9 @@ createkeyboardgroup(void)
* all of them. Set this combined wlr_keyboard as the seat keyboard.
*/
wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard);
+
+ wl_list_init(&group->destroy.link);
+ wl_list_insert(&kb_groups, &group->link);
return group;
}
@@ -1042,9 +1093,15 @@ createnotify(struct wl_listener *listener, void *data)
void void
createpointer(struct wlr_pointer *pointer) createpointer(struct wlr_pointer *pointer)
{ {
@ -83,17 +207,15 @@ index 5867b0c..ebc0180 100644
struct libinput_device *device; struct libinput_device *device;
if (wlr_input_device_is_libinput(&pointer->base) if (wlr_input_device_is_libinput(&pointer->base)
&& (device = wlr_libinput_get_device_handle(&pointer->base))) { && (device = wlr_libinput_get_device_handle(&pointer->base))) {
+ const char *device_name = libinput_device_get_name(device); + const char *device_name = libinput_device_get_name(device);
+ for (irule = inputrules; irule < END(inputrules); irule++) { + for (irule = inputrules; irule < END(inputrules); irule++) {
+ if (!irule->name || strstr(device_name, irule->name)) + if (!irule->name || strstr(device_name, irule->name))
+ break; + break;
+ } + }
+
if (libinput_device_config_tap_get_finger_count(device)) { if (libinput_device_config_tap_get_finger_count(device)) {
libinput_device_config_tap_set_enabled(device, tap_to_click); libinput_device_config_tap_set_enabled(device, tap_to_click);
libinput_device_config_tap_set_drag_enabled(device, tap_and_drag); @@ -1072,11 +1129,11 @@ createpointer(struct wlr_pointer *pointer)
@@ -1021,11 +1035,11 @@ createpointer(struct wlr_pointer *pointer)
libinput_device_config_click_set_method (device, click_method); libinput_device_config_click_set_method (device, click_method);
if (libinput_device_config_send_events_get_modes(device)) if (libinput_device_config_send_events_get_modes(device))
@ -108,268 +230,66 @@ index 5867b0c..ebc0180 100644
} }
} }
-- @@ -1277,7 +1334,6 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
2.44.0 wl_list_remove(&group->key.link);
wl_list_remove(&group->modifiers.link);
wl_list_remove(&group->destroy.link);
From c5a456791e508f5258707a85fc2f78d8cf94397d Mon Sep 17 00:00:00 2001 - free(group);
From: nullsystem <nullsystem.aongp@slmail.me>
Date: Sun, 31 Mar 2024 18:27:20 +0100
Subject: [PATCH 2/2] perinputconfig - extend to keyboards
- keyboards can now also set by name
- multiple of keyboard groups
---
config.def.h | 9 +++--
dwl.c | 107 ++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 98 insertions(+), 18 deletions(-)
diff --git a/config.def.h b/config.def.h
index 84c0f6b..97f73da 100644
--- a/config.def.h
+++ b/config.def.h
@@ -48,12 +48,13 @@ static const MonitorRule monrules[] = {
};
/* keyboard */
-static const struct xkb_rule_names xkb_rules = {
- /* can specify fields: rules, model, layout, variant, options */
+/* NOTE: Always include a fallback rule at the end (name as NULL) */
+static const KeyboardRule kbrules[] = {
+ /* name rules model layout variant options */
/* example:
- .options = "ctrl:nocaps",
+ { "keyboard", NULL, NULL, "us,de", NULL, "ctrl:nocaps" },
*/
- .options = NULL,
+ { NULL, NULL, NULL, NULL, NULL, NULL },
};
static const int repeat_rate = 25;
diff --git a/dwl.c b/dwl.c
index ebc0180..481a9be 100644
--- a/dwl.c
+++ b/dwl.c
@@ -246,6 +246,15 @@ typedef struct {
double accel_speed;
} InputRule;
+typedef struct {
+ const char *name;
+ const char *rules;
+ const char *model;
+ const char *layout;
+ const char *variant;
+ const char *options;
+} KeyboardRule;
+
/* function declarations */
static void applybounds(Client *c, struct wlr_box *bbox);
static void applyrules(Client *c);
@@ -264,6 +273,7 @@ static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
static void commitnotify(struct wl_listener *listener, void *data);
static void createdecoration(struct wl_listener *listener, void *data);
static void createidleinhibitor(struct wl_listener *listener, void *data);
+static size_t createkbgroup(struct xkb_keymap *keymap);
static void createkeyboard(struct wlr_keyboard *keyboard);
static void createlayersurface(struct wl_listener *listener, void *data);
static void createlocksurface(struct wl_listener *listener, void *data);
@@ -400,7 +410,8 @@ static struct wlr_session_lock_v1 *cur_lock;
static struct wl_listener lock_listener = {.notify = locksession};
static struct wlr_seat *seat;
-static KeyboardGroup kb_group = {0};
+static KeyboardGroup *kb_groups;
+static size_t kb_groups_length = 0;
static KeyboardGroup vkb_group = {0};
static struct wlr_surface *held_grab;
static unsigned int cursor_mode;
@@ -662,6 +673,8 @@ checkidleinhibitor(struct wlr_surface *exclude)
void
cleanup(void)
{
+ size_t i;
+
#ifdef XWAYLAND
wlr_xwayland_destroy(xwayland);
xwayland = NULL;
@@ -675,13 +688,16 @@ cleanup(void)
wlr_output_layout_destroy(output_layout);
/* Remove event source that use the dpy event loop before destroying dpy */
- wl_event_source_remove(kb_group.key_repeat_source);
+ for (i = 0; i < kb_groups_length; i++)
+ wl_event_source_remove(kb_groups[i].key_repeat_source);
wl_event_source_remove(vkb_group.key_repeat_source);
wl_display_destroy(dpy);
/* Destroy after the wayland display (when the monitors are already destroyed)
to avoid destroying them with an invalid scene output. */
wlr_scene_node_destroy(&scene->tree.node);
+
+ free(kb_groups);
} }
void Monitor *
@@ -793,15 +809,69 @@ createidleinhibitor(struct wl_listener *listener, void *data) @@ -1467,6 +1523,7 @@ inputdevice(struct wl_listener *listener, void *data)
checkidleinhibitor(NULL); * available. */
} struct wlr_input_device *device = data;
uint32_t caps;
+ KeyboardGroup *group;
+size_t switch (device->type) {
+createkbgroup(struct xkb_keymap *keymap) case WLR_INPUT_DEVICE_KEYBOARD:
+{ @@ -1485,8 +1542,11 @@ inputdevice(struct wl_listener *listener, void *data)
+ size_t i = kb_groups_length++;
+
+ kb_groups[i].wlr_group = wlr_keyboard_group_create();
+ kb_groups[i].wlr_group->data = &kb_groups[i];
+ wlr_keyboard_set_keymap(&kb_groups[i].wlr_group->keyboard, keymap);
+ wlr_keyboard_set_repeat_info(&kb_groups[i].wlr_group->keyboard, repeat_rate, repeat_delay);
+
+ /* Set up listeners for keyboard events */
+ LISTEN(&kb_groups[i].wlr_group->keyboard.events.key, &kb_groups[i].key, keypress);
+ LISTEN(&kb_groups[i].wlr_group->keyboard.events.modifiers, &kb_groups[i].modifiers, keypressmod);
+ kb_groups[i].key_repeat_source = wl_event_loop_add_timer(
+ wl_display_get_event_loop(dpy), keyrepeat, &kb_groups[i]);
+
+ return i;
+}
+
void
createkeyboard(struct wlr_keyboard *keyboard)
{
+ const KeyboardRule *krule = NULL;
+ struct libinput_device *device = NULL;
+ struct xkb_keymap *keymap = NULL;
+ struct xkb_context *context = NULL;
+ struct xkb_rule_names xkb_rules;
+ size_t kb_groups_i = 0;
+
+ if (wlr_input_device_is_libinput(&keyboard->base)
+ && (device = wlr_libinput_get_device_handle(&keyboard->base))) {
+ const char *device_name = libinput_device_get_name(device);
+ for (krule = kbrules; krule < END(kbrules); krule++) {
+ if (!krule->name || strstr(device_name, krule->name))
+ break;
+ }
+
+ if (krule->name) {
+ xkb_rules.rules = krule->rules;
+ xkb_rules.model = krule->model;
+ xkb_rules.layout = krule->layout;
+ xkb_rules.variant = krule->variant;
+ xkb_rules.options = krule->options;
+
+ context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+ if ((keymap = xkb_keymap_new_from_names(context, &xkb_rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS))) {
+ kb_groups_i = createkbgroup(keymap);
+ } else {
+ fprintf(stderr, "failed to compile keymap for %s\n", krule->name);
+ }
+ }
+ }
+
/* Set the keymap to match the group keymap */
- wlr_keyboard_set_keymap(keyboard, kb_group.wlr_group->keyboard.keymap);
+ wlr_keyboard_set_keymap(keyboard, kb_groups[kb_groups_i].wlr_group->keyboard.keymap);
wlr_keyboard_set_repeat_info(keyboard, repeat_rate, repeat_delay);
/* Add the new keyboard to the group */
- wlr_keyboard_group_add_keyboard(kb_group.wlr_group, keyboard);
+ wlr_keyboard_group_add_keyboard(kb_groups[kb_groups_i].wlr_group, keyboard);
+
+ xkb_keymap_unref(keymap);
+ xkb_context_unref(context);
}
void
@@ -1000,6 +1070,7 @@ createpointer(struct wlr_pointer *pointer)
{
const InputRule *irule;
struct libinput_device *device;
+
if (wlr_input_device_is_libinput(&pointer->base)
&& (device = wlr_libinput_get_device_handle(&pointer->base))) {
@@ -1436,7 +1507,7 @@ inputdevice(struct wl_listener *listener, void *data)
* there are no pointer devices, so we always include that capability. */ * there are no pointer devices, so we always include that capability. */
/* TODO do we actually require a cursor? */ /* TODO do we actually require a cursor? */
caps = WL_SEAT_CAPABILITY_POINTER; caps = WL_SEAT_CAPABILITY_POINTER;
- if (!wl_list_empty(&kb_group.wlr_group->devices)) - if (!wl_list_empty(&kb_group->wlr_group->devices))
+ if (!wl_list_empty(&kb_groups[0].wlr_group->devices)) - caps |= WL_SEAT_CAPABILITY_KEYBOARD;
caps |= WL_SEAT_CAPABILITY_KEYBOARD; + wl_list_for_each(group, &kb_groups, link)
wlr_seat_set_capabilities(seat, caps); + if (!wl_list_empty(&group->wlr_group->devices)) {
} + caps |= WL_SEAT_CAPABILITY_KEYBOARD;
@@ -2285,6 +2356,8 @@ setup(void)
{
struct xkb_context *context;
struct xkb_keymap *keymap;
+ const KeyboardRule *krule;
+ struct xkb_rule_names xkb_rules;
int i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig};
@@ -2472,8 +2545,8 @@ setup(void)
* keyboards, keep their modifier and LED states in sync, and handle
* keypresses
*/
- kb_group.wlr_group = wlr_keyboard_group_create();
- kb_group.wlr_group->data = &kb_group;
+ kb_groups = ecalloc(LENGTH(kbrules), sizeof(KeyboardGroup));
+ kb_groups_length = 0;
/*
* Virtual keyboards need to be in a different group
@@ -2482,28 +2555,34 @@ setup(void)
vkb_group.wlr_group = wlr_keyboard_group_create();
vkb_group.wlr_group->data = &vkb_group;
+ /* Set the pointers from the default kbrules */
+ for (krule = kbrules; krule < END(kbrules); krule++) {
+ if (!krule->name)
+ break; + break;
+ } + }
+ xkb_rules.rules = krule->rules; wlr_seat_set_capabilities(seat, caps);
+ xkb_rules.model = krule->model; }
+ xkb_rules.layout = krule->layout;
+ xkb_rules.variant = krule->variant;
+ xkb_rules.options = krule->options;
+
/* Prepare an XKB keymap and assign it to the keyboard group. */
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules,
XKB_KEYMAP_COMPILE_NO_FLAGS)))
die("failed to compile keymap");
- wlr_keyboard_set_keymap(&kb_group.wlr_group->keyboard, keymap); @@ -2431,6 +2491,7 @@ setup(void)
+ createkbgroup(keymap);
wlr_keyboard_set_keymap(&vkb_group.wlr_group->keyboard, keymap);
xkb_keymap_unref(keymap);
xkb_context_unref(context);
- wlr_keyboard_set_repeat_info(&kb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
wlr_keyboard_set_repeat_info(&vkb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
/* Set up listeners for keyboard events */
- LISTEN(&kb_group.wlr_group->keyboard.events.key, &kb_group.key, keypress);
- LISTEN(&kb_group.wlr_group->keyboard.events.modifiers, &kb_group.modifiers, keypressmod);
LISTEN(&vkb_group.wlr_group->keyboard.events.key, &vkb_group.key, keypress);
LISTEN(&vkb_group.wlr_group->keyboard.events.modifiers, &vkb_group.modifiers, keypressmod);
- kb_group.key_repeat_source = wl_event_loop_add_timer(
- wl_display_get_event_loop(dpy), keyrepeat, &kb_group);
vkb_group.key_repeat_source = wl_event_loop_add_timer(
wl_display_get_event_loop(dpy), keyrepeat, &vkb_group);
@@ -2512,7 +2591,7 @@ setup(void)
* same wlr_keyboard_group, which provides a single wlr_keyboard interface for
* all of them. Set this combined wlr_keyboard as the seat keyboard.
*/ */
- wlr_seat_set_keyboard(seat, &kb_group.wlr_group->keyboard); wl_list_init(&clients);
+ wlr_seat_set_keyboard(seat, &kb_groups[0].wlr_group->keyboard); wl_list_init(&fstack);
+ wl_list_init(&kb_groups);
xdg_shell = wlr_xdg_shell_create(dpy, 6);
LISTEN_STATIC(&xdg_shell->events.new_surface, createnotify);
@@ -2514,8 +2575,7 @@ setup(void)
LISTEN_STATIC(&seat->events.request_start_drag, requeststartdrag);
LISTEN_STATIC(&seat->events.start_drag, startdrag);
- kb_group = createkeyboardgroup();
- wl_list_init(&kb_group->destroy.link);
+ createkeyboardgroup(NULL);
output_mgr = wlr_output_manager_v1_create(dpy); output_mgr = wlr_output_manager_v1_create(dpy);
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply); LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
-- @@ -2857,10 +2917,9 @@ virtualkeyboard(struct wl_listener *listener, void *data)
2.44.0 {
struct wlr_virtual_keyboard_v1 *kb = data;
/* virtual keyboards shouldn't share keyboard group */
- KeyboardGroup *group = createkeyboardgroup();
+ KeyboardGroup *group = createkeyboardgroup(NULL);
/* Set the keymap to match the group keymap */
wlr_keyboard_set_keymap(&kb->keyboard, group->wlr_group->keyboard.keymap);
- LISTEN(&kb->keyboard.base.events.destroy, &group->destroy, destroykeyboardgroup);
/* Add the new keyboard to the group */
wlr_keyboard_group_add_keyboard(group->wlr_group, &kb->keyboard);
--
2.45.2

View File

@ -5,7 +5,7 @@ This patch is useful - and solves issue [#628](https://codeberg.org/dwl/dwl/issu
### Download ### Download
- [git branch](https://codeberg.org/sewn/dwl/src/branch/rlimit_max) - [git branch](https://codeberg.org/sewn/dwl/src/branch/rlimit_max)
- [2024-05-19](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/rlimit_max/rlimit_max.patch) - [2024-06-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/rlimit_max/rlimit_max.patch)
### Authors ### Authors
- [sewn](https://codeberg.org/sewn) - [sewn](https://codeberg.org/sewn)

View File

@ -1,14 +1,14 @@
From 1a3a3290f1ecc3afe7d455c05b2742060406dae0 Mon Sep 17 00:00:00 2001 From 9f80802ad639fe35efaeede485e9cd6e1f002486 Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org> From: sewn <sewn@disroot.org>
Date: Sun, 19 May 2024 20:06:32 +0300 Date: Thu, 6 Jun 2024 16:57:13 +0300
Subject: [PATCH] set max open file descriptors to available max Subject: [PATCH] set max open file descriptors to available max
--- ---
dwl.c | 23 +++++++++++++++++++++++ dwl.c | 22 ++++++++++++++++++++++
1 file changed, 23 insertions(+) 1 file changed, 22 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index bf763df..eabea11 100644 index 6f041a0..a28291e 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
@ -19,7 +19,7 @@ index bf763df..eabea11 100644
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@@ -308,6 +309,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface, @@ -311,6 +312,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface,
double sx, double sy, uint32_t time); double sx, double sy, uint32_t time);
static void printstatus(void); static void printstatus(void);
static void quit(const Arg *arg); static void quit(const Arg *arg);
@ -27,7 +27,7 @@ index bf763df..eabea11 100644
static void rendermon(struct wl_listener *listener, void *data); static void rendermon(struct wl_listener *listener, void *data);
static void requestdecorationmode(struct wl_listener *listener, void *data); static void requestdecorationmode(struct wl_listener *listener, void *data);
static void requeststartdrag(struct wl_listener *listener, void *data); static void requeststartdrag(struct wl_listener *listener, void *data);
@@ -350,6 +352,7 @@ static void zoom(const Arg *arg); @@ -353,6 +355,7 @@ static void zoom(const Arg *arg);
/* variables */ /* variables */
static const char broken[] = "broken"; static const char broken[] = "broken";
@ -35,7 +35,7 @@ index bf763df..eabea11 100644
static pid_t child_pid = -1; static pid_t child_pid = -1;
static int locked; static int locked;
static void *exclusive_focus; static void *exclusive_focus;
@@ -1951,6 +1954,15 @@ quit(const Arg *arg) @@ -2014,6 +2017,15 @@ quit(const Arg *arg)
wl_display_terminate(dpy); wl_display_terminate(dpy);
} }
@ -51,7 +51,7 @@ index bf763df..eabea11 100644
void void
rendermon(struct wl_listener *listener, void *data) rendermon(struct wl_listener *listener, void *data)
{ {
@@ -2080,6 +2092,7 @@ run(char *startup_cmd) @@ -2143,6 +2155,7 @@ run(char *startup_cmd)
if ((child_pid = fork()) < 0) if ((child_pid = fork()) < 0)
die("startup: fork:"); die("startup: fork:");
if (child_pid == 0) { if (child_pid == 0) {
@ -59,15 +59,15 @@ index bf763df..eabea11 100644
dup2(piperw[0], STDIN_FILENO); dup2(piperw[0], STDIN_FILENO);
close(piperw[0]); close(piperw[0]);
close(piperw[1]); close(piperw[1]);
@@ -2271,9 +2284,18 @@ setup(void) @@ -2333,10 +2346,18 @@ setsel(struct wl_listener *listener, void *data)
void
setup(void)
{ {
struct xkb_context *context;
struct xkb_keymap *keymap;
+ struct rlimit new_rlimit; + struct rlimit new_rlimit;
int i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE}; int i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig}; struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig};
+ sigemptyset(&sa.sa_mask);
+ if (getrlimit(RLIMIT_NOFILE, &og_rlimit) < 0) + if (getrlimit(RLIMIT_NOFILE, &og_rlimit) < 0)
+ die("getrlimit:"); + die("getrlimit:");
+ new_rlimit = og_rlimit; + new_rlimit = og_rlimit;
@ -75,10 +75,10 @@ index bf763df..eabea11 100644
+ if (setrlimit(RLIMIT_NOFILE, &new_rlimit) < 0) + if (setrlimit(RLIMIT_NOFILE, &new_rlimit) < 0)
+ die("setrlimit:"); + die("setrlimit:");
+ +
sigemptyset(&sa.sa_mask);
for (i = 0; i < (int)LENGTH(sig); i++) for (i = 0; i < (int)LENGTH(sig); i++)
@@ -2530,6 +2552,7 @@ void sigaction(sig[i], &sa, NULL);
@@ -2547,6 +2568,7 @@ void
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (fork() == 0) { if (fork() == 0) {

View File

@ -1,57 +1,57 @@
From 4e72591e27e19f9a1023e1d7f79d30693056c81d Mon Sep 17 00:00:00 2001 From bd10c646153c7a337b89c88c9572148c59e456ef Mon Sep 17 00:00:00 2001
From: Ben Collerson <benc@benc.cc> From: Ben Collerson <benc@benc.cc>
Date: Sat, 30 Dec 2023 13:39:31 +1000 Date: Sat, 30 Dec 2023 13:39:31 +1000
Subject: [PATCH] singlemaster Subject: [PATCH] singlemaster
--- ---
config.def.h | 8 +++----- config.def.h | 8 +++-----
dwl.c | 49 ++++++++++++++++++++++++------------------------- dwl.c | 50 ++++++++++++++++++++++++--------------------------
2 files changed, 27 insertions(+), 30 deletions(-) 2 files changed, 27 insertions(+), 31 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d9..68ce5903 100644 index a784eb4f..6f09c212 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -39,12 +39,12 @@ static const Layout layouts[] = { @@ -40,12 +40,12 @@ static const Layout layouts[] = {
/* monitors */ /* WARNING: negative values other than (-1, -1) cause problems with xwayland clients' menus */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */ /* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = { static const MonitorRule monrules[] = {
- /* name mfact nmaster scale layout rotate/reflect x y */ - /* name mfact nmaster scale layout rotate/reflect x y */
+ /* name mfact scale layout rotate/reflect x y */ + /* name mfact scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor: /* example of a HiDPI laptop monitor:
- { "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, - { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ { "eDP-1", 0.5, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, + { "eDP-1", 0.5f, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
*/ */
/* defaults */ /* defaults */
- { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, - { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ { NULL, 0.55, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, + { NULL, 0.55f, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
}; };
/* keyboard */ /* keyboard */
@@ -124,8 +124,6 @@ static const Key keys[] = { @@ -126,8 +126,6 @@ static const Key keys[] = {
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
- { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, - { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
- { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, - { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} }, { MODKEY, XKB_KEY_Return, zoom, {0} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 4d19357f..2a2cc036 100644 index 6f041a0d..3f8789da 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -64,7 +64,6 @@ @@ -68,7 +68,6 @@
/* macros */ /* macros */
#define MAX(A, B) ((A) > (B) ? (A) : (B)) #define MAX(A, B) ((A) > (B) ? (A) : (B))
-#define MIN(A, B) ((A) < (B) ? (A) : (B)) -#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define ROUND(X) ((int)((X < 0) ? (X - 0.5) : (X + 0.5)))
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS) #define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) #define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0]) @@ -204,14 +203,12 @@ struct Monitor {
@@ -198,14 +197,12 @@ struct Monitor {
uint32_t tagset[2]; uint32_t tagset[2];
double mfact; float mfact;
int gamma_lut_changed; int gamma_lut_changed;
- int nmaster; - int nmaster;
char ltsymbol[16]; char ltsymbol[16];
@ -64,7 +64,7 @@ index 4d19357f..2a2cc036 100644
float scale; float scale;
const Layout *lt; const Layout *lt;
enum wl_output_transform rr; enum wl_output_transform rr;
@@ -270,7 +267,6 @@ static void focusstack(const Arg *arg); @@ -287,7 +284,6 @@ static void focusstack(const Arg *arg);
static Client *focustop(Monitor *m); static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data); static void fullscreennotify(struct wl_listener *listener, void *data);
static void handlesig(int signo); static void handlesig(int signo);
@ -72,15 +72,15 @@ index 4d19357f..2a2cc036 100644
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym); static int keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data); static void keypress(struct wl_listener *listener, void *data);
@@ -862,7 +858,6 @@ createmon(struct wl_listener *listener, void *data) @@ -938,7 +934,6 @@ createmon(struct wl_listener *listener, void *data)
m->m.x = r->x; m->m.x = r->x;
m->m.y = r->y; m->m.y = r->y;
m->mfact = r->mfact; m->mfact = r->mfact;
- m->nmaster = r->nmaster; - 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)); strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
wlr_output_state_set_scale(&state, r->scale); @@ -1451,15 +1446,6 @@ handlesig(int signo)
@@ -1311,15 +1306,6 @@ handlesig(int signo)
} }
} }
@ -96,27 +96,28 @@ index 4d19357f..2a2cc036 100644
void void
inputdevice(struct wl_listener *listener, void *data) inputdevice(struct wl_listener *listener, void *data)
{ {
@@ -2452,7 +2438,7 @@ tagmon(const Arg *arg) @@ -2589,8 +2575,7 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
- unsigned int i, n = 0, mw, my, ty; - unsigned int mw, my, ty;
- int i, n = 0;
+ unsigned int i, n = 0, mw, ty; + unsigned int i, n = 0, mw, ty;
Client *c; Client *c;
wl_list_for_each(c, &clients, link) wl_list_for_each(c, &clients, link)
@@ -2461,21 +2447,34 @@ tile(Monitor *m) @@ -2599,21 +2584,34 @@ tile(Monitor *m)
if (n == 0) if (n == 0)
return; return;
- if (n > m->nmaster) - if (n > m->nmaster)
- mw = m->nmaster ? m->w.width * m->mfact : 0; - mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
- else - else
+ if (n == 1) + if (n == 1)
mw = m->w.width; mw = m->w.width;
- i = my = ty = 0; - i = my = ty = 0;
+ else + else
+ mw = m->w.width * m->mfact; + mw = ROUND(m->w.width * m->mfact);
+ i = ty = 0; + i = ty = 0;
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
@ -151,5 +152,5 @@ index 4d19357f..2a2cc036 100644
} }
i++; i++;
-- --
2.43.0 2.45.1

View File

@ -1,37 +1,27 @@
From 2825a2e8b0dae5d7146ba9bb66e2a3b7265617d5 Mon Sep 17 00:00:00 2001
From: Dhruva Sambrani <44899822+DhruvaSambrani@users.noreply.github.com>
Date: Mon, 8 Jan 2024 14:54:39 +0100
Subject: [PATCH 1/2] first skipfocus commit
---
config.def.h | 6 +++---
dwl.c | 9 ++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..fc105de 100644 index a784eb4..5d3a4f9 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -21,11 +21,11 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al @@ -21,10 +21,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
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 isfloating skipfocus monitor */ + /* app_id title tags mask isfloating skipfocus monitor */
/* examples: /* examples: */
- { "Gimp", NULL, 0, 1, -1 }, - { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
+ { "Gimp", NULL, 0, 1, 0, -1 }, - { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
*/ + { "Gimp_EXAMPLE", NULL, 0, 1, 0, -1 }, /* Start on currently visible tags floating, not tiled */
- { "firefox", NULL, 1 << 8, 0, -1 }, + { "firefox_EXAMPLE", NULL, 1 << 8, 0, 0, -1 }, /* Start on ONLY tag "9" */
+ { "firefox", NULL, 1 << 8, 0, 0, -1 }, + { "mako_EXAMPLE", NULL, 0, 1, 1, -1 }, /* Start floating and skip focus
}; };
/* layout(s) */ /* layout(s) */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 632dabf..a8c87e5 100644 index 6f041a0..90ac57b 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -132,7 +132,7 @@ typedef struct { @@ -137,7 +137,7 @@ typedef struct {
#endif #endif
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
@ -40,7 +30,7 @@ index 632dabf..a8c87e5 100644
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -217,6 +217,7 @@ typedef struct { @@ -228,6 +228,7 @@ typedef struct {
const char *title; const char *title;
uint32_t tags; uint32_t tags;
int isfloating; int isfloating;
@ -48,7 +38,7 @@ index 632dabf..a8c87e5 100644
int monitor; int monitor;
} Rule; } Rule;
@@ -440,6 +441,7 @@ applyrules(Client *c) @@ -464,6 +465,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title)) if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) { && (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
@ -56,48 +46,17 @@ index 632dabf..a8c87e5 100644
newtags |= r->tags; newtags |= r->tags;
i = 0; i = 0;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@@ -1167,6 +1169,11 @@ focusclient(Client *c, int lift) @@ -1307,6 +1309,13 @@ focusclient(Client *c, int lift)
if (locked) if (locked)
return; return;
+ if (c && c->skipfocus){ + if (c && c->skipfocus != 0){
+ if (c -> skipfocus == 1) {
+ c->skipfocus = 0; + c->skipfocus = 0;
+ }
+ return; + return;
+ } + }
+ +
/* Raise client in stacking order if requested */ /* Raise client in stacking order if requested */
if (c && lift) if (c && lift)
wlr_scene_node_raise_to_top(&c->scene->node); wlr_scene_node_raise_to_top(&c->scene->node);
--
2.43.0
From d8b2e6141cdf41e854c9017fca66b32e691b7c5b Mon Sep 17 00:00:00 2001
From: Dhruva Sambrani <44899822+DhruvaSambrani@users.noreply.github.com>
Date: Mon, 8 Jan 2024 15:38:08 +0100
Subject: [PATCH 2/2] add permanent skipfocus
---
dwl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dwl.c b/dwl.c
index a8c87e5..54a7ed3 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1169,8 +1169,10 @@ focusclient(Client *c, int lift)
if (locked)
return;
- if (c && c->skipfocus){
- c -> skipfocus = 0;
+ if (c && c->skipfocus != 0){
+ if (c -> skipfocus == 1) {
+ c->skipfocus = 0;
+ }
return;
}
--
2.43.0

View File

@ -3,7 +3,7 @@ The borders of a window aren't drawn when the window is the only tiling window i
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/smartborders) - [git branch](https://codeberg.org/sevz/dwl/src/branch/smartborders)
- [2024-03-31](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/smartborders/smartborders.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/smartborders/smartborders.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From c7120b651b1a6f1ae3277088d4de9af9686c71ae Mon Sep 17 00:00:00 2001 From d758d9e3fabcd6cba73c08b0404d48fe07f9b624 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@protonmail.com> <leohdz172@protonmail.com>
Date: Tue, 16 Aug 2022 15:28:00 -0500 Date: Tue, 16 Aug 2022 15:28:00 -0500
@ -16,7 +16,7 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
2 files changed, 33 insertions(+), 16 deletions(-) 2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..f07cf07 100644 index a784eb4f..c9cff440 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
@ -28,10 +28,10 @@ index a8ed61d..f07cf07 100644
static const float rootcolor[] = COLOR(0x222222ff); static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x444444ff); static const float bordercolor[] = COLOR(0x444444ff);
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..903afc6 100644 index 6f041a0d..b91134fd 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -297,7 +297,7 @@ static void rendermon(struct wl_listener *listener, void *data); @@ -315,7 +315,7 @@ static void rendermon(struct wl_listener *listener, void *data);
static void requestdecorationmode(struct wl_listener *listener, void *data); static void requestdecorationmode(struct wl_listener *listener, void *data);
static void requeststartdrag(struct wl_listener *listener, void *data); static void requeststartdrag(struct wl_listener *listener, void *data);
static void requestmonstate(struct wl_listener *listener, void *data); static void requestmonstate(struct wl_listener *listener, void *data);
@ -40,7 +40,7 @@ index 10d5a5b..903afc6 100644
static void run(char *startup_cmd); static void run(char *startup_cmd);
static void setcursor(struct wl_listener *listener, void *data); static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data); static void setcursorshape(struct wl_listener *listener, void *data);
@@ -696,7 +696,7 @@ closemon(Monitor *m) @@ -735,7 +735,7 @@ closemon(Monitor *m)
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (c->isfloating && c->geom.x > m->m.width) if (c->isfloating && c->geom.x > m->m.width)
resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y, resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y,
@ -49,14 +49,14 @@ index 10d5a5b..903afc6 100644
if (c->mon == m) if (c->mon == m)
setmon(c, selmon, c->tags); setmon(c, selmon, c->tags);
} }
@@ -731,8 +731,12 @@ commitnotify(struct wl_listener *listener, void *data) @@ -770,8 +770,12 @@ commitnotify(struct wl_listener *listener, void *data)
{ {
Client *c = wl_container_of(listener, c, commit); Client *c = wl_container_of(listener, c, commit);
- if (client_surface(c)->mapped) - if (client_surface(c)->mapped && c->mon)
- resize(c, c->geom, (c->isfloating && !c->isfullscreen)); - resize(c, c->geom, (c->isfloating && !c->isfullscreen));
+ if (client_surface(c)->mapped) { + if (client_surface(c)->mapped && c->mon) {
+ if (c->mon && c->mon->lt[c->mon->sellt]->arrange && !c->isfullscreen && !c->isfloating) + if (c->mon->lt[c->mon->sellt]->arrange && !c->isfullscreen && !c->isfloating)
+ c->mon->lt[c->mon->sellt]->arrange(c->mon); + c->mon->lt[c->mon->sellt]->arrange(c->mon);
+ else + else
+ resize(c, c->geom, (c->isfloating && !c->isfullscreen), (c->isfloating && !c->isfullscreen)); + resize(c, c->geom, (c->isfloating && !c->isfullscreen), (c->isfloating && !c->isfullscreen));
@ -64,7 +64,7 @@ index 10d5a5b..903afc6 100644
/* mark a pending resize as completed */ /* mark a pending resize as completed */
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
@@ -1579,7 +1583,7 @@ monocle(Monitor *m) @@ -1717,7 +1721,7 @@ monocle(Monitor *m)
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue; continue;
@ -73,21 +73,21 @@ index 10d5a5b..903afc6 100644
n++; n++;
} }
if (n) if (n)
@@ -1626,11 +1630,11 @@ motionnotify(uint32_t time) @@ -1797,11 +1801,11 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
if (cursor_mode == CurMove) { if (cursor_mode == CurMove) {
/* Move the grabbed client to the new position. */ /* Move the grabbed client to the new position. */
resize(grabc, (struct wlr_box){.x = cursor->x - grabcx, .y = cursor->y - grabcy, resize(grabc, (struct wlr_box){.x = ROUND(cursor->x) - grabcx, .y = ROUND(cursor->y) - grabcy,
- .width = grabc->geom.width, .height = grabc->geom.height}, 1); - .width = grabc->geom.width, .height = grabc->geom.height}, 1);
+ .width = grabc->geom.width, .height = grabc->geom.height}, 1, 1); + .width = grabc->geom.width, .height = grabc->geom.height}, 1, 1);
return; return;
} else if (cursor_mode == CurResize) { } else if (cursor_mode == CurResize) {
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y, resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
- .width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1); - .width = ROUND(cursor->x) - grabc->geom.x, .height = ROUND(cursor->y) - grabc->geom.y}, 1);
+ .width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1, 1); + .width = ROUND(cursor->x) - grabc->geom.x, .height = ROUND(cursor->y) - grabc->geom.y}, 1, 1);
return; return;
} }
@@ -1924,12 +1928,13 @@ requestmonstate(struct wl_listener *listener, void *data) @@ -2095,12 +2099,13 @@ requestmonstate(struct wl_listener *listener, void *data)
} }
void void
@ -102,16 +102,16 @@ index 10d5a5b..903afc6 100644
applybounds(c, bbox); applybounds(c, bbox);
/* Update scene-graph, including borders */ /* Update scene-graph, including borders */
@@ -2044,6 +2049,8 @@ setfloating(Client *c, int floating) @@ -2218,6 +2223,8 @@ setfloating(Client *c, int floating)
return; wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen (p && p->isfullscreen) ? LyrFS
? LyrFS : c->isfloating ? LyrFloat : LyrTile]); : c->isfloating ? LyrFloat : LyrTile]);
+ if (c->isfloating && !c->bw) + if (c->isfloating && !c->bw)
+ resize(c, c->mon->m, 0, 1); + resize(c, c->mon->m, 0, 1);
arrange(c->mon); arrange(c->mon);
printstatus(); printstatus();
} }
@@ -2061,11 +2068,11 @@ setfullscreen(Client *c, int fullscreen) @@ -2235,11 +2242,11 @@ setfullscreen(Client *c, int fullscreen)
if (fullscreen) { if (fullscreen) {
c->prev = c->geom; c->prev = c->geom;
@ -125,7 +125,7 @@ index 10d5a5b..903afc6 100644
} }
arrange(c->mon); arrange(c->mon);
printstatus(); printstatus();
@@ -2090,6 +2097,12 @@ setlayout(const Arg *arg) @@ -2266,6 +2273,12 @@ setlayout(const Arg *arg)
if (arg && arg->v) if (arg && arg->v)
selmon->lt[selmon->sellt] = (Layout *)arg->v; selmon->lt[selmon->sellt] = (Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
@ -138,7 +138,7 @@ index 10d5a5b..903afc6 100644
arrange(selmon); arrange(selmon);
printstatus(); printstatus();
} }
@@ -2124,7 +2137,7 @@ setmon(Client *c, Monitor *m, uint32_t newtags) @@ -2300,7 +2313,7 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
arrange(oldmon); arrange(oldmon);
if (m) { if (m) {
/* Make sure window actually overlaps with the monitor */ /* Make sure window actually overlaps with the monitor */
@ -147,16 +147,16 @@ index 10d5a5b..903afc6 100644
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
setfloating(c, c->isfloating); setfloating(c, c->isfloating);
@@ -2452,7 +2465,7 @@ tagmon(const Arg *arg) @@ -2589,7 +2602,7 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
- unsigned int i, n = 0, mw, my, ty; - unsigned int mw, my, ty;
+ unsigned int i, n = 0, mw, my, ty, draw_borders = 1; + unsigned int mw, my, ty, draw_borders = 1;
int i, n = 0;
Client *c; Client *c;
wl_list_for_each(c, &clients, link) @@ -2599,6 +2612,9 @@ tile(Monitor *m)
@@ -2461,6 +2474,9 @@ tile(Monitor *m)
if (n == 0) if (n == 0)
return; return;
@ -164,9 +164,9 @@ index 10d5a5b..903afc6 100644
+ draw_borders = 0; + draw_borders = 0;
+ +
if (n > m->nmaster) if (n > m->nmaster)
mw = m->nmaster ? m->w.width * m->mfact : 0; mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
else else
@@ -2471,11 +2487,11 @@ tile(Monitor *m) @@ -2609,11 +2625,11 @@ tile(Monitor *m)
continue; continue;
if (i < m->nmaster) { if (i < m->nmaster) {
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,
@ -180,7 +180,7 @@ index 10d5a5b..903afc6 100644
ty += c->geom.height; ty += c->geom.height;
} }
i++; i++;
@@ -2644,7 +2660,7 @@ updatemons(struct wl_listener *listener, void *data) @@ -2782,7 +2798,7 @@ updatemons(struct wl_listener *listener, void *data)
arrange(m); arrange(m);
/* make sure fullscreen clients have the right size */ /* make sure fullscreen clients have the right size */
if ((c = focustop(m)) && c->isfullscreen) if ((c = focustop(m)) && c->isfullscreen)
@ -189,15 +189,15 @@ index 10d5a5b..903afc6 100644
/* Try to re-set the gamma LUT when updating monitors, /* Try to re-set the gamma LUT when updating monitors,
* it's only really needed when enabling a disabled output, but meh. */ * it's only really needed when enabling a disabled output, but meh. */
@@ -2826,7 +2842,7 @@ configurex11(struct wl_listener *listener, void *data) @@ -2981,7 +2997,7 @@ configurex11(struct wl_listener *listener, void *data)
return; }
if (c->isfloating || client_is_unmanaged(c)) if (c->isfloating || client_is_unmanaged(c))
resize(c, (struct wlr_box){.x = event->x, .y = event->y, resize(c, (struct wlr_box){.x = event->x, .y = event->y,
- .width = event->width, .height = event->height}, 0); - .width = event->width + c->bw * 2, .height = event->height + c->bw * 2}, 0);
+ .width = event->width, .height = event->height}, 0, 1); + .width = event->width + c->bw * 2, .height = event->height + c->bw * 2}, 0, 1);
else else
arrange(c->mon); arrange(c->mon);
} }
-- --
2.43.0 2.45.2

View File

@ -1,4 +1,4 @@
From 6e619016b45230791484ea305f005e3b29f295f3 Mon Sep 17 00:00:00 2001 From 49a5dab24f7571d4888820f01c38cd899b7ee6cc Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me> From: choc <notchoc@proton.me>
Date: Sat, 4 May 2024 01:16:12 +0800 Date: Sat, 4 May 2024 01:16:12 +0800
Subject: [PATCH] implement wlr-tablet-v2 Subject: [PATCH] implement wlr-tablet-v2
@ -6,8 +6,8 @@ Subject: [PATCH] implement wlr-tablet-v2
--- ---
Makefile | 5 +- Makefile | 5 +-
config.def.h | 1 + config.def.h | 1 +
dwl.c | 224 +++++++++++++++++++++++++++++++++++++++++++++++++++ dwl.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 229 insertions(+), 1 deletion(-) 3 files changed, 230 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
index a67fdd3..74ccc01 100644 index a67fdd3..74ccc01 100644
@ -33,7 +33,7 @@ index a67fdd3..74ccc01 100644
config.h: config.h:
cp config.def.h $@ cp config.def.h $@
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 8847e58..12fed96 100644 index a784eb4..246356a 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
@ -45,7 +45,7 @@ index 8847e58..12fed96 100644
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 bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 1; /* border pixel of windows */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index bf763df..6e17222 100644 index 356b913..af646ff 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -47,6 +47,9 @@ @@ -47,6 +47,9 @@
@ -58,7 +58,7 @@ index bf763df..6e17222 100644
#include <wlr/types/wlr_viewporter.h> #include <wlr/types/wlr_viewporter.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h> #include <wlr/types/wlr_virtual_pointer_v1.h>
@@ -264,6 +267,7 @@ static void createmon(struct wl_listener *listener, void *data); @@ -266,6 +269,7 @@ static void createmon(struct wl_listener *listener, void *data);
static void createnotify(struct wl_listener *listener, void *data); static void createnotify(struct wl_listener *listener, void *data);
static void createpointer(struct wlr_pointer *pointer); static void createpointer(struct wlr_pointer *pointer);
static void createpointerconstraint(struct wl_listener *listener, void *data); static void createpointerconstraint(struct wl_listener *listener, void *data);
@ -66,17 +66,17 @@ index bf763df..6e17222 100644
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void cursorframe(struct wl_listener *listener, void *data); static void cursorframe(struct wl_listener *listener, void *data);
static void cursorwarptohint(void); static void cursorwarptohint(void);
@@ -277,6 +281,9 @@ static void destroynotify(struct wl_listener *listener, void *data); @@ -280,6 +284,9 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
static void destroypointerconstraint(struct wl_listener *listener, void *data);
static void destroysessionlock(struct wl_listener *listener, void *data); static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionmgr(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data);
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
+static void destroytablet(struct wl_listener *listener, void *data); +static void destroytablet(struct wl_listener *listener, void *data);
+static void destroytabletsurfacenotify(struct wl_listener *listener, void *data); +static void destroytabletsurfacenotify(struct wl_listener *listener, void *data);
+static void destroytablettool(struct wl_listener *listener, void *data); +static void destroytablettool(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir); static Monitor *dirtomon(enum wlr_direction dir);
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
@@ -329,6 +336,11 @@ static void spawn(const Arg *arg); @@ -332,6 +339,11 @@ static void spawn(const Arg *arg);
static void startdrag(struct wl_listener *listener, void *data); 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);
@ -88,7 +88,7 @@ index bf763df..6e17222 100644
static void tile(Monitor *m); static void tile(Monitor *m);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
@@ -386,6 +398,13 @@ static struct wlr_pointer_constraint_v1 *active_constraint; @@ -389,6 +401,13 @@ static struct wlr_pointer_constraint_v1 *active_constraint;
static struct wlr_cursor *cursor; static struct wlr_cursor *cursor;
static struct wlr_xcursor_manager *cursor_mgr; static struct wlr_xcursor_manager *cursor_mgr;
@ -102,15 +102,7 @@ index bf763df..6e17222 100644
static struct wlr_scene_rect *root_bg; static struct wlr_scene_rect *root_bg;
static struct wlr_session_lock_manager_v1 *session_lock_mgr; static struct wlr_session_lock_manager_v1 *session_lock_mgr;
static struct wlr_scene_rect *locked_bg; static struct wlr_scene_rect *locked_bg;
@@ -624,6 +643,7 @@ buttonpress(struct wl_listener *listener, void *data) @@ -1078,6 +1097,28 @@ createpointerconstraint(struct wl_listener *listener, void *data)
}
/* If the event wasn't handled by the compositor, notify the client with
* pointer focus that a button press has occurred */
+
wlr_seat_pointer_notify_button(seat,
event->time_msec, event->button, event->state);
}
@@ -1041,6 +1061,28 @@ createpointerconstraint(struct wl_listener *listener, void *data)
&pointer_constraint->destroy, destroypointerconstraint); &pointer_constraint->destroy, destroypointerconstraint);
} }
@ -139,8 +131,8 @@ index bf763df..6e17222 100644
void void
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint) cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
{ {
@@ -1217,6 +1259,26 @@ destroysessionmgr(struct wl_listener *listener, void *data) @@ -1266,6 +1307,29 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
wl_list_remove(&listener->link); free(group);
} }
+void +void
@ -152,12 +144,15 @@ index bf763df..6e17222 100644
+void +void
+destroytabletsurfacenotify(struct wl_listener *listener, void *data) +destroytabletsurfacenotify(struct wl_listener *listener, void *data)
+{ +{
+ if (tablet_curr_surface)
+ wl_list_remove(&destroy_tablet_surface_listener.link);
+ tablet_curr_surface = NULL; + tablet_curr_surface = NULL;
+} +}
+ +
+void +void
+destroytablettool(struct wl_listener *listener, void *data) +destroytablettool(struct wl_listener *listener, void *data)
+{ +{
+ if (tablet_curr_surface)
+ wl_list_remove(&destroy_tablet_surface_listener.link); + wl_list_remove(&destroy_tablet_surface_listener.link);
+ tablet_curr_surface = NULL; + tablet_curr_surface = NULL;
+ tablet_tool = NULL; + tablet_tool = NULL;
@ -166,7 +161,7 @@ index bf763df..6e17222 100644
Monitor * Monitor *
dirtomon(enum wlr_direction dir) dirtomon(enum wlr_direction dir)
{ {
@@ -1412,6 +1474,13 @@ inputdevice(struct wl_listener *listener, void *data) @@ -1461,6 +1525,12 @@ inputdevice(struct wl_listener *listener, void *data)
case WLR_INPUT_DEVICE_POINTER: case WLR_INPUT_DEVICE_POINTER:
createpointer(wlr_pointer_from_input_device(device)); createpointer(wlr_pointer_from_input_device(device));
break; break;
@ -174,13 +169,12 @@ index bf763df..6e17222 100644
+ createtablet(device); + createtablet(device);
+ break; + break;
+ case WLR_INPUT_DEVICE_TABLET_PAD: + case WLR_INPUT_DEVICE_TABLET_PAD:
+ createtablet(device);
+ tablet_pad = wlr_tablet_pad_create(tablet_mgr, seat, device); + tablet_pad = wlr_tablet_pad_create(tablet_mgr, seat, device);
+ break; + break;
default: default:
/* TODO handle other input device types */ /* TODO handle other input device types */
break; break;
@@ -2401,6 +2470,8 @@ setup(void) @@ -2447,6 +2517,8 @@ setup(void)
relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy); relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy);
@ -189,7 +183,7 @@ index bf763df..6e17222 100644
/* /*
* Creates a cursor, which is a wlroots utility for tracking the cursor * Creates a cursor, which is a wlroots utility for tracking the cursor
* image shown on screen. * image shown on screen.
@@ -2430,6 +2501,10 @@ setup(void) @@ -2476,6 +2548,10 @@ setup(void)
LISTEN_STATIC(&cursor->events.button, buttonpress); LISTEN_STATIC(&cursor->events.button, buttonpress);
LISTEN_STATIC(&cursor->events.axis, axisnotify); LISTEN_STATIC(&cursor->events.axis, axisnotify);
LISTEN_STATIC(&cursor->events.frame, cursorframe); LISTEN_STATIC(&cursor->events.frame, cursorframe);
@ -200,7 +194,7 @@ index bf763df..6e17222 100644
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1); cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape); LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape);
@@ -2569,6 +2644,155 @@ tagmon(const Arg *arg) @@ -2571,6 +2647,155 @@ tagmon(const Arg *arg)
setmon(sel, dirtomon(arg->i), 0); setmon(sel, dirtomon(arg->i), 0);
} }

View File

@ -1,4 +1,4 @@
From 1a083c558cb49bb89ccb152301c4a004f9fa227c Mon Sep 17 00:00:00 2001 From ab002204c8bb7c8c36828aeb89ef3cf9b0447ea6 Mon Sep 17 00:00:00 2001
From: Ben Collerson <benc@benc.cc> From: Ben Collerson <benc@benc.cc>
Date: Fri, 29 Dec 2023 19:02:11 +1000 Date: Fri, 29 Dec 2023 19:02:11 +1000
Subject: [PATCH] titleurgent Subject: [PATCH] titleurgent
@ -9,31 +9,30 @@ Subject: [PATCH] titleurgent
2 files changed, 13 insertions(+), 3 deletions(-) 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d9..f1deca87 100644 index a784eb4f..a5000901 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -21,11 +21,13 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al @@ -21,10 +21,12 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
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 isfloating titleurgent monitor */ + /* app_id title tags mask isfloating titleurgent monitor */
/* examples: /* examples: */
- { "Gimp", NULL, 0, 1, -1 }, - { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
+ { "Gimp", NULL, 0, 1, 0, -1 }, - { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
*/ + { "Gimp_EXAMPLE", NULL, 0, 1, 0, -1 }, /* Start on currently visible tags floating, not tiled */
- { "firefox", NULL, 1 << 8, 0, -1 }, + { "firefox_EXAMPLE", NULL, 1 << 8, 0, 0, -1 }, /* Start on ONLY tag "9" */
+ { "firefox", NULL, 1 << 8, 0, 0, -1 }, + { "org.qutebrowser.qutebrowser_EXAMPLE",
+ { "org.qutebrowser.qutebrowser",
+ NULL, 0, 0, 1, -1 }, + NULL, 0, 0, 1, -1 },
}; };
/* layout(s) */ /* layout(s) */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 4d19357f..6dc5d710 100644 index 6f041a0d..9486c435 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -133,6 +133,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;
@ -41,7 +40,7 @@ index 4d19357f..6dc5d710 100644
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -217,6 +218,7 @@ typedef struct { @@ -228,6 +229,7 @@ typedef struct {
const char *title; const char *title;
uint32_t tags; uint32_t tags;
int isfloating; int isfloating;
@ -49,7 +48,7 @@ index 4d19357f..6dc5d710 100644
int monitor; int monitor;
} Rule; } Rule;
@@ -431,6 +433,7 @@ applyrules(Client *c) @@ -455,6 +457,7 @@ applyrules(Client *c)
Monitor *mon = selmon, *m; Monitor *mon = selmon, *m;
c->isfloating = client_is_float_type(c); c->isfloating = client_is_float_type(c);
@ -57,7 +56,7 @@ index 4d19357f..6dc5d710 100644
if (!(appid = client_get_appid(c))) if (!(appid = client_get_appid(c)))
appid = broken; appid = broken;
if (!(title = client_get_title(c))) if (!(title = client_get_title(c)))
@@ -440,6 +443,7 @@ applyrules(Client *c) @@ -464,6 +467,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title)) if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) { && (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
@ -65,7 +64,7 @@ index 4d19357f..6dc5d710 100644
newtags |= r->tags; newtags |= r->tags;
i = 0; i = 0;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@@ -2683,6 +2687,10 @@ updatetitle(struct wl_listener *listener, void *data) @@ -2821,6 +2825,10 @@ updatetitle(struct wl_listener *listener, void *data)
Client *c = wl_container_of(listener, c, set_title); Client *c = wl_container_of(listener, c, set_title);
if (c == focustop(c->mon)) if (c == focustop(c->mon))
printstatus(); printstatus();
@ -77,5 +76,5 @@ index 4d19357f..6dc5d710 100644
void void
-- --
2.43.0 2.45.1

View File

@ -3,7 +3,7 @@ Adds (inner) gaps between client windows and (outer) gaps between windows and th
### Download ### Download
- [git branch](https://codeberg.org/sevz/dwl/src/branch/vanitygaps) - [git branch](https://codeberg.org/sevz/dwl/src/branch/vanitygaps)
- [2023-11-25](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/vanitygaps/vanitygaps.patch) - [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/vanitygaps/vanitygaps.patch)
### Authors ### Authors
- [sevz](https://codeberg.org/sevz) - [sevz](https://codeberg.org/sevz)

View File

@ -1,4 +1,4 @@
From a01bec27c6a2c4828c2b3a5a852ceb5ca6d84b92 Mon Sep 17 00:00:00 2001 From acc4b618849ce625d6c32525e91743a96529580f Mon Sep 17 00:00:00 2001
From: Bonicgamer <44382222+Bonicgamer@users.noreply.github.com> From: Bonicgamer <44382222+Bonicgamer@users.noreply.github.com>
Date: Mon, 17 Aug 2020 14:48:24 -0400 Date: Mon, 17 Aug 2020 14:48:24 -0400
Subject: [PATCH 1/2] Implement vanitygaps Subject: [PATCH 1/2] Implement vanitygaps
@ -13,7 +13,7 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
2 files changed, 161 insertions(+), 10 deletions(-) 2 files changed, 161 insertions(+), 10 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..ac56870 100644 index a784eb4f..6b04d9ff 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -6,7 +6,12 @@ @@ -6,7 +6,12 @@
@ -29,10 +29,10 @@ index a8ed61d..ac56870 100644
static const float rootcolor[] = COLOR(0x222222ff); static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x444444ff); static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff); static const float focuscolor[] = COLOR(0x005577ff);
@@ -128,6 +133,22 @@ static const Key keys[] = { @@ -130,6 +135,22 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } }, + { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } }, + { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } }, + { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
@ -53,10 +53,10 @@ index a8ed61d..ac56870 100644
{ MODKEY, XKB_KEY_Tab, view, {0} }, { MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 10d5a5b..d82078f 100644 index 6f041a0d..6a3e6fe2 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -193,6 +193,10 @@ struct Monitor { @@ -199,6 +199,10 @@ struct Monitor {
struct wlr_box w; /* window area, layout-relative */ struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface.link */ struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2]; const Layout *lt[2];
@ -67,15 +67,15 @@ index 10d5a5b..d82078f 100644
unsigned int seltags; unsigned int seltags;
unsigned int sellt; unsigned int sellt;
uint32_t tagset[2]; uint32_t tagset[2];
@@ -254,6 +258,7 @@ static void createmon(struct wl_listener *listener, void *data); @@ -269,6 +273,7 @@ static void createpointerconstraint(struct wl_listener *listener, void *data);
static void createnotify(struct wl_listener *listener, void *data); static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void createpointer(struct wlr_pointer *pointer);
static void cursorframe(struct wl_listener *listener, void *data); static void cursorframe(struct wl_listener *listener, void *data);
static void cursorwarptohint(void);
+static void defaultgaps(const Arg *arg); +static void defaultgaps(const Arg *arg);
static void destroydecoration(struct wl_listener *listener, void *data); static void destroydecoration(struct wl_listener *listener, void *data);
static void destroydragicon(struct wl_listener *listener, void *data); static void destroydragicon(struct wl_listener *listener, void *data);
static void destroyidleinhibitor(struct wl_listener *listener, void *data); static void destroyidleinhibitor(struct wl_listener *listener, void *data);
@@ -271,6 +276,13 @@ static Client *focustop(Monitor *m); @@ -288,6 +293,13 @@ static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data); static void fullscreennotify(struct wl_listener *listener, void *data);
static void handlesig(int signo); static void handlesig(int signo);
static void incnmaster(const Arg *arg); static void incnmaster(const Arg *arg);
@ -89,7 +89,7 @@ index 10d5a5b..d82078f 100644
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym); static int keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data); static void keypress(struct wl_listener *listener, void *data);
@@ -304,6 +316,7 @@ static void setcursorshape(struct wl_listener *listener, void *data); @@ -322,6 +334,7 @@ static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating); static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setgamma(struct wl_listener *listener, void *data); static void setgamma(struct wl_listener *listener, void *data);
@ -97,7 +97,7 @@ index 10d5a5b..d82078f 100644
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags); static void setmon(Client *c, Monitor *m, uint32_t newtags);
@@ -317,6 +330,7 @@ static void tagmon(const Arg *arg); @@ -335,6 +348,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
@ -105,7 +105,7 @@ index 10d5a5b..d82078f 100644
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data); static void unlocksession(struct wl_listener *listener, void *data);
@@ -384,6 +398,8 @@ static struct wlr_box sgeom; @@ -407,6 +421,8 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
@ -114,7 +114,7 @@ index 10d5a5b..d82078f 100644
#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);
@@ -854,6 +870,11 @@ createmon(struct wl_listener *listener, void *data) @@ -930,6 +946,11 @@ createmon(struct wl_listener *listener, void *data)
for (i = 0; i < LENGTH(m->layers); i++) for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]); wl_list_init(&m->layers[i]);
@ -126,8 +126,8 @@ index 10d5a5b..d82078f 100644
wlr_output_state_init(&state); wlr_output_state_init(&state);
/* Initialize monitor state using configured rules */ /* Initialize monitor state using configured rules */
m->tagset[0] = m->tagset[1] = 1; m->tagset[0] = m->tagset[1] = 1;
@@ -1017,6 +1038,12 @@ cursorframe(struct wl_listener *listener, void *data) @@ -1131,6 +1152,12 @@ cursorwarptohint(void)
wlr_seat_pointer_notify_frame(seat); }
} }
+void +void
@ -139,7 +139,7 @@ index 10d5a5b..d82078f 100644
void void
destroydecoration(struct wl_listener *listener, void *data) destroydecoration(struct wl_listener *listener, void *data)
{ {
@@ -1320,6 +1347,83 @@ incnmaster(const Arg *arg) @@ -1460,6 +1487,83 @@ incnmaster(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
@ -223,7 +223,7 @@ index 10d5a5b..d82078f 100644
void void
inputdevice(struct wl_listener *listener, void *data) inputdevice(struct wl_listener *listener, void *data)
{ {
@@ -2080,6 +2184,16 @@ setgamma(struct wl_listener *listener, void *data) @@ -2256,6 +2360,16 @@ setgamma(struct wl_listener *listener, void *data)
wlr_output_schedule_frame(m->wlr_output); wlr_output_schedule_frame(m->wlr_output);
} }
@ -240,16 +240,16 @@ index 10d5a5b..d82078f 100644
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@@ -2452,7 +2566,7 @@ tagmon(const Arg *arg) @@ -2589,7 +2703,7 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
- unsigned int i, n = 0, mw, my, ty; - unsigned int mw, my, ty;
+ unsigned int i, n = 0, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty; + unsigned int mw, my, ty, h, r, oe = enablegaps, ie = enablegaps;
int i, n = 0;
Client *c; Client *c;
wl_list_for_each(c, &clients, link) @@ -2599,22 +2713,31 @@ tile(Monitor *m)
@@ -2461,22 +2575,31 @@ tile(Monitor *m)
if (n == 0) if (n == 0)
return; return;
@ -258,8 +258,8 @@ index 10d5a5b..d82078f 100644
+ } + }
+ +
if (n > m->nmaster) if (n > m->nmaster)
- mw = m->nmaster ? m->w.width * m->mfact : 0; - mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
+ mw = m->nmaster ? (m->w.width + m->gappiv*ie) * m->mfact : 0; + mw = m->nmaster ? ROUND((m->w.width + m->gappiv*ie) * m->mfact) : 0;
else else
- mw = m->w.width; - mw = m->w.width;
- i = my = ty = 0; - i = my = ty = 0;
@ -290,7 +290,7 @@ index 10d5a5b..d82078f 100644
} }
i++; i++;
} }
@@ -2499,6 +2622,13 @@ togglefullscreen(const Arg *arg) @@ -2637,6 +2760,13 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen); setfullscreen(sel, !sel->isfullscreen);
} }
@ -305,10 +305,10 @@ index 10d5a5b..d82078f 100644
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {
-- --
2.43.0 2.45.2
From 4ef9eed5ef259e817c038697d3055425228d58d7 Mon Sep 17 00:00:00 2001 From d1c6fa3d9e6ca3ed55bf70c91f9da7b335312c6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@protonmail.com> <leohdz172@protonmail.com>
Date: Wed, 20 Jul 2022 00:15:32 -0500 Date: Wed, 20 Jul 2022 00:15:32 -0500
@ -324,7 +324,7 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
2 files changed, 6 insertions(+), 1 deletion(-) 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index ac56870..f52c1fc 100644 index 6b04d9ff..395b28f4 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
@ -336,10 +336,10 @@ index ac56870..f52c1fc 100644
static const unsigned int gappih = 10; /* horiz inner gap between windows */ static const unsigned int gappih = 10; /* horiz inner gap between windows */
static const unsigned int gappiv = 10; /* vert inner gap between windows */ static const unsigned int gappiv = 10; /* vert inner gap between windows */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index d82078f..854907e 100644 index 6a3e6fe2..4579a194 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -1683,8 +1683,12 @@ monocle(Monitor *m) @@ -1821,8 +1821,12 @@ monocle(Monitor *m)
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue; continue;
@ -354,5 +354,5 @@ index d82078f..854907e 100644
if (n) if (n)
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n);
-- --
2.43.0 2.45.2

View File

@ -1,47 +1,47 @@
From 9831bdfcadaf779640bf7c5662fc40fdc278a8ba Mon Sep 17 00:00:00 2001 From 330fa634a83e9b332494fade75552e02583bad6c Mon Sep 17 00:00:00 2001
From: Ben Collerson <benc@benc.cc> From: Ben Collerson <benc@benc.cc>
Date: Sat, 30 Dec 2023 13:39:31 +1000 Date: Sat, 30 Dec 2023 13:39:31 +1000
Subject: [PATCH] viewnextocctag Subject: [PATCH] viewnextocctag
--- ---
config.def.h | 2 ++ config.def.h | 2 ++
dwl.c | 33 +++++++++++++++++++++++++++++++++ dwl.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+) 2 files changed, 36 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d9..a668d0b0 100644 index a784eb4f..e1a6a428 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -128,6 +128,8 @@ static const Key keys[] = { @@ -130,6 +130,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_H, viewnextocctag, {.i = -1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_H, viewnextocctag, {.i = -1} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_L, viewnextocctag, {.i = +1} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_L, viewnextocctag, {.i = +1} },
{ 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|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 4d19357f..a42c4871 100644 index 6f041a0d..df5461d0 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -286,6 +286,7 @@ static void motionabsolute(struct wl_listener *listener, void *data); @@ -304,6 +304,7 @@ static void motionnotify(uint32_t time, struct wlr_input_device *device, double
static void motionnotify(uint32_t time); double sy, double sx_unaccel, double sy_unaccel);
static void motionrelative(struct wl_listener *listener, void *data); static void motionrelative(struct wl_listener *listener, void *data);
static void moveresize(const Arg *arg); static void moveresize(const Arg *arg);
+unsigned int nextocctag(int); +unsigned int nextocctag(int);
static void outputmgrapply(struct wl_listener *listener, void *data); static void outputmgrapply(struct wl_listener *listener, void *data);
static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test); static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test);
static void outputmgrtest(struct wl_listener *listener, void *data); static void outputmgrtest(struct wl_listener *listener, void *data);
@@ -326,6 +327,7 @@ static void updatemons(struct wl_listener *listener, void *data); @@ -344,6 +345,7 @@ static void updatemons(struct wl_listener *listener, void *data);
static void updatetitle(struct wl_listener *listener, void *data); static void updatetitle(struct wl_listener *listener, void *data);
static void urgent(struct wl_listener *listener, void *data); static void urgent(struct wl_listener *listener, void *data);
static void view(const Arg *arg); static void view(const Arg *arg);
+static void viewnextocctag(const Arg *argint); +static void viewnextocctag(const Arg *argint);
static void virtualkeyboard(struct wl_listener *listener, void *data); static void virtualkeyboard(struct wl_listener *listener, void *data);
static void virtualpointer(struct wl_listener *listener, void *data);
static Monitor *xytomon(double x, double y); static Monitor *xytomon(double x, double y);
static void xytonode(double x, double y, struct wlr_surface **psurface, @@ -1868,6 +1870,27 @@ moveresize(const Arg *arg)
@@ -1697,6 +1699,26 @@ moveresize(const Arg *arg)
} }
} }
@ -65,10 +65,11 @@ index 4d19357f..a42c4871 100644
+ +
+ return seltag & TAGMASK; + return seltag & TAGMASK;
+} +}
+
void void
outputmgrapply(struct wl_listener *listener, void *data) outputmgrapply(struct wl_listener *listener, void *data)
{ {
@@ -2714,6 +2736,17 @@ view(const Arg *arg) @@ -2852,6 +2875,17 @@ view(const Arg *arg)
printstatus(); printstatus();
} }
@ -87,5 +88,5 @@ index 4d19357f..a42c4871 100644
virtualkeyboard(struct wl_listener *listener, void *data) virtualkeyboard(struct wl_listener *listener, void *data)
{ {
-- --
2.43.0 2.45.1

View File

@ -1,18 +1,8 @@
From 7a2b65af8c7a56c8d78875530685422702be993e Mon Sep 17 00:00:00 2001
From: Dhruva Sambrani <44899822+DhruvaSambrani@users.noreply.github.com>
Date: Mon, 8 Jan 2024 15:04:09 +0100
Subject: [PATCH] first winview commit
---
config.def.h | 1 +
dwl.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a8ed61d..af9d866 100644 index a784eb4..d09ee55 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -138,6 +138,7 @@ static const Key keys[] = { @@ -140,6 +140,7 @@ static const Key keys[] = {
{ 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_0, view, {.ui = ~0} }, { MODKEY, XKB_KEY_0, view, {.ui = ~0} },
@ -21,19 +11,19 @@ index a8ed61d..af9d866 100644
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} }, { MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 632dabf..5f3a596 100644 index 6f041a0..65df112 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -327,6 +327,7 @@ static void updatetitle(struct wl_listener *listener, void *data); @@ -346,6 +346,7 @@ static void urgent(struct wl_listener *listener, void *data);
static void urgent(struct wl_listener *listener, void *data);
static void view(const Arg *arg); static void view(const Arg *arg);
static void virtualkeyboard(struct wl_listener *listener, void *data); static void virtualkeyboard(struct wl_listener *listener, void *data);
static void virtualpointer(struct wl_listener *listener, void *data);
+static void winview(const Arg *a); +static void winview(const Arg *a);
static Monitor *xytomon(double x, double y); static Monitor *xytomon(double x, double y);
static void xytonode(double x, double y, struct wlr_surface **psurface, static void xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny); Client **pc, LayerSurface **pl, double *nx, double *ny);
@@ -2726,6 +2727,17 @@ virtualkeyboard(struct wl_listener *listener, void *data) @@ -2877,6 +2878,17 @@ virtualpointer(struct wl_listener *listener, void *data)
wlr_keyboard_group_add_keyboard(vkb_group.wlr_group, &keyboard->keyboard); wlr_cursor_map_input_to_output(cursor, &pointer.base, event->suggested_output);
} }
+void +void
@ -50,6 +40,3 @@ index 632dabf..5f3a596 100644
Monitor * Monitor *
xytomon(double x, double y) xytomon(double x, double y)
{ {
--
2.43.0