lsw

lists window titles of X clients to stdout
git clone git://git.suckless.org/lsw
Log | Files | Refs | README | LICENSE

commit 84e6fd3cd229b57d894d6ed9db6517580d8189ef
parent 95281b561798281c0523e2b5cb50958faf9f1e90
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Sat, 17 Apr 2010 14:15:28 +0000

added new <xid> argument
Diffstat:
Mlsw.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lsw.c b/lsw.c @@ -11,7 +11,6 @@ static char buf[1024]; static Atom netwmname; static Display *dpy; -static Window root; static void getname(Window w) { @@ -44,6 +43,7 @@ main(int argc, char *argv[]) { unsigned int i, num; Window *wins, d1, d2; XWindowAttributes wa; + Window win; if((argc > 1) && !strncmp(argv[1], "-v", 3)) { fputs("lsw-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); @@ -53,9 +53,13 @@ main(int argc, char *argv[]) { fputs("lsw: cannot open display\n", stderr); exit(EXIT_FAILURE); } - root = RootWindow(dpy, DefaultScreen(dpy)); + if(argc == 2) + win = atoi(argv[1]); + else + win = DefaultRootWindow(dpy); + netwmname = XInternAtom(dpy, "_NET_WM_NAME", False); - if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { + if(XQueryTree(dpy, win, &d1, &d2, &wins, &num)) { for(i = 0; i < num; i++) { if(!XGetWindowAttributes(dpy, wins[i], &wa)) continue;