From 533da78a46862b2d0620c6b2fbee11558f04345c Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 12 Sep 2026 18:55:41 +0200 Subject: [PATCH] feat(dwl): autostart apps and pin them to tags via custom rules --- home/modules/ruther/home/dwl/config.h | 46 ++++++++++++++++++++++++ home/modules/ruther/home/dwl/scripts.scm | 7 +++- home/modules/ruther/home/dwl/wm.scm | 4 +-- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/home/modules/ruther/home/dwl/config.h b/home/modules/ruther/home/dwl/config.h index f06c9ba23504acd4b072e15e176439369a9921af..557a0ff8e8460ff7d175cc0ed6ffd8706460a1b0 100644 --- a/home/modules/ruther/home/dwl/config.h +++ b/home/modules/ruther/home/dwl/config.h @@ -287,3 +287,49 @@ static const Button buttons[] = { { MODKEY, BTN_MIDDLE, togglefloating, {0} }, { MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, }; + +bool applycustomrules(const char *appid, const char *title, Rule *r) +{ + static int opened_librewolf = 0; // appid librewolf + static int opened_firefox = 0; // appid Firefox + static int opened_vesktop = 0; // appid vesktop + static int opened_element = 0; // appid Element + + if (strstr(appid, "librewolf")) { + if (opened_librewolf < 4) { + r->tags = 1 << (opened_librewolf / 2); + r->allow_activation = 1; + opened_librewolf++; + return true; + } + } + + if (strstr(appid, "Firefox")) { + if (opened_firefox < 2) { + r->tags = 1 << 7; + r->allow_activation = 1; + opened_firefox++; + return true; + } + } + + if (strstr(appid, "Element")) { + if (opened_element < 2) { + r->tags = 1 << 8; + r->allow_activation = 1; + opened_element++; + return true; + } + } + + if (strstr(appid, "vesktop")) { + if (opened_vesktop < 2) { + r->tags = 1 << 8; + r->allow_activation = 1; + opened_vesktop++; + return true; + } + } + + return false; +} diff --git a/home/modules/ruther/home/dwl/scripts.scm b/home/modules/ruther/home/dwl/scripts.scm index 1657ddb36c74d1842096969385dfa3a63884b69a..077b526ff89f0d04b6e5457fb8ed0189d50104e1 100644 --- a/home/modules/ruther/home/dwl/scripts.scm +++ b/home/modules/ruther/home/dwl/scripts.scm @@ -76,7 +76,12 @@ "start" "wlr-services" (getenv "WAYLAND_DISPLAY") - (getenv "DISPLAY")))) + (getenv "DISPLAY")) + + (system "librewolf &") + (system "firefox &") + (system "element-desktop &") + (system "dev.vencord.Vesktop &"))) (define (start-dwl-gexp dwl waybar) #~(begin diff --git a/home/modules/ruther/home/dwl/wm.scm b/home/modules/ruther/home/dwl/wm.scm index 20fbf0000affb9de54f23227c24994ffaddfa7b4..bbfeb58e77cbbb3dafd15b6cf82f5b8ca20b9c3f 100644 --- a/home/modules/ruther/home/dwl/wm.scm +++ b/home/modules/ruther/home/dwl/wm.scm @@ -120,10 +120,10 @@ (method git-fetch) (uri (git-reference (url "https://git.ditigal.xyz/~ruther/dwl") - (commit "2daeeb4ffd1b7b382b80976a14f0ae5f23b920b9"))) + (commit "c5333e44d94f9d3cf439ac7e257d64f3f3014cfb"))) (file-name (git-file-name name "0.8-dev")) (sha256 - (base32 "1r5k6vzmgwwlwd3giym1fy3y633i770a838fbzrc41afnbwrzz8s")))) + (base32 "1cbhan45jznpgwgrn9xab5605i8l4ldrlswwrj5a5pg7w4a1y2cv")))) (inputs (modify-inputs (package-inputs base) (append foot)