From b0c17bbe25e022e3de907c7361e9d9883cd78ffd Mon Sep 17 00:00:00 2001 From: Mouad Alami Date: Tue, 12 Sep 2023 15:36:03 +0100 Subject: added alternative tags patch --- config.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config.h') diff --git a/config.h b/config.h index afe4ba1..08e4a79 100644 --- a/config.h +++ b/config.h @@ -38,6 +38,8 @@ static const char *dec_bright[] = { /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char *tagsalt[] = { "", "", "", "", "", "", "", "", "" }; +static const int momentaryalttags = 0; /* 1 means alttags will show only when key is held down*/ static const Rule rules[] = { /* xprop(1): @@ -109,6 +111,7 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY, XK_n, togglealttag, {0} }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, {MODKEY, XK_s, togglesticky, {0}}, -- cgit v1.2.3 From ac937caaec7921ff526b32594942ba16bf26159f Mon Sep 17 00:00:00 2001 From: Mouad Alami Date: Tue, 12 Sep 2023 15:42:32 +0100 Subject: added bidirectional patch --- README | 2 +- config.h | 2 +- config.mk | 8 ++++++-- dwm.c | 21 ++++++++++++++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) (limited to 'config.h') diff --git a/README b/README index 5b4a8c2..1f8294f 100644 --- a/README +++ b/README @@ -49,4 +49,4 @@ and (re)compiling the source code. Patches applied --------------- -zoomswap - scratchpad - sticky - statuscmd - pertag - noborder - movestack - hide vacant tags - actualfullscreen - bar height - alpha monocle layout - alternativetags +zoomswap - scratchpad - sticky - statuscmd - pertag - noborder - movestack - hide vacant tags - actualfullscreen - bar height - alpha monocle layout - alternativetags - bidi diff --git a/config.h b/config.h index 08e4a79..6a00f02 100644 --- a/config.h +++ b/config.h @@ -39,7 +39,7 @@ static const char *dec_bright[] = { /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static const char *tagsalt[] = { "", "", "", "", "", "", "", "", "" }; -static const int momentaryalttags = 0; /* 1 means alttags will show only when key is held down*/ +static const int momentaryalttags = 1; /* 1 means alttags will show only when key is held down*/ static const Rule rules[] = { /* xprop(1): diff --git a/config.mk b/config.mk index ba64d3d..64a4fdb 100644 --- a/config.mk +++ b/config.mk @@ -10,6 +10,8 @@ MANPREFIX = ${PREFIX}/share/man X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib +BDINC = /usr/include/fribidi + # Xinerama, comment if you don't want it XINERAMALIBS = -lXinerama XINERAMAFLAGS = -DXINERAMA @@ -21,9 +23,11 @@ FREETYPEINC = /usr/include/freetype2 #FREETYPEINC = ${X11INC}/freetype2 #MANPREFIX = ${PREFIX}/man +BDLIBS = -lfribidi + # includes and libs -INCS = -I${X11INC} -I${FREETYPEINC} -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} +INCS = -I${X11INC} -I${FREETYPEINC} -I$(BDINC) +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} $(BDLIBS) # flags CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} diff --git a/dwm.c b/dwm.c index 8ab1c33..9ff14bd 100644 --- a/dwm.c +++ b/dwm.c @@ -21,6 +21,7 @@ * To understand everything else, start reading main(). */ #include +#include #include #include #include @@ -145,6 +146,7 @@ typedef struct { } Rule; /* function declarations */ +static void apply_fribidi(char *str); static void applyrules(Client *c); static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); static void arrange(Monitor *m); @@ -250,6 +252,7 @@ static void zoom(const Arg *arg); static Client *prevzoom = NULL; static const char broken[] = "broken"; static char stext[256]; +static char fribidi_text[256]; static int statusw; static int statussig; static pid_t statuspid = -1; @@ -303,6 +306,21 @@ static unsigned int scratchtag = 1 << LENGTH(tags); struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; /* function implementations */ +void +apply_fribidi(char *str) +{ + FriBidiStrIndex len = strlen(str); + FriBidiChar logical[256]; + FriBidiChar visual[256]; + FriBidiParType base = FRIBIDI_PAR_ON; + FriBidiCharSet charset; + + charset = fribidi_parse_charset("UTF-8"); + len = fribidi_charset_to_unicode(charset, str, len, logical); + fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL); + fribidi_unicode_to_charset(charset, visual, len, fribidi_text); +} + void applyrules(Client *c) { @@ -820,7 +838,8 @@ drawbar(Monitor *m) if ((w = m->ww - tw - x) > bh) { if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + apply_fribidi(m->sel->name); + drw_text(drw, x, 0, w, bh, lrpad / 2, fribidi_text, 0); if (m->sel->isfloating) drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); } else { -- cgit v1.2.3