On Thu, Oct 18, 2007 at 02:17:45PM -0400, Joseph Xu wrote:
> Here's a script that seems to work with 3.5
>
> #!/bin/sh
>
> if [ $1 == '0' ]; then
> address=unix!/tmp/ns.$USER.:0/wmii
> else
> address=unix!/tmp/ns.$USER.:0.$1/wmii
> fi
> if [ `wmiir -a $address ls /client | wc -l` -eq "0" ]; then
> # no clients open, just warp to upper left corner
> swarp -d :0.$1 0 0
> else
> client=`wmiir -a $address read /client/sel/ctl`
> client_info=`wmiir -a $address read /tag/sel/index | grep $client`
> col=`echo $client_info | awk '{ print $1}'`
> y=`echo $client_info | awk '{ print $3}'`
> x=`wmiir -a $address read /tag/sel/index | grep "^# $col" | awk '{
> print $3 }'`
> swarp -d :0.$1 $[$x+5] $[$y+5] # the +5 is to avoid those little
> column resizing handles
> fi
Here's a slightly modified version that sends focus to floating windows
correctly. It also uses an unmodified swarp per sqweek's suggestion,
and can be called without an argument to toggle back and forth between
screens (I map mod-Tab to this).
Christian
#!/bin/sh
if [ "x$1" == "x" ]; then
if [ $DISPLAY == ":0.0" ]; then
$0 1
else
$0 0
fi
exit
fi
if [ $1 == '0' ]; then
address=unix!/tmp/ns.$USER.:0/wmii
else
address=unix!/tmp/ns.$USER.:0.$1/wmii
fi
if [ `wmiir -a $address ls /client | wc -l` -eq "0" ]; then
# no clients open, just warp to upper left corner
DISPLAY=:0.$1 swarp 0 0
else
client=`wmiir -a $address read /client/sel/ctl`
client_info=`wmiir -a $address read /tag/sel/index | grep $client`
col=`echo $client_info | awk '{ print $1}'`
if [ $col = '~' ]; then
x=`echo $client_info | awk '{ print $3}'`
y=`echo $client_info | awk '{ print $4}'`
else
y=`echo $client_info | awk '{ print $3}'`
x=`wmiir -a $address read /tag/sel/index | grep "^# $col" | awk '{ print $3 }'`
fi
DISPLAY=:0.$1 swarp $[$x+5] $[$y+5] # the +5 is to avoid those little column resizing handles
fi
Received on Fri Dec 21 2007 - 22:24:05 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:33:06 UTC