~ruther/guix-config

533da78a46862b2d0620c6b2fbee11558f04345c — Rutherther 9 days ago db663d5
feat(dwl): autostart apps and pin them to tags via custom rules
M home/modules/ruther/home/dwl/config.h => home/modules/ruther/home/dwl/config.h +46 -0
@@ 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;
}

M home/modules/ruther/home/dwl/scripts.scm => home/modules/ruther/home/dwl/scripts.scm +6 -1
@@ 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

M home/modules/ruther/home/dwl/wm.scm => home/modules/ruther/home/dwl/wm.scm +2 -2
@@ 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)