Re: [dev] Re: [lsw] List only visible windows

From: Peter John Hartman <peterjohnhartman_AT_gmail.com>
Date: Sun, 28 Aug 2011 12:07:29 -0400

On Sun, Aug 28, 2011 at 03:10:41PM +0100, Rob wrote:
> On 28 August 2011 14:49, Christian Neukirchen <chneukirchen_AT_gmail.com> wrote:
> > My private fork of lsw also features a check for the urgency hint, which

i also have a minor pull request to lsw.c to show the class. despite its size, it
might be worth placing such pull requestes up on the website like other suckmore
apps. here's mine.

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);
 }
 

peter

-- 
sic dicit magister P
Collaborative Programme in Ancient and Medieval Philosophy
University of Toronto
http://individual.utoronto.ca/peterjh
Received on Sun Aug 28 2011 - 18:07:29 CEST

This archive was generated by hypermail 2.2.0 : Sun Aug 28 2011 - 18:12:04 CEST