Jeremy Hankins wrote:
> Paul Malherbe <[EMAIL PROTECTED]> writes:
>
>
>> I wonder if someone could tell me how to focus and raise a particular
>> client above the rest.
>> i.e. a 'wmiir write' instruction
>>
>> This specifically applies to floating clients.
>>
>> I am trying to write an event script.
>>
>
> The general case of raising a particular client is a bit tricky, but it
> can be done. Given a particular client (e.g., /client/n) you have to
> first scan /<tag>/<column>/<client>/index for every tag, column, and
> client value. Wherever the value in index equals <n> (as in
> /client/<n>), that's a potential display path for raising the client --
> there can be multiple matches, of course, though only one per view.
> Once you decide which option to select, you have to select the column,
> the view, and the client. In shell:
>
> echo -n select <n> | wmiir write /<view>/<column>/ctl
> echo -n select <column> | wmiir write /<view>/ctl
> echo -n view <view> | wmiir write /ctl
>
> I have code to do this in python. It will raise a client with a
> matching title or class, cycling matching clients and raising the chosen
> client in the current view if it's visible there. Unfortunately once
> you scan for matches (spawning wmiir with each read), and select the
> view, column, and client, it's quite slow. Even under low load
> situations there's a noticeable delay on my machine.
>
>
Hi Jeremy
Thanks for you input, it has really helped me!!
What I was trying to do was write an event script which would raise the
client which received focus.
I have done it but the response is slow (acceptable), however I have had
to write a bash script calling a python script as my bash is not very good.
Could you maybe help me simplify it by using only one (python) script?
I have attached the two scripts.
Thanks, Paul
#!/bin/bash
wmiir read /event 2> /dev/null |
while read event
do
set -- $event
if test "$1" = "ClientFocus"
then /home/paul/.wmii-3/focus.py
fi
done
#!/usr/bin/python
import os, popen2, time
idx = popen2.popen2("wmiir read /view/sel/sel/index")
num = idx[0].readlines()[0].replace(chr(10), "").replace(chr(12), "")[-1:]
for x in range(20):
tst = popen2.popen2("wmiir read /view/sel/%s/index" % x)
chk = tst[0].readlines()[0].replace(chr(10), "").replace(chr(12), "")[-1:]
if chk == num:
os.system("echo -n select %s|wmiir write /view/sel/ctl" % x)
time.sleep(1)
break
_______________________________________________
[email protected] mailing list
http://wmii.de/cgi-bin/mailman/listinfo/wmii