What I've been doing for a bit is using a modified version of lsw + xdotool:

~/bin $ cat dwm-xdo-focus
#!/bin/sh
TMPFILE=$HOME/.tmp/dwm-lastwindow
xdotool getwindowfocus > $TMPFILE
xdotool windowactivate $1



diff -r e86225980f5d lsw.c
--- a/lsw.c     Sat Jun 18 18:47:03 2011 +0100
+++ b/lsw.c     Sun Jun 19 13:31:48 2011 -0400
@@ -35,13 +35,19 @@ lsw(Window win) {
        unsigned int n;
        Window *wins, *w, dw;
        XWindowAttributes wa;
+       const char *class = NULL;
+       XClassHint ch = { 0 };

        if(!XQueryTree(dpy, win, &dw, &dw, &wins, &n))
                return;
        for(w = &wins[n-1]; w >= &wins[0]; w--)
                if(XGetWindowAttributes(dpy, *w, &wa)
-               && !wa.override_redirect && wa.map_state == IsViewable)
-                       printf("0x%07lx %s\n", *w, getname(*w));
+               && !wa.override_redirect && wa.map_state == IsViewable) {
+                       if (XGetClassHint(dpy, *w, &ch))
+                               class = ch.res_class ? ch.res_class : "broken";
+                       printf("%3.3s | %-160.160s | 0x%07lx\n", class, 
getname(*w), *w);
+
+               }
        XFree(wins);
 }

---
sic dicit magister P
Université du Québec à Montréal / Loyola University Chicago
http://individual.utoronto.ca/peterjh
gpg 1024D/ED6EF59B (7D1A 522F D08E 30F6 FA42 B269 B860 352B ED6E F59B)
gpg --keyserver pgp.mit.edu --recv-keys ED6EF59B

Reply via email to