dwm-tagspawn-6.2.diff - sites - public wiki contents of suckless.org
HTML git clone git://git.suckless.org/sites
DIR Log
DIR Files
DIR Refs
---
dwm-tagspawn-6.2.diff (2058B)
---
1 From 62b79d4c032556794b82305a03606f752c096d8b Mon Sep 17 00:00:00 2001
2 From: Sage Raflik <neonfuz@gmail.com>
3 Date: Sat, 11 Dec 2021 22:58:03 -0600
4 Subject: [PATCH] tagspawn
5
6 ---
7 config.def.h | 6 ++++++
8 dwm.c | 12 ++++++++++++
9 2 files changed, 18 insertions(+)
10
11 diff --git a/config.def.h b/config.def.h
12 index 1c0b587..f727668 100644
13 --- a/config.def.h
14 +++ b/config.def.h
15 @@ -59,10 +59,16 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
16 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
17 static const char *termcmd[] = { "st", NULL };
18
19 +/* per tag commands for tagspawn function */
20 +static const char ** const tagcommands[LENGTH(tags)] = {
21 + [0] = termcmd, /* first tag */
22 +};
23 +
24 static Key keys[] = {
25 /* modifier key function argument */
26 { MODKEY, XK_p, spawn, {.v = dmenucmd } },
27 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
28 + { MODKEY|CtrlMask, XK_Return, tagspawn, {0} },
29 { MODKEY, XK_b, togglebar, {0} },
30 { MODKEY, XK_j, focusstack, {.i = +1 } },
31 { MODKEY, XK_k, focusstack, {.i = -1 } },
32 diff --git a/dwm.c b/dwm.c
33 index 4465af1..b70cc67 100644
34 --- a/dwm.c
35 +++ b/dwm.c
36 @@ -206,6 +206,7 @@ static void seturgent(Client *c, int urg);
37 static void showhide(Client *c);
38 static void sigchld(int unused);
39 static void spawn(const Arg *arg);
40 +static void tagspawn(const Arg *arg);
41 static void tag(const Arg *arg);
42 static void tagmon(const Arg *arg);
43 static void tile(Monitor *);
44 @@ -1652,6 +1653,17 @@ spawn(const Arg *arg)
45 }
46 }
47
48 +void
49 +tagspawn(const Arg *arg)
50 +{
51 + for (int i=0; i<LENGTH(tags); ++i) {
52 + if (selmon->tagset[selmon->seltags] & (1<<i)) {
53 + const Arg a = {.v = tagcommands[i]};
54 + spawn(&a);
55 + }
56 + }
57 +}
58 +
59 void
60 tag(const Arg *arg)
61 {
62 --
63 2.33.1
64