commit 01f63061feeee05af1036c0a613dab3d609216cc
parent e14f1fcc5ccea0e7b249aac271d83dd98bb3312b
Author: mpizzzle <m@michaelpercival.xyz>
Date: Thu, 17 Sep 2020 11:00:26 +0100
patched dwm-alternativetags-6.2 for no reason
Diffstat:
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -34,6 +34,7 @@ static const unsigned int alphas[][3] = {
/* tagging */
static const char *tags[] = { "一", "二", "三", "四", "五", "六", "七", "八", "九" };
+static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* xprop(1):
@@ -124,6 +125,7 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
+ { MODKEY, XK_n, togglealttag, {0} },
{ MODKEY|ShiftMask, XK_l, spawn, SHCMD("lock.sh &") },
{ MODKEY, XK_Print, spawn, SHCMD("scrot") },
TAGKEYS( XK_1, 0)
diff --git a/dwm.c b/dwm.c
@@ -136,6 +136,7 @@ struct Monitor {
Monitor *next;
Window barwin;
const Layout *lt[2];
+ unsigned int alttag;
};
typedef struct {
@@ -230,6 +231,7 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *);
+static void togglealttag();
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -742,7 +744,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int x, w, tw = 0;
+ int x, w, wdelta, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -763,8 +765,9 @@ drawbar(Monitor *m)
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
+ wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
+ drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
@@ -1916,6 +1919,13 @@ tile(Monitor *m)
}
void
+togglealttag()
+{
+ selmon->alttag = !selmon->alttag;
+ drawbar(selmon);
+}
+
+void
togglebar(const Arg *arg)
{
selmon->showbar = !selmon->showbar;