diff --git a/src/client.c b/src/client.c index 8055494..550d400 100644 --- a/src/client.c +++ b/src/client.c @@ -236,7 +236,16 @@ client_focus(Client *c) void client_get_name(Client *c) { - XFetchName(dpy, c->win, &(c->title)); + Atom rt; + int rf; + ulong ir, il; + + if(XGetWindowProperty(dpy, c->win, net_atom[net_wm_name], 0, 4096, + False, net_atom[utf8_string], &rt, &rf, &ir, &il, (uchar**)&c->title) != Success) + XGetWindowProperty(dpy, c->win, ATOM("WM_NAME"), 0, 4096, + False, net_atom[utf8_string], &rt, &rf, &ir, &il, (uchar**)&c->title); + + /* If there is no title... */ if(!c->title) c->title = _strdup("WMFS"); diff --git a/src/frame.c b/src/frame.c index 5bb5b78..2983ace 100644 --- a/src/frame.c +++ b/src/frame.c @@ -191,10 +191,11 @@ frame_update(Client *c) XClearWindow(dpy, c->bottom); if(TBARH && (TBARH + BORDH + 1) > font->height) + { barwin_draw_text(c->titlebar, (c->frame_geo.width / 2) - (textw(c->title) / 2), (font->height - (font->descent)) + (((TBARH + BORDH) - font->height) / 2), - c->title); - + strdup(c->title)); + } return; }