I wrote a little program which takes window id (in hex) as argument and sends that window to top. Here is the source:
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
int main(int argc, char **argv)
{
if ( argc != 2 ) {
printf("Usage:\n\ttotop <window id>\n");
return 1;
}
Display *dsp = XOpenDisplay(NULL);
long id = strtol(argv[1], NULL, 16);
XRaiseWindow ( dsp, id );
XSetInputFocus ( dsp, id, RevertToNone, CurrentTime );
XCloseDisplay ( dsp );
return 0;
}
You can compile it with:
c++ totop.cpp -L/usr/X11R6/lib -lX11 -o totop
I assumed that you saved it in "totop.cpp".
It has problem I do not know how to fix: if window is in another virtual desktop this program doesn't work. Here another question rises: how to send window to current desktop?
You can get window id using xwininfo. A little script using this program used to call WordNet:
#!/bin/bash
if ps -A | grep wishwn; then # if WordNet already launched
id=$(xwininfo -name "WordNet 1.7.1 Browser" | grep id: | awk "{ print \$4 }")
totop $id
else # launch WordNet
wnb
fi
|