Skip to content
This repository was archived by the owner on Feb 24, 2021. It is now read-only.

Commit 130c9e7

Browse files
committed
Added 'tagall' functionality
1 parent 3eb5241 commit 130c9e7

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ This build contains the following patches:
77
* [tab](https://dwm.suckless.org/patches/tab/)
88
* [tcl](https://dwm.suckless.org/patches/three-column/)
99
* [gaplessgrid](https://dwm.suckless.org/patches/gaplessgrid/)
10+
* [tagall](https://dwm.suckless.org/patches/tagall/)
1011

1112
Including some changes in the config file.

config.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ static const Rule rules[] = {
3232
};
3333

3434
/* layout(s) */
35+
#include "tcl.c"
36+
#include "gaplessgrid.c"
37+
3538
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
3639
static const int nmaster = 1; /* number of clients in master area */
3740
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
3841

39-
#include "tcl.c"
40-
#include "gaplessgrid.c"
41-
4242
static const Layout layouts[] = {
4343
/* symbol arrange function */
4444
{ "[]=", tile }, /* first entry is default */
@@ -72,6 +72,7 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont,
7272
static const char *termcmd[] = { "st", NULL };
7373

7474
#include <X11/XF86keysym.h>
75+
#include "tagall.c"
7576

7677
static Key keys[] = {
7778
/* modifier key function argument */
@@ -112,6 +113,16 @@ static Key keys[] = {
112113
TAGKEYS( XK_9, 8)
113114
{ MODKEY|ShiftMask, XK_q, quit, {0} },
114115

116+
{ MODKEY|ShiftMask, XK_F1, tagall, {.v = "1"} },
117+
{ MODKEY|ShiftMask, XK_F2, tagall, {.v = "2"} },
118+
{ MODKEY|ShiftMask, XK_F3, tagall, {.v = "3"} },
119+
{ MODKEY|ShiftMask, XK_F4, tagall, {.v = "4"} },
120+
{ MODKEY|ShiftMask, XK_F5, tagall, {.v = "5"} },
121+
{ MODKEY|ShiftMask, XK_F6, tagall, {.v = "6"} },
122+
{ MODKEY|ShiftMask, XK_F7, tagall, {.v = "7"} },
123+
{ MODKEY|ShiftMask, XK_F8, tagall, {.v = "8"} },
124+
{ MODKEY|ShiftMask, XK_F9, tagall, {.v = "9"} },
125+
115126
{ 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Master toggle")},
116127
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer sset Master 5%+")},
117128
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer sset Master 5%-")},

tagall.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
void
2+
tagall(const Arg *arg) {
3+
if (!selmon->clients)
4+
return;
5+
/* if parameter starts with F, just move floating windows */
6+
int floating_only = (char *)arg->v && ((char *)arg->v)[0] == 'F' ? 1 : 0;
7+
int tag = (char *)arg->v ? atoi(((char *)arg->v) + floating_only) : 0;
8+
int j;
9+
Client* c;
10+
if(tag >= 0 && tag < LENGTH(tags))
11+
for(c = selmon->clients; c; c = c->next)
12+
{
13+
if(!floating_only || c->isfloating)
14+
for(j = 0; j < LENGTH(tags); j++)
15+
{
16+
if(c->tags & 1 << j && selmon->tagset[selmon->seltags] & 1 << j)
17+
{
18+
c->tags = c->tags ^ (1 << j & TAGMASK);
19+
c->tags = c->tags | 1 << (tag-1);
20+
}
21+
}
22+
}
23+
arrange(selmon);
24+
}

0 commit comments

Comments
 (0)