[wiki] [sites] [dwm][spawntag] Add spawntag patch || Piyush Pangtey
commit b2ac2894f70daac7c25de0c7e0ccc68806b8def9
Author: Piyush Pangtey <gokuvsvegita_AT_gmail.com>
Date: Mon May 31 05:41:46 2021 +0000
[dwm][spawntag] Add spawntag patch
diff --git a/dwm.suckless.org/patches/spawntag/dwm-spawntag-6.2.diff b/dwm.suckless.org/patches/spawntag/dwm-spawntag-6.2.diff
new file mode 100644
index 00000000..8566adeb
--- /dev/null
+++ b/dwm.suckless.org/patches/spawntag/dwm-spawntag-6.2.diff
_AT_@ -0,0 +1,85 @@
+From abace8a090f579a9bd2513e78e0ebe9d9fa1e0bb Mon Sep 17 00:00:00 2001
+From: Piyush Pangtey <gokuvsvegita_AT_gmail.com>
+Date: Wed, 19 May 2021 19:27:34 +0530
+Subject: [PATCH] [Feature] spawntag
+
+spawn application whenever a tag is middle clicked
+---
+ config.def.h | 16 ++++++++++++++++
+ dwm.c | 14 ++++++++++++++
+ 2 files changed, 30 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..442b556 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -54,11 +54,26 @@ static const Layout layouts[] = {
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+
++/* helper for launching gtk application */
++#define GTKCMD(cmd) { .v = (const char*[]){ "/usr/bin/gtk-launch", cmd, NULL } }
++
+ /* commands */
+ 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 };
+
++static const Arg tagexec[] = {
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd },
++ { .v = termcmd }
++};
++
+ static Key keys[] = {
+ /* modifier key function argument */
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+_AT_@ -108,6 +123,7 @@ static Button buttons[] = {
+ { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
+ { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkTagBar, 0, Button1, view, {0} },
++ { ClkTagBar, 0, Button2, spawntag, {0} },
+ { ClkTagBar, 0, Button3, toggleview, {0} },
+ { ClkTagBar, MODKEY, Button1, tag, {0} },
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
+diff --git a/dwm.c b/dwm.c
+index 4465af1..89b3220 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -207,6 +207,7 @@ static void showhide(Client *c);
+ static void sigchld(int unused);
+ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
++static void spawntag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
+_AT_@ -1662,6 +1663,19 @@ tag(const Arg *arg)
+ }
+ }
+
++void
++spawntag(const Arg *arg)
++{
++ if (arg->ui & TAGMASK) {
++ for (int i = LENGTH(tags); i >= 0; i--) {
++ if (arg->ui & 1<<i) {
++ spawn(&tagexec[i]);
++ return;
++ }
++ }
++ }
++}
++
+ void
+ tagmon(const Arg *arg)
+ {
+--
+2.31.1
+
diff --git a/dwm.suckless.org/patches/spawntag/index.md b/dwm.suckless.org/patches/spawntag/index.md
new file mode 100644
index 00000000..40ea7de7
--- /dev/null
+++ b/dwm.suckless.org/patches/spawntag/index.md
_AT_@ -0,0 +1,31 @@
+spawntag
+========
+
+Description
+-----------
+Spawn application whenever a tag is middle clicked. This patch also include
+`GTKCMD`, helper for launching gtk application.
+
+Example usage:
+
+``
+static const Arg tagexec[] = {
+ { .v = termcmd },
+ GTKCMD("org.gnome.Nautilus"),
+ GTKCMD("visual-studio-code"),
+ SHCMD("lxterminal -t AlsaMixer -e /usr/bin/alsamixer"),
+ GTKCMD("discord"),
+ SHCMD("lxterminal -t Cmus -e /usr/bin/cmus"),
+ { .v = termcmd },
+ GTKCMD("personal-firefox"),
+ GTKCMD("firefox")
+};
+``
+
+Download
+--------
+* [dwm-spawntag-6.2.diff](dwm-spawntag-6.2.diff) (2021-05-19)
+
+Author
+-------
+* Piyush Pangtey <gokuvsvegita_AT_gmail.com>
Received on Mon May 31 2021 - 07:43:42 CEST
This archive was generated by hypermail 2.3.0
: Mon May 31 2021 - 07:48:44 CEST