diff options
| author | Patrick Haller <patrick@haller.ws> | 2012-02-18 14:37:18 +0800 |
|---|---|---|
| committer | Patrick Haller <patrick@haller.ws> | 2012-02-18 14:37:18 +0800 |
| commit | c0f8a57194fbdecc2870de7594edf2e47c557baa (patch) | |
| tree | dea2c08eff25e79184fa025a5c9a175754dbae2a | |
| parent | 7fa1169cb63c8a795782446863794e5349f019a7 (diff) | |
| parent | a1ef548bfb93e95b62369fc80a352832eff9bf50 (diff) | |
Merge branch 'master' of github.com:patrickhaller/no-wm
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | x-alt-tab.c | 8 | ||||
| -rw-r--r-- | x-window-list.c | 17 |
3 files changed, 15 insertions, 12 deletions
@@ -19,6 +19,8 @@ components unclutter http://unclutter.sourceforge.net/ dmenu http://tools.suckless.org/dmenu/ autocutsel http://www.nongnu.org/autocutsel/ + overview + http://www.sbin.org/doc/Xlib/index_contents.html procedure set up your ${HOME}/.xinitrc to be something like diff --git a/x-alt-tab.c b/x-alt-tab.c index 25976e0..de4cd6e 100644 --- a/x-alt-tab.c +++ b/x-alt-tab.c @@ -4,13 +4,15 @@ int main(int argc, char **argv) { Display *dpy; - if(!(dpy = XOpenDisplay(0x0))) return 1; + if ( (dpy = XOpenDisplay(NULL)) == NULL) + return 1; + if (argc > 1) XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); else XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); - XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); /* nuke focus back to pointer */ + + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(dpy, True); return 0; } - diff --git a/x-window-list.c b/x-window-list.c index b899584..34528f7 100644 --- a/x-window-list.c +++ b/x-window-list.c @@ -6,24 +6,23 @@ // first window listed is top-most, last is bottom-most in window-stacking int main(void) { Display *dpy; - Window root; - Window parent; - Window *wins; + Window root, parent, *wins, *w; unsigned int nwins; - if(!(dpy = XOpenDisplay(NULL))) + if ((dpy = XOpenDisplay(NULL)) == NULL) return 1; + XQueryTree(dpy, DefaultRootWindow(dpy), &root, &parent, &wins, &nwins); - for (int i=nwins-1; i >= 0; i--) { + for (w = wins + nwins - 1; w >= wins; w--) { XTextProperty name; XClassHint hint; XWindowAttributes attr; - XGetClassHint(dpy, wins[i], &hint); - XGetWMName(dpy, wins[i], &name); - XGetWindowAttributes(dpy, wins[i], &attr); + XGetClassHint(dpy, *w, &hint); + XGetWMName(dpy, *w, &name); + XGetWindowAttributes(dpy, *w, &attr); if (attr.map_state == IsViewable) - fprintf(stdout, "0x%-10x %s - %s\n", (unsigned int)wins[i], hint.res_name, name.value); + printf("0x%-10x %s - %s\n", (unsigned int)*w, hint.res_name, name.value); } } |
