Skip to content

Commit ea914c3

Browse files
committed
MOD+SHIFT+T : tile all terminals in temporary tag
1 parent 465fe27 commit ea914c3

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

config.def.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
/* Status line max width: */
77
#define CONFIG_STATUS_W 50
88

9+
/* Pattern to match terminals: */
10+
#error "verify TERM_PATT :)"
11+
#define TERM_PATT "lew@T430:"
12+
913
/* appearance */
1014
static const unsigned int borderpx = 1; /* border pixel of windows */
1115
static const unsigned int snap = 32; /* snap pixel */
@@ -25,7 +29,8 @@ static const char *colors[][3] = {
2529
};
2630

2731
/* tagging */
28-
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
32+
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "tmp" };
33+
#define TMPTAG 9
2934

3035
static const Rule rules[] = {
3136
/* xprop(1):
@@ -99,6 +104,7 @@ static Key keys[] = {
99104
{ MODKEY, XK_period, focusmon, {.i = +1 } },
100105
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
101106
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
107+
{ MODKEY|ShiftMask, XK_t, gather, {.s = TERM_PATT}},
102108
TAGKEYS( XK_1, 0)
103109
TAGKEYS( XK_2, 1)
104110
TAGKEYS( XK_3, 2)

dwm.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ static void seturgent(Client *c, int urg);
211211
static void showhide(Client *c);
212212
static void sigchld(int unused);
213213
static void spawn(const Arg *arg);
214+
static void gather(const Arg *arg);
214215

215216
static void ignore(const Arg *arg) {}
216217

@@ -729,7 +730,7 @@ drawbar(Monitor *m)
729730
urg |= c->tags;
730731
}
731732
x = 0;
732-
for (i = 0; i < LENGTH(tags); i++) {
733+
for (i = 0; i < TMPTAG; i++) {
733734
w = TEXTW(tags[i]);
734735
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
735736
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
@@ -1779,6 +1780,19 @@ spawn(const Arg *arg)
17791780
}
17801781
}
17811782

1783+
void
1784+
gather(const Arg* arg) {
1785+
for(Client *c = selmon->clients; c; c = c->next) {
1786+
if(strstr(c->name,arg->s))
1787+
c->tags |= 1 << TMPTAG;
1788+
else
1789+
c->tags &= ~(1<<TMPTAG);
1790+
}
1791+
1792+
view(&(const Arg){.ui = 1 << TMPTAG});
1793+
setlayout(&(const Arg){.v = &layouts[0]});
1794+
}
1795+
17821796
void
17831797
keymap(const Arg *arg)
17841798
{

0 commit comments

Comments
 (0)