From ddd9c82891bc14fb8de10a157451c5b8472b75e1 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 7 Aug 2024 16:52:21 -0400 Subject: [PATCH] Implement monchange trigger script --- config.def.h | 3 +++ dwl.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 22d2171..10d3563 100644 --- a/config.def.h +++ b/config.def.h @@ -118,6 +118,9 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } +/* script that runs whenever the monitor configuration changes */ +static const Arg monchange = SHCMD("makewall"); + /* commands */ static const char *termcmd[] = { "foot", NULL }; static const char *menucmd[] = { "wmenu-run", NULL }; diff --git a/dwl.c b/dwl.c index a2711f6..d18bed5 100644 --- a/dwl.c +++ b/dwl.c @@ -752,6 +752,7 @@ closemon(Monitor *m) } focusclient(focustop(selmon), 1); printstatus(); + spawn(&monchange); } void @@ -1044,10 +1045,13 @@ createmon(struct wl_listener *listener, void *data) * output (such as DPI, scale factor, manufacturer, etc). */ m->scene_output = wlr_scene_output_create(scene, wlr_output); - if (m->m.x == -1 && m->m.y == -1) + if (m->m.x == -1 && m->m.y == -1) { wlr_output_layout_add_auto(output_layout, wlr_output); - else + } else { wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y); + } + + spawn(&monchange); } void -- 2.45.2