s...@mailless.org wrote:

> or use lsw for a specific window:
> 
> lsw | grep "some webpage title" | cut -f1 -d' ' | xargs xprop -id | grep PID

ah, thanks.

btw, i ran into a bug in, i assume, lsw.
----
bash minshall-apollo: {1339} lsw 0x1600004
Segmentation fault (core dumped)
----
at the time, xwininfo around this window id was
----
bash minshall-apollo: {1350} xwininfo -root -children -tree | grep --text 
0x160000
0x1600009 (has no name): ()  1x1+-1+-1  +-1+-1
0x1600001 "darktable": ("darktable" "Darktable")  10x10+10+10  +10+10
0x1600003 "darktable": ("darktable" "Darktable")  1918x1061+-3840+17  +-3840+17
   0x1600004 (has no name): ()  1x1+-1+-1  +-3840+17
----

anyway, here's a patch for lsw that seems to keep it from crashing.
(but, maybe one would want to report such a window somehow?)
----
diff --git a/lsw.c b/lsw.c
index fc40fef..b3f473b 100644
--- a/lsw.c
+++ b/lsw.c
@@ -36,7 +36,8 @@ lsw(Window win) {
        Window *wins, *w, dw;
        XWindowAttributes wa;
 
-       if(!XQueryTree(dpy, win, &dw, &dw, &wins, &n))
+       if((!XQueryTree(dpy, win, &dw, &dw, &wins, &n)) ||
+       (n == 0))
                return;
        for(w = &wins[n-1]; w >= &wins[0]; w--)
                if(XGetWindowAttributes(dpy, *w, &wa)
----
(please let me know if some other way of contributing patches is more
happiness-inducing.)

cheers, Greg

Reply via email to