sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit b2ac2894f70daac7c25de0c7e0ccc68806b8def9
parent 83457733a101da51a9fac8b321d5664d3810275a
Author: Piyush Pangtey <gokuvsvegita@gmail.com>
Date:   Mon, 31 May 2021 05:41:46 +0000

[dwm][spawntag] Add spawntag patch

Diffstat:
Adwm.suckless.org/patches/spawntag/dwm-spawntag-6.2.diff | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/spawntag/index.md | 31+++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/spawntag/dwm-spawntag-6.2.diff b/dwm.suckless.org/patches/spawntag/dwm-spawntag-6.2.diff @@ -0,0 +1,85 @@ +From abace8a090f579a9bd2513e78e0ebe9d9fa1e0bb Mon Sep 17 00:00:00 2001 +From: Piyush Pangtey <gokuvsvegita@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 +@@ -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 } }, +@@ -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 +@@ -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); +@@ -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 @@ -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@gmail.com>