--- a/config.def.h Sun Dec 11 11:31:06 2011 +0300
+++ b/config.def.h Sun May 12 19:15:15 2013 +0400
@@ -57,6 +57,8 @@
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_j, pushdown, {0} },
+ { MODKEY|ShiftMask, XK_k, pushup, {0} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
--- a/dwm.c Sun Dec 11 11:31:06 2011 +0300
+++ b/dwm.c Sun May 12 19:15:15 2013 +0400
@@ -61,7 +61,8 @@
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
#define TAGMASK ((1 << LENGTH(tags)) - 1)
-#define TEXTW(X) (textnw(X, strlen(X)) + dc.font.height)
+#define TEXTW(X) (textnw(X, strlen(X), False) + dc.font.height)
+#define TEXTWM(X) (textnw(X, strlen(X), True) + dc.font.height)
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@@ -171,7 +172,7 @@
static void drawbar(Monitor *m);
static void drawbars(void);
static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
-static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
+static void drawtext(const char *text, unsigned long col[ColLast], Bool invert, Bool markup);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
static void focus(Client *c);
@@ -213,7 +214,7 @@
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
-static int textnw(const char *text, unsigned int len);
+static int textnw(const char *text, unsigned int len, Bool markup);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
@@ -465,7 +466,7 @@
}
else if(ev->x < x + blw)
click = ClkLtSymbol;
- else if(ev->x > selmon->wx + selmon->ww - TEXTW(stext))
+ else if(ev->x > selmon->wx + selmon->ww - TEXTWM(stext))
click = ClkStatusText;
else
click = ClkWinTitle;
@@ -723,23 +724,23 @@
for(i = 0; i < LENGTH(tags); i++) {
dc.w = TEXTW(tags[i]);
col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm;
- drawtext(tags[i], col, urg & 1 << i);
+ drawtext(tags[i], col, urg & 1 << i, False);
drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
occ & 1 << i, urg & 1 << i, col);
dc.x += dc.w;
}
dc.w = blw = TEXTW(m->ltsymbol);
- drawtext(m->ltsymbol, dc.norm, False);
+ drawtext(m->ltsymbol, dc.norm, False, False);
dc.x += dc.w;
x = dc.x;
if(m == selmon) { /* status is only drawn on selected monitor */
- dc.w = TEXTW(stext);
+ dc.w = TEXTWM(stext);
dc.x = m->ww - dc.w;
if(dc.x < x) {
dc.x = x;
dc.w = m->ww - x;
}
- drawtext(stext, dc.norm, False);
+ drawtext(stext, dc.norm, False, True);
}
else
dc.x = m->ww;
@@ -747,11 +748,11 @@
dc.x = x;
if(m->sel) {
col = m == selmon ? dc.sel : dc.norm;
- drawtext(m->sel->name, col, False);
+ drawtext(m->sel->name, col, False, False);
drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
}
else
- drawtext(NULL, dc.norm, False);
+ drawtext(NULL, dc.norm, False, False);
}
XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
XSync(dpy, False);
@@ -787,7 +788,7 @@
}
void
-drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
+drawtext(const char *text, unsigned long col[ColLast], Bool invert, Bool markup) {
char buf[256];
int i, x, y, h, len, olen;
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
@@ -802,13 +803,16 @@
y = dc.y;
x = dc.x + (h / 2);
/* shorten text if necessary */
- for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w - h; len--);
+ for(len = MIN(olen, sizeof buf); len && textnw(text, len, markup) > dc.w - h; len--);
if(!len)
return;
memcpy(buf, text, len);
if(len < olen)
for(i = len; i && i > len - 3; buf[--i] = '.');
- pango_layout_set_markup(dc.plo, text, len);
+ if (markup)
+ pango_layout_set_markup(dc.plo, text, len);
+ else
+ pango_layout_set_text(dc.plo, text, len);
pango_xft_render_layout(dc.xftdrawable, (col==dc.norm?dc.xftnorm:dc.xftsel)+(invert?ColBG:ColFG), dc.plo, x * PANGO_SCALE, y * PANGO_SCALE);
}
@@ -1620,9 +1624,14 @@
}
int
-textnw(const char *text, unsigned int len) {
+textnw(const char *text, unsigned int len, Bool markup) {
PangoRectangle r;
- pango_layout_set_markup(dc.plo, text, len);
+ if (markup)
+ pango_layout_set_markup(dc.plo, text, len);
+ else {
+ pango_layout_set_attributes(dc.plo, NULL);
+ pango_layout_set_text(dc.plo, text, len);
+ }
pango_layout_get_extents(dc.plo, &r, 0);
return r.width / PANGO_SCALE;
}