aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordianshi <dianshi@main.lv>2020-04-05 14:01:19 +0100
committerdianshi <dianshi@main.lv>2020-04-05 14:01:19 +0100
commitbfe0aa75a6d08ee98883418eb367b19581ea9e75 (patch)
tree25d54964ad4025b8aa01bcc8b9ff3e4fbdcecb8f
parent0bdae45f078d9f77c651a83ebbda95aaa43b09db (diff)
downloaddwm-pixel-bfe0aa75a6d08ee98883418eb367b19581ea9e75.tar.gz
dwm-pixel-bfe0aa75a6d08ee98883418eb367b19581ea9e75.zip
Added alternativetag patch
-rw-r--r--Kconfig4
-rw-r--r--Makefile4
-rw-r--r--README.md3
-rw-r--r--config.h6
-rw-r--r--dwm.c39
-rw-r--r--kconfig.h1
6 files changed, 55 insertions, 2 deletions
diff --git a/Kconfig b/Kconfig
index 333c91c..5e643a2 100644
--- a/Kconfig
+++ b/Kconfig
@@ -3,3 +3,7 @@ source "debug/Kconfig"
config DWM_PERTAG
bool "One layout pertag"
default n
+
+config DWM_ALTERNATIVETAGS
+ bool "Alternative names for tags"
+ default n
diff --git a/Makefile b/Makefile
index e091f8e..67cac41 100644
--- a/Makefile
+++ b/Makefile
@@ -19,12 +19,14 @@ VERSION = 6.2
SRC = dwm.c drw.c util.c
OBJ = ${SRC:.c=.o}
+
.c.o:
@echo CC $<
echo $(CFLAGS)
echo $(LDFLAGS)
${CC} ${CFLAGS} -c $<
-
+
+
dwm: ${OBJ}
@echo CC -o $@
echo $(CFLAGS)
diff --git a/README.md b/README.md
index ee3eb8f..62ab92a 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,8 @@
## Interesting patches
-systray - systemtray
+systray - systemtray add icons for skype and shitz
status2d - Status2d allows colors and rectangle drawing in your DWM status bar
pertag - saves layout per tag
+alternativetags - change names to other then 1,2,3,4
diff --git a/config.h b/config.h
index 1c0b587..5398aec 100644
--- a/config.h
+++ b/config.h
@@ -20,6 +20,9 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+static const char *tagsalt[] = { "W", "工", "", "✠", "☠", "✡", "☪︎", "☭", "ﴔ" };
+#endif
static const Rule rules[] = {
/* xprop(1):
@@ -84,6 +87,9 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+ { MODKEY, XK_n, togglealttag, {0} },
+#endif
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
diff --git a/dwm.c b/dwm.c
index b353b8e..2ce630f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -143,6 +143,9 @@ struct Monitor {
#ifdef CONFIG_DWM_PERTAG
Pertag *pertag;
#endif
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+ unsigned int alttag;
+#endif
/******************************************************************************/
};
@@ -250,6 +253,12 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
+/******************************************************************************/
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+static void togglealttag();
+#endif
+/******************************************************************************/
+
/* variables */
static const char broken[] = "broken";
static char stext[256];
@@ -765,6 +774,12 @@ drawbar(Monitor *m)
unsigned int i, occ = 0, urg = 0;
Client *c;
+/******************************************************************************/
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+ int wdelta=0;
+#endif
+/******************************************************************************/
+
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
@@ -778,6 +793,20 @@ drawbar(Monitor *m)
urg |= c->tags;
}
x = 0;
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+ 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,
+ urg & 1 << i);
+ x += w;
+ }
+#else
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
@@ -788,6 +817,7 @@ drawbar(Monitor *m)
urg & 1 << i);
x += w;
}
+#endif
w = blw = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
@@ -2303,3 +2333,12 @@ main(int argc, char *argv[])
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}
+
+#ifdef CONFIG_DWM_ALTERNATIVETAGS
+void
+togglealttag()
+{
+ selmon->alttag = !selmon->alttag;
+ drawbar(selmon);
+}
+#endif
diff --git a/kconfig.h b/kconfig.h
index 63a2fd1..4d487fc 100644
--- a/kconfig.h
+++ b/kconfig.h
@@ -3,4 +3,5 @@
#define CONFIG_DEBUG
#define CONFIG_DEBUG_PRINT_DEBUG
#define CONFIG_DWM_PERTAG
+#define CONFIG_DWM_ALTERNATIVETAGS
#endif