[wiki] [sites] [dwm][patches][tagspawn] added tagspawn patch || Sage Raflik

From: <git_AT_suckless.org>
Date: Sun, 12 Dec 2021 07:59:13 +0100

commit 77782f385265365b01133aca0128d100801b3f83
Author: Sage Raflik <neonfuz_AT_gmail.com>
Date: Sun Dec 12 00:58:17 2021 -0600

    [dwm][patches][tagspawn] added tagspawn patch

diff --git a/dwm.suckless.org/patches/tagspawn/dwm-tagspawn-6.2.diff b/dwm.suckless.org/patches/tagspawn/dwm-tagspawn-6.2.diff
new file mode 100644
index 00000000..21c5e295
--- /dev/null
+++ b/dwm.suckless.org/patches/tagspawn/dwm-tagspawn-6.2.diff
_AT_@ -0,0 +1,64 @@
+From 62b79d4c032556794b82305a03606f752c096d8b Mon Sep 17 00:00:00 2001
+From: Sage Raflik <neonfuz_AT_gmail.com>
+Date: Sat, 11 Dec 2021 22:58:03 -0600
+Subject: [PATCH] tagspawn
+
+---
+ config.def.h | 6 ++++++
+ dwm.c | 12 ++++++++++++
+ 2 files changed, 18 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..f727668 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -59,10 +59,16 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+ static const char *termcmd[] = { "st", NULL };
+
++/* per tag commands for tagspawn function */
++static const char ** const tagcommands[LENGTH(tags)] = {
++ [0] = termcmd, /* first tag */
++};
++
+ static Key keys[] = {
+ /* modifier key function argument */
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
++ { MODKEY|CtrlMask, XK_Return, tagspawn, {0} },
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+diff --git a/dwm.c b/dwm.c
+index 4465af1..b70cc67 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -206,6 +206,7 @@ static void seturgent(Client *c, int urg);
+ static void showhide(Client *c);
+ static void sigchld(int unused);
+ static void spawn(const Arg *arg);
++static void tagspawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+_AT_@ -1652,6 +1653,17 @@ spawn(const Arg *arg)
+ }
+ }
+
++void
++tagspawn(const Arg *arg)
++{
++ for (int i=0; i<LENGTH(tags); ++i) {
++ if (selmon->tagset[selmon->seltags] & (1<<i)) {
++ const Arg a = {.v = tagcommands[i]};
++ spawn(&a);
++ }
++ }
++}
++
+ void
+ tag(const Arg *arg)
+ {
+--
+2.33.1
+
diff --git a/dwm.suckless.org/patches/tagspawn/index.md b/dwm.suckless.org/patches/tagspawn/index.md
new file mode 100644
index 00000000..3d54f67c
--- /dev/null
+++ b/dwm.suckless.org/patches/tagspawn/index.md
_AT_@ -0,0 +1,29 @@
+tagspawn
+========
+
+Description
+-----------
+This patch allows you to define an array of commands corresponding to your tags
+which can be spawned
+
+It is similar to the default\_tag\_apps patch, but is different (better?) in a few ways:
+* tagspawn lets you define commands with multiple arguments, as its command
+ format is the same as the spawn function
+* if multiple tags are selected, tagspawn will run each corresponding command,
+ while default\_tag\_apps will only execute the command corresponding to the
+ most recently selected tag
+
+Usage
+-----
+* Merge patch
+* If not starting fresh remember to merge changes from config.def.h to config.h
+* Update tagcommands array in config.h to include your commands
+* If desired change keybinding for tagspawn command. Default is mod+ctrl+return
+
+Download
+--------
+* [dwm-tagspawn-6.2.diff](dwm-tagspawn-6.2.diff) (dwm 6.2)
+
+Authors
+-------
+* Sage Raflik - neonfuz_AT_gmail.com
Received on Sun Dec 12 2021 - 07:59:13 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 12 2021 - 08:00:47 CET