From 2b3504e439f3064700c4aed002caf56a1a7d21ac Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Fri, 1 Dec 2023 21:35:50 -0600 Subject: sort #includes --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 1bfe8cf..bbb27e4 100644 --- a/dwl.c +++ b/dwl.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From 28ec843aee3d339ef0b5b95685cdd7c2bcacdb16 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 14:09:10 -0600 Subject: make sure popups of a layer surface are in the correct layer previously it worked because we checked in every commit the layer in a353eee2cac0378a4201e408a3417aa107a7f647 and b100b446b8c82bc2dcdbb40856ab87ed4a4ad594 we changed the way it's handled and now if the layer surface does not change the layer we don't it either. meaning that if it was created in the bottom layer and did not change the layer the popups would show behind xdg clients --- dwl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index bbb27e4..e9b7d84 100644 --- a/dwl.c +++ b/dwl.c @@ -814,7 +814,8 @@ createlayersurface(struct wl_listener *listener, void *data) l->mon = layer_surface->output->data; l->scene_layer = wlr_scene_layer_surface_v1_create(scene_layer, layer_surface); l->scene = l->scene_layer->tree; - l->popups = surface->data = wlr_scene_tree_create(scene_layer); + l->popups = surface->data = wlr_scene_tree_create(layer_surface->current.layer + < ZWLR_LAYER_SHELL_V1_LAYER_TOP ? layers[LyrTop] : scene_layer); l->scene->node.data = l; -- cgit v1.2.3 From 393078d80c330be0313ac84c9de2de132f785d6d Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 14:18:03 -0600 Subject: store the layersurface pointer in l->popups->node.data as well --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index e9b7d84..edba265 100644 --- a/dwl.c +++ b/dwl.c @@ -816,7 +816,7 @@ createlayersurface(struct wl_listener *listener, void *data) l->scene = l->scene_layer->tree; l->popups = surface->data = wlr_scene_tree_create(layer_surface->current.layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP ? layers[LyrTop] : scene_layer); - l->scene->node.data = l; + l->scene->node.data = l->popups->node.data = l; wl_list_insert(&l->mon->layers[layer_surface->pending.layer],&l->link); -- cgit v1.2.3 From be2a1dea26f04bc8161d2e7cfb28e8e19b949944 Mon Sep 17 00:00:00 2001 From: fictitiousexistence Date: Thu, 30 Nov 2023 05:30:22 +0000 Subject: Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 820828f..1aa5195 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`, but differs in that the display server will not shut down when this process terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait for it to terminate (if it hasn't already). This makes it ideal for execing into -a user service manager like [s6], [anopa], [runit], or [`systemd --user`]. +a user service manager like [s6], [anopa], [runit], [dinit], or [`systemd --user`]. Note: The `-s` command is run as a *child process* of dwl, which means that it does not have the ability to affect the environment of dwl or of any processes @@ -167,6 +167,7 @@ inspiration, and to the various contributors to the project, including: [s6]: https://skarnet.org/software/s6/ [anopa]: https://jjacky.com/anopa/ [runit]: http://smarden.org/runit/faq.html#userservices +[dinit]: https://davmac.org/projects/dinit/ [`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User [wiki]: https://codeberg.org/dwl/dwl/wiki/Home#compatible-status-bars [list of useful resources on our wiki]: -- cgit v1.2.3 From 7341d047da511a457a54ec342703d6fc6cdd5240 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 30 Nov 2023 22:30:03 -0600 Subject: add a note about not removing the default rule Closes: https://codeberg.org/dwl/dwl/issues/527 --- config.def.h | 1 + 1 file changed, 1 insertion(+) diff --git a/config.def.h b/config.def.h index db0babc..5375eb5 100644 --- a/config.def.h +++ b/config.def.h @@ -36,6 +36,7 @@ static const Layout layouts[] = { }; /* monitors */ +/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */ static const MonitorRule monrules[] = { /* name mfact nmaster scale layout rotate/reflect x y */ /* example of a HiDPI laptop monitor: -- cgit v1.2.3 From 80c9ad12ba81ab54ac6aad8b413a158d1de52705 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 21:43:48 -0600 Subject: reduce calls to client_get_geometry --- dwl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index edba265..670e95f 100644 --- a/dwl.c +++ b/dwl.c @@ -1512,9 +1512,10 @@ mapnotify(struct wl_listener *listener, void *data) : wlr_scene_subsurface_tree_create(c->scene, client_surface(c)); c->scene->node.data = c->scene_surface->node.data = c; + client_get_geometry(c, &c->geom); + /* Handle unmanaged clients first so we can return prior create borders */ if (client_is_unmanaged(c)) { - client_get_geometry(c, &c->geom); /* Unmanaged clients always are floating */ wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]); wlr_scene_node_set_position(&c->scene->node, c->geom.x + borderpx, @@ -1533,7 +1534,6 @@ mapnotify(struct wl_listener *listener, void *data) /* Initialize client geometry with room for border */ client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT); - client_get_geometry(c, &c->geom); c->geom.width += 2 * c->bw; c->geom.height += 2 * c->bw; -- cgit v1.2.3 From a760757b82eb10ce09a890e0a5ea1c76de22b144 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 21:44:53 -0600 Subject: set the correct border color when mapping a client --- dwl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 670e95f..b4d91b6 100644 --- a/dwl.c +++ b/dwl.c @@ -1528,7 +1528,8 @@ mapnotify(struct wl_listener *listener, void *data) } for (i = 0; i < 4; i++) { - c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, bordercolor); + c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, + c->isurgent ? urgentcolor : bordercolor); c->border[i]->node.data = c; } -- cgit v1.2.3 From 472a31b5a4c0165c796fe6497160106bd73a6b5c Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 21:48:56 -0600 Subject: LayerSurface::link -> LayerSurface.link --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index b4d91b6..004da40 100644 --- a/dwl.c +++ b/dwl.c @@ -188,7 +188,7 @@ struct Monitor { struct wlr_session_lock_surface_v1 *lock_surface; struct wlr_box m; /* monitor 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]; unsigned int seltags; unsigned int sellt; -- cgit v1.2.3 From 50ea84c5f6beb814faa2a0fc50149e51192bf97b Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 21:49:26 -0600 Subject: remove extra blank line --- dwl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dwl.c b/dwl.c index 004da40..d7db9b5 100644 --- a/dwl.c +++ b/dwl.c @@ -818,7 +818,6 @@ createlayersurface(struct wl_listener *listener, void *data) < ZWLR_LAYER_SHELL_V1_LAYER_TOP ? layers[LyrTop] : scene_layer); l->scene->node.data = l->popups->node.data = l; - wl_list_insert(&l->mon->layers[layer_surface->pending.layer],&l->link); wlr_surface_send_enter(surface, layer_surface->output); -- cgit v1.2.3 From bdbfb45d6687c69a83f2387b278e2ca97ef61a36 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 21:51:24 -0600 Subject: copy layout symbol when matching a MonitorRule --- dwl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c index d7db9b5..d149a22 100644 --- a/dwl.c +++ b/dwl.c @@ -875,13 +875,14 @@ createmon(struct wl_listener *listener, void *data) m->tagset[0] = m->tagset[1] = 1; for (r = monrules; r < END(monrules); r++) { if (!r->name || strstr(wlr_output->name, r->name)) { + m->m.x = r->x; + m->m.y = r->y; m->mfact = r->mfact; m->nmaster = r->nmaster; - wlr_output_state_set_scale(&state, r->scale); m->lt[0] = m->lt[1] = r->lt; + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); + wlr_output_state_set_scale(&state, r->scale); wlr_output_state_set_transform(&state, r->rr); - m->m.x = r->x; - m->m.y = r->y; break; } } @@ -927,7 +928,6 @@ createmon(struct wl_listener *listener, void *data) wlr_output_layout_add_auto(output_layout, wlr_output); else wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y); - strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); } void -- cgit v1.2.3 From e5e2d1c28f816c3f9188ebca77ecf3abcdd89acc Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:04:24 -0600 Subject: use (struct wlr_box){0} to empty the Monitor areas --- dwl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index d149a22..eb30215 100644 --- a/dwl.c +++ b/dwl.c @@ -2554,8 +2554,7 @@ updatemons(struct wl_listener *listener, void *data) /* Remove this output from the layout to avoid cursor enter inside it */ wlr_output_layout_remove(output_layout, m->wlr_output); closemon(m); - memset(&m->m, 0, sizeof(m->m)); - memset(&m->w, 0, sizeof(m->w)); + m->m = m->w = (struct wlr_box){0}; } /* Insert outputs that need to */ wl_list_for_each(m, &mons, link) -- cgit v1.2.3 From 6a151677540b858f90a891b2a0f616ea1abb2427 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:15:42 -0600 Subject: add a blank line to improve readability --- dwl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dwl.c b/dwl.c index eb30215..0fc0f72 100644 --- a/dwl.c +++ b/dwl.c @@ -2561,6 +2561,7 @@ updatemons(struct wl_listener *listener, void *data) if (m->wlr_output->enabled && !wlr_output_layout_get(output_layout, m->wlr_output)) wlr_output_layout_add_auto(output_layout, m->wlr_output); + /* Now that we update the output layout we can get its box */ wlr_output_layout_get_box(output_layout, NULL, &sgeom); -- cgit v1.2.3 From 9694477b2ffe84a83207c16b805eccf0a9f6aa34 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:16:13 -0600 Subject: relax a bit the line length limit --- dwl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 0fc0f72..007d4d6 100644 --- a/dwl.c +++ b/dwl.c @@ -2585,8 +2585,7 @@ updatemons(struct wl_listener *listener, void *data) if (m->lock_surface) { struct wlr_scene_tree *scene_tree = m->lock_surface->surface->data; wlr_scene_node_set_position(&scene_tree->node, m->m.x, m->m.y); - wlr_session_lock_surface_v1_configure(m->lock_surface, m->m.width, - m->m.height); + wlr_session_lock_surface_v1_configure(m->lock_surface, m->m.width, m->m.height); } /* Calculate the effective monitor geometry to use for clients */ -- cgit v1.2.3 From e7e84b10837424ea6d969afa239944ea53d16b14 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:17:48 -0600 Subject: add explanation about why we try to re-apply the gamma LUT on output changes --- dwl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dwl.c b/dwl.c index 007d4d6..d8969ba 100644 --- a/dwl.c +++ b/dwl.c @@ -2596,6 +2596,8 @@ updatemons(struct wl_listener *listener, void *data) if ((c = focustop(m)) && c->isfullscreen) resize(c, m->m, 0); + /* Try to re-set the gamma LUT when updating monitors, + * it's only really needed when enabling a disabled output, but meh. */ m->gamma_lut_changed = 1; config_head->state.enabled = 1; config_head->state.mode = m->wlr_output->current_mode; -- cgit v1.2.3 From e03896b4d61ae99eec16f3ed0408d5499c0494b4 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:18:49 -0600 Subject: avoid duplication of lines the output state is copied when creating a output configuration head --- dwl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index d8969ba..3148072 100644 --- a/dwl.c +++ b/dwl.c @@ -2599,8 +2599,7 @@ updatemons(struct wl_listener *listener, void *data) /* Try to re-set the gamma LUT when updating monitors, * it's only really needed when enabling a disabled output, but meh. */ m->gamma_lut_changed = 1; - config_head->state.enabled = 1; - config_head->state.mode = m->wlr_output->current_mode; + config_head->state.x = m->m.x; config_head->state.y = m->m.y; } -- cgit v1.2.3 From f5d839844d1c1f9369ca55e058e91161da6929f7 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:37:00 -0600 Subject: remove an unneeded cast in createpointer() --- dwl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 3148072..9219af5 100644 --- a/dwl.c +++ b/dwl.c @@ -982,8 +982,7 @@ void createpointer(struct wlr_pointer *pointer) { if (wlr_input_device_is_libinput(&pointer->base)) { - struct libinput_device *libinput_device = (struct libinput_device*) - wlr_libinput_get_device_handle(&pointer->base); + struct libinput_device *libinput_device = wlr_libinput_get_device_handle(&pointer->base); if (libinput_device_config_tap_get_finger_count(libinput_device)) { libinput_device_config_tap_set_enabled(libinput_device, tap_to_click); -- cgit v1.2.3 From 79c51a45841a15be9c65fd01b34b2a23e48eb423 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:37:35 -0600 Subject: use the same style for urgent() and sethints() --- dwl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c index 9219af5..ecb8a4b 100644 --- a/dwl.c +++ b/dwl.c @@ -2642,10 +2642,11 @@ urgent(struct wl_listener *listener, void *data) if (!c || c == focustop(selmon)) return; - if (client_surface(c)->mapped) - client_set_border_color(c, urgentcolor); c->isurgent = 1; printstatus(); + + if (client_surface(c)->mapped) + client_set_border_color(c, urgentcolor); } void @@ -2825,11 +2826,10 @@ sethints(struct wl_listener *listener, void *data) return; c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); + printstatus(); if (c->isurgent && surface && surface->mapped) client_set_border_color(c, urgentcolor); - - printstatus(); } void -- cgit v1.2.3 From 1884a076460797b42d4670cb62bacd3871740c59 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Thu, 7 Dec 2023 22:40:59 -0600 Subject: sort LISTEN calls in createnotify{,x11} --- dwl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c index ecb8a4b..6aa2cf3 100644 --- a/dwl.c +++ b/dwl.c @@ -967,15 +967,15 @@ createnotify(struct wl_listener *listener, void *data) wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel, WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); + LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify); LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify); LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify); LISTEN(&xdg_surface->surface->events.unmap, &c->unmap, unmapnotify); - LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify); - LISTEN(&xdg_surface->toplevel->events.set_title, &c->set_title, updatetitle); LISTEN(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen, fullscreennotify); LISTEN(&xdg_surface->toplevel->events.request_maximize, &c->maximize, maximizenotify); + LISTEN(&xdg_surface->toplevel->events.set_title, &c->set_title, updatetitle); } void @@ -2787,13 +2787,13 @@ createnotifyx11(struct wl_listener *listener, void *data) /* Listen to the various events it can emit */ LISTEN(&xsurface->events.associate, &c->associate, associatex11); + LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify); LISTEN(&xsurface->events.dissociate, &c->dissociate, dissociatex11); LISTEN(&xsurface->events.request_activate, &c->activate, activatex11); LISTEN(&xsurface->events.request_configure, &c->configure, configurex11); + LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify); LISTEN(&xsurface->events.set_hints, &c->set_hints, sethints); LISTEN(&xsurface->events.set_title, &c->set_title, updatetitle); - LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify); - LISTEN(&xsurface->events.request_fullscreen, &c->fullscreen, fullscreennotify); } void -- cgit v1.2.3