tabbed

Simple tabbing application for X11.
git clone git://r-36.net/tabbed
Log | Files | Refs | README | LICENSE

commit 2db44155243b40a56ea675ac526f982441c34c26
parent 66021e959ca27b9be90e1440592812345404a452
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 16 Jan 2013 18:33:50 +0100

Making tabbed convert the title string to native.

Thanks "Markus Wichmann" <nullplan@gmx.net>!

Diffstat:
tabbed.c | 19++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tabbed.c b/tabbed.c @@ -129,6 +129,7 @@ static void unmanage(int c); static void updatenumlockmask(void); static void updatetitle(int c); static int xerror(Display *dpy, XErrorEvent *ee); +static void xsettitle(Window w, const char *str); /* variables */ static int screen; @@ -423,7 +424,7 @@ focus(int c) { for(i = 0, n = strlen(buf); cmd[i] && n < sizeof(buf); i++) n += snprintf(&buf[n], sizeof(buf) - n, " %s", cmd[i]); - XStoreName(dpy, win, buf); + xsettitle(win, buf); XRaiseWindow(dpy, win); return; @@ -437,7 +438,7 @@ focus(int c) { XSetInputFocus(dpy, clients[c]->win, RevertToParent, CurrentTime); sendxembed(c, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0); sendxembed(c, XEMBED_WINDOW_ACTIVATE, 0, 0, 0); - XStoreName(dpy, win, clients[c]->name); + xsettitle(win, clients[c]->name); /* If sel is already c, change nothing. */ if(sel != c) { @@ -1051,7 +1052,7 @@ updatetitle(int c) { clients[c]->name, sizeof(clients[c]->name)); } if(sel == c) - XStoreName(dpy, win, clients[c]->name); + xsettitle(win, clients[c]->name); drawbar(); } @@ -1085,6 +1086,18 @@ xerror(Display *dpy, XErrorEvent *ee) { return xerrorxlib(dpy, ee); /* may call exit */ } +void +xsettitle(Window w, const char *str) { + XTextProperty xtp; + + if(XmbTextListToTextProperty(dpy, (char **)&str, 1, XCompoundTextStyle, + &xtp) == Success) { + XSetTextProperty(dpy, w, &xtp, wmatom[WMName]); + XSetTextProperty(dpy, w, &xtp, XA_WM_NAME); + XFree(xtp.value); + } +} + char *argv0; void