Is this what you are looking for:
1st run this script
Code:
#!/bin/bash
cat >./getcurpos.c <<EOF
/*
Print the current coordinates of the mouse pointer to stdout
Copyright (C) 2007 by Robert Manea <rob dot manea at gmail dot com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// Tweeked by: K.D.Hedger Mon 15 Aug 2011 04:42:54 PM BST
#include<stdio.h>
#include<stdlib.h>
#include<X11/Xlib.h>
int main(int argc, char *argv[])
{
XEvent e;
Display *d=XOpenDisplay(NULL);
long int ans=strtol(argv[1], NULL,0);
if(!d)
return EXIT_FAILURE;
/* get info about current pointer position */
XQueryPointer(d,ans,
&e.xbutton.root, &e.xbutton.window,
&e.xbutton.x_root, &e.xbutton.y_root,
&e.xbutton.x, &e.xbutton.y,
&e.xbutton.state);
printf("Local %d %d Global %d %d Button %d\n", e.xbutton.x, e.xbutton.y, e.xbutton.x_root, e.xbutton.y_root,e.xbutton.state);
XCloseDisplay(d);
return EXIT_SUCCESS;
}
EOF
rm ./getcurpos 2>/dev/null
gcc -Wall -lX11 getcurpos.c -o ./getcurpos
strip ./getcurpos
rm ./getcurpos.c
sudo mv ./getcurpos /usr/local/bin
exit 0
this installs a small c program to read the global,local mouse positions and buttons
2nd save this script as for instance "cycle" and make it executable, then run it
Code:
#!/bin/bash
############################
#
# cycle windows until mouse press
# K.D.Hedger Wed 24 Aug 2011 12:19:45 AM BST
# kdhedger@yahoo.co.uk
#
############################
#strip tabs and space
stripclean ()
{
read
echo "$REPLY"|sed 's/^[ \t]*//;s/[ \t]*$//'
}
#get the window list
refreshwindowlist ()
{
WINDOWS=""
WINDIDS=""
IDCNT=0
while read
do
DATA=$(wnckprop --window=$REPLY 2>/dev/null)
#only interested in "normal" windows
if [ "$(echo "$DATA"|grep -i "Window Type:"|awk -F : '{print $2}'|stripclean )" = "normal window" ];then
#window name
WINDOWS[IDCNT]=$(echo "$DATA"|grep -i "Class Group:"|awk -F : '{print $2}'|stripclean)
#window id
WINDIDS[$IDCNT]=$REPLY
((IDCNT++))
fi
done < <(wnckprop --list|awk -F : '{print $1}')
}
GETCURSPOS=/usr/local/bin/getcurpos
refreshwindowlist
#pause at each window 50*0.01 about half a second ( not very accurate )
PAUSE=50
while :
do
for ((CNT=0;CNT<IDCNT;CNT++))
do
#activate window ( switch workspace and bring to front )
wmctrl -ia ${WINDIDS[$CNT]}
#pause the window and check for left mouse down
for ((WAIT=0;WAIT<$PAUSE;WAIT++))
do
x=$($GETCURSPOS ${WINDIDS[$CNT]})
if [ $(echo $x|awk '{print $8}') -eq 256 ];then
#we want this window
break 3
fi
sleep 0.01
done
done
done
#do some more stuff
echo ${WINDOWS[$CNT]}
The windows will cycle until the left mouse button is pressed, I don't have a IR remote so you will have to get it to simulate a mouse press ( can't help you on that bit ) or possibly just run a kill command ( killall cycle )