Skip to content

Commit ba6a58a

Browse files
committed
Icons
1 parent 6d9401c commit ba6a58a

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

config.def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static const char *colors[][3] = {
2121

2222
/* tagging */
2323
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
24+
static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
2425

2526
static const Rule rules[] = {
2627
/* xprop(1):
@@ -95,6 +96,7 @@ static Key keys[] = {
9596
{ MODKEY, XK_period, focusmon, {.i = +1 } },
9697
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
9798
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
99+
{ MODKEY, XK_n, togglealttag, {0} },
98100
TAGKEYS( XK_1, 0)
99101
TAGKEYS( XK_2, 1)
100102
TAGKEYS( XK_3, 2)

config.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ static const char *colors[][3] = {
2020
};
2121

2222
/* tagging */
23-
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
23+
static const char *tags[] = { "爵 Web", " Vim", "ﭮ Discord", " SSH", " Bitwarden", " Docs", " Games", "8: Desktop", " Settings" };
24+
static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
2425

2526
static const Rule rules[] = {
2627
/* xprop(1):
@@ -137,6 +138,8 @@ static Key keys[] = {
137138
/* { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, */
138139

139140
/* tags */
141+
142+
{ MODKEY, XK_b, togglealttag, {0} },
140143
TAGKEYS( XK_1, 0)
141144
TAGKEYS( XK_2, 1)
142145
TAGKEYS( XK_3, 2)

dwm.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ struct Monitor {
136136
Window barwin;
137137
Window extrabarwin;
138138
const Layout *lt[2];
139+
unsigned int alttag;
139140
};
140141

141142
typedef struct {
@@ -219,6 +220,7 @@ static void spawn(const Arg *arg);
219220
static void tag(const Arg *arg);
220221
static void tagmon(const Arg *arg);
221222
static void tile(Monitor *);
223+
static void togglealttag();
222224
static void togglebar(const Arg *arg);
223225
static void togglefloating(const Arg *arg);
224226
static void togglefullscr(const Arg *arg);
@@ -773,7 +775,7 @@ dirtomon(int dir)
773775
void
774776
drawbar(Monitor *m)
775777
{
776-
int x, w, sw = 0;
778+
int x, w, wdelta, sw = 0;
777779
int boxs = drw->fonts->h / 9;
778780
int boxw = drw->fonts->h / 6 + 2;
779781
unsigned int i, occ = 0, urg = 0;
@@ -797,8 +799,9 @@ drawbar(Monitor *m)
797799
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
798800
continue;
799801
w = TEXTW(tags[i]);
802+
wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
800803
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
801-
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
804+
drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), urg & 1 << i);
802805
x += w;
803806
}
804807
w = blw = TEXTW(m->ltsymbol);
@@ -1797,6 +1800,13 @@ tile(Monitor *m)
17971800
}
17981801
}
17991802

1803+
void
1804+
togglealttag()
1805+
{
1806+
selmon->alttag = !selmon->alttag;
1807+
drawbar(selmon);
1808+
}
1809+
18001810
void
18011811
togglebar(const Arg *arg)
18021812
{

0 commit comments

Comments
 (0)