summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--config.h2
-rw-r--r--config.mk8
-rw-r--r--dwm.c21
4 files changed, 28 insertions, 5 deletions
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 <errno.h>
+#include <fribidi.h>
#include <locale.h>
#include <signal.h>
#include <stdarg.h>
@@ -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;
@@ -304,6 +307,21 @@ 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)
{
const char *class, *instance;
@@ -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 {