From 342850487acf4fc7383429786b9cb05a6a4cdf4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Sun, 24 Sep 2023 14:41:13 -0600 Subject: [PATCH 01/10] include dwl.desktop in the tarbal --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ff6e518..5320e42 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ clean: dist: clean mkdir -p dwl-$(VERSION) cp -R LICENSE* Makefile README.md client.h config.def.h\ - config.mk protocols dwl.1 dwl.c util.c util.h\ + config.mk protocols dwl.1 dwl.c util.c util.h dwl.desktop\ dwl-$(VERSION) tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION) rm -rf dwl-$(VERSION) From aec21eca1fedbb8d924cd3dfaf4503e3c19fc873 Mon Sep 17 00:00:00 2001 From: Forrest Bushstone Date: Fri, 29 Sep 2023 14:45:22 -0400 Subject: [PATCH 02/10] make sure that fullscreen clients are on the correct screen when isfloating is true Bug: https://github.com/djpohly/dwl/issues/487 --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 4118fd8..2cedede 100644 --- a/dwl.c +++ b/dwl.c @@ -2102,8 +2102,8 @@ setmon(Client *c, Monitor *m, uint32_t newtags) /* Make sure window actually overlaps with the monitor */ resize(c, c->geom, 0); c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */ - setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ setfloating(c, c->isfloating); + setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ } focusclient(focustop(selmon), 1); } From f695674361d15a312eed2234e8d21a5e03719559 Mon Sep 17 00:00:00 2001 From: Forrest Bushstone Date: Fri, 29 Sep 2023 18:16:42 -0400 Subject: [PATCH 03/10] Check if c is fullscreen before reparenting it to LyrFloating Closes: https://github.com/djpohly/dwl/issues/487 --- dwl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dwl.c b/dwl.c index 2cedede..b51614d 100644 --- a/dwl.c +++ b/dwl.c @@ -2028,7 +2028,8 @@ setfloating(Client *c, int floating) c->isfloating = floating; if (!c->mon) return; - wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]); + wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen + ? LyrFS : c->isfloating ? LyrFloat : LyrTile]); arrange(c->mon); printstatus(); } @@ -2041,7 +2042,7 @@ setfullscreen(Client *c, int fullscreen) return; c->bw = fullscreen ? 0 : borderpx; client_set_fullscreen(c, fullscreen); - wlr_scene_node_reparent(&c->scene->node, layers[fullscreen + wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ? LyrFS : c->isfloating ? LyrFloat : LyrTile]); if (fullscreen) { @@ -2102,8 +2103,8 @@ setmon(Client *c, Monitor *m, uint32_t newtags) /* Make sure window actually overlaps with the monitor */ resize(c, c->geom, 0); c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */ - setfloating(c, c->isfloating); setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ + setfloating(c, c->isfloating); } focusclient(focustop(selmon), 1); } From 0ab1ed6530a3891cbf1d9d2943b20f386e0e4a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 5 Oct 2023 22:03:59 -0600 Subject: [PATCH 04/10] add macro to configure colors Closes: https://github.com/djpohly/dwl/issues/466 --- config.def.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 1677f6f..9e0c293 100644 --- a/config.def.h +++ b/config.def.h @@ -1,11 +1,15 @@ +#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \ + ((hex >> 16) & 0xFF) / 255.0f, \ + ((hex >> 8) & 0xFF) / 255.0f, \ + (hex & 0xFF) / 255.0f } /* appearance */ static const int sloppyfocus = 1; /* focus follows mouse */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const unsigned int borderpx = 1; /* border pixel of windows */ -static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0}; -static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0}; +static const float bordercolor[] = COLOR(0x808080ff); +static const float focuscolor[] = COLOR(0xff0000ff); /* To conform 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}; +static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ /* tagging - tagcount must be no greater than 31 */ #define TAGCOUNT (9) From f4031590cd506f7afe5aa62ae58b9ef4bac99af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 5 Oct 2023 22:06:30 -0600 Subject: [PATCH 05/10] add missing url about the COLOR macro --- config.def.h | 1 + 1 file changed, 1 insertion(+) diff --git a/config.def.h b/config.def.h index 9e0c293..0a08aea 100644 --- a/config.def.h +++ b/config.def.h @@ -1,3 +1,4 @@ +/* Taken from https://github.com/djpohly/dwl/issues/466 */ #define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \ ((hex >> 16) & 0xFF) / 255.0f, \ ((hex >> 8) & 0xFF) / 255.0f, \ From d63f4078c51c484a47b1c463912dc6038e787426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 5 Oct 2023 22:09:08 -0600 Subject: [PATCH 06/10] use the same border colors as dwm --- config.def.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 0a08aea..f4c3cae 100644 --- a/config.def.h +++ b/config.def.h @@ -7,8 +7,8 @@ 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 unsigned int borderpx = 1; /* border pixel of windows */ -static const float bordercolor[] = COLOR(0x808080ff); -static const float focuscolor[] = COLOR(0xff0000ff); +static const float bordercolor[] = COLOR(0x444444ff); +static const float focuscolor[] = COLOR(0x005577ff); /* To conform 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 */ From 72a7d78a1a7926a207539eb50f44b2e1eb089d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 5 Oct 2023 22:13:56 -0600 Subject: [PATCH 07/10] make the borders red borders for urgent clients iirc this is the same behavior of dwm --- config.def.h | 1 + dwl.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/config.def.h b/config.def.h index f4c3cae..895284f 100644 --- a/config.def.h +++ b/config.def.h @@ -9,6 +9,7 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will static const unsigned int borderpx = 1; /* border pixel of windows */ static const float bordercolor[] = COLOR(0x444444ff); static const float focuscolor[] = COLOR(0x005577ff); +static const float urgentcolor[] = COLOR(0xff0000ff); /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ diff --git a/dwl.c b/dwl.c index b51614d..87f0636 100644 --- a/dwl.c +++ b/dwl.c @@ -2589,10 +2589,14 @@ urgent(struct wl_listener *listener, void *data) { struct wlr_xdg_activation_v1_request_activate_event *event = data; Client *c = NULL; + int i; toplevel_from_wlr_surface(event->surface, &c, NULL); if (!c || c == focustop(selmon)) return; + for (i = 0; i < 4; i++) + wlr_scene_rect_set_color(c->border[i], urgentcolor); + c->isurgent = 1; printstatus(); } @@ -2752,9 +2756,13 @@ void sethints(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, set_hints); + int i; if (c == focustop(selmon)) return; + for (i = 0; i < 4; i++) + wlr_scene_rect_set_color(c->border[i], urgentcolor); + c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); printstatus(); } From a18c52830010675cc794984c86db6c39776f914a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 5 Oct 2023 22:20:08 -0600 Subject: [PATCH 08/10] simplify setting the border color of clients --- client.h | 8 ++++++++ dwl.c | 18 +++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client.h b/client.h index 5a45edc..cf1ed85 100644 --- a/client.h +++ b/client.h @@ -323,6 +323,14 @@ client_send_close(Client *c) wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel); } +static inline void +client_set_border_color(Client *c, const float color[static 4]) +{ + int i; + for (i = 0; i < 4; i++) + wlr_scene_rect_set_color(c->border[i], color); +} + static inline void client_set_fullscreen(Client *c, int fullscreen) { diff --git a/dwl.c b/dwl.c index 87f0636..33b370c 100644 --- a/dwl.c +++ b/dwl.c @@ -1199,7 +1199,7 @@ void focusclient(Client *c, int lift) { struct wlr_surface *old = seat->keyboard_state.focused_surface; - int i, unused_lx, unused_ly, old_client_type; + int unused_lx, unused_ly, old_client_type; Client *old_c = NULL; LayerSurface *old_l = NULL; @@ -1230,8 +1230,7 @@ focusclient(Client *c, int lift) /* Don't change border color if there is an exclusive focus or we are * handling a drag operation */ if (!exclusive_focus && !seat->drag) - for (i = 0; i < 4; i++) - wlr_scene_rect_set_color(c->border[i], focuscolor); + client_set_border_color(c, focuscolor); } /* Deactivate old client if focus is changing */ @@ -1248,8 +1247,7 @@ focusclient(Client *c, int lift) /* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg * and probably other clients */ } else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) { - for (i = 0; i < 4; i++) - wlr_scene_rect_set_color(old_c->border[i], bordercolor); + client_set_border_color(old_c, bordercolor); client_activate_surface(old, 0); } @@ -2589,14 +2587,11 @@ urgent(struct wl_listener *listener, void *data) { struct wlr_xdg_activation_v1_request_activate_event *event = data; Client *c = NULL; - int i; toplevel_from_wlr_surface(event->surface, &c, NULL); if (!c || c == focustop(selmon)) return; - for (i = 0; i < 4; i++) - wlr_scene_rect_set_color(c->border[i], urgentcolor); - + client_set_border_color(c, urgentcolor); c->isurgent = 1; printstatus(); } @@ -2756,13 +2751,10 @@ void sethints(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, set_hints); - int i; if (c == focustop(selmon)) return; - for (i = 0; i < 4; i++) - wlr_scene_rect_set_color(c->border[i], urgentcolor); - + client_set_border_color(c, urgentcolor); c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); printstatus(); } From 935b852dc5b7e042f3eaf446e69048631b8101be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 9 Oct 2023 10:56:05 -0600 Subject: [PATCH 09/10] add [-d] flag to enable debug logging --- config.def.h | 3 +++ dwl.1 | 7 +++++++ dwl.c | 8 ++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 895284f..9365505 100644 --- a/config.def.h +++ b/config.def.h @@ -17,6 +17,9 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al #define TAGCOUNT (9) static const int tagcount = TAGCOUNT; +/* logging */ +static int log_level = WLR_ERROR; + static const Rule rules[] = { /* app_id title tags mask isfloating monitor */ /* examples: diff --git a/dwl.1 b/dwl.1 index 6f164e6..ce1acf9 100644 --- a/dwl.1 +++ b/dwl.1 @@ -7,6 +7,7 @@ .Sh SYNOPSIS .Nm .Op Fl v +.Op Fl d .Op Fl s Ar startup command .Sh DESCRIPTION .Nm @@ -22,6 +23,12 @@ option, writes its name and version to standard error and exits unsuccessfully. .Pp When given the +.Fl d +option, +.Nm +enables full wlroots logging, including debug information. +.Pp +When given the .Fl s option, .Nm diff --git a/dwl.c b/dwl.c index 33b370c..7fe1559 100644 --- a/dwl.c +++ b/dwl.c @@ -2139,6 +2139,8 @@ setup(void) for (i = 0; i < LENGTH(sig); i++) sigaction(sig[i], &sa, NULL); + wlr_log_init(log_level, NULL); + /* The Wayland display is managed by libwayland. It handles accepting * clients from the Unix socket, manging Wayland globals, and so on. */ dpy = wl_display_create(); @@ -2797,9 +2799,11 @@ main(int argc, char *argv[]) char *startup_cmd = NULL; int c; - while ((c = getopt(argc, argv, "s:hv")) != -1) { + while ((c = getopt(argc, argv, "s:hdv")) != -1) { if (c == 's') startup_cmd = optarg; + else if (c == 'd') + log_level = WLR_DEBUG; else if (c == 'v') die("dwl " VERSION); else @@ -2817,5 +2821,5 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; usage: - die("Usage: %s [-v] [-s startup command]", argv[0]); + die("Usage: %s [-v] [-d] [-s startup command]", argv[0]); } From 6d9a915fb60d38ebf0ae897fbd6affde39ed8d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 9 Oct 2023 11:12:24 -0600 Subject: [PATCH 10/10] Revert "just add define" I'm going to make some changes in the config file anyway This reverts commit e5367753bb90add013ee5d170a110064298ac2c4. --- config.def.h | 3 +-- dwl.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 9365505..4e30885 100644 --- a/config.def.h +++ b/config.def.h @@ -13,9 +13,8 @@ static const float urgentcolor[] = COLOR(0xff0000ff); /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* 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) -static const int tagcount = TAGCOUNT; /* logging */ static int log_level = WLR_ERROR; diff --git a/dwl.c b/dwl.c index 7fe1559..e07560e 100644 --- a/dwl.c +++ b/dwl.c @@ -67,7 +67,7 @@ #define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) #define END(A) ((A) + LENGTH(A)) -#define TAGMASK ((1u << tagcount) - 1) +#define TAGMASK ((1u << TAGCOUNT) - 1) #define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L))) #define IDLE_NOTIFY_ACTIVITY wlr_idle_notify_activity(idle, seat), wlr_idle_notifier_v1_notify_activity(idle_notifier, seat)