diff options
author | dianshi <dianshi@main.lv> | 2020-04-05 14:01:19 +0100 |
---|---|---|
committer | dianshi <dianshi@main.lv> | 2020-04-05 14:01:19 +0100 |
commit | bfe0aa75a6d08ee98883418eb367b19581ea9e75 (patch) | |
tree | 25d54964ad4025b8aa01bcc8b9ff3e4fbdcecb8f | |
parent | 0bdae45f078d9f77c651a83ebbda95aaa43b09db (diff) | |
download | dwm-pixel-bfe0aa75a6d08ee98883418eb367b19581ea9e75.tar.gz dwm-pixel-bfe0aa75a6d08ee98883418eb367b19581ea9e75.zip |
Added alternativetag patch
-rw-r--r-- | Kconfig | 4 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | config.h | 6 | ||||
-rw-r--r-- | dwm.c | 39 | ||||
-rw-r--r-- | kconfig.h | 1 |
6 files changed, 55 insertions, 2 deletions
@@ -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 @@ -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) @@ -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 @@ -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) @@ -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 @@ -3,4 +3,5 @@ #define CONFIG_DEBUG #define CONFIG_DEBUG_PRINT_DEBUG #define CONFIG_DWM_PERTAG +#define CONFIG_DWM_ALTERNATIVETAGS #endif |