[Nix-dev] wmii and xrandr

Nicolas Pierron nicolas.b.pierron at gmail.com
Fri Mar 13 00:40:13 CET 2009


On Fri, Mar 13, 2009 at 00:26, Marc Weber <marco-oweber at gmx.de> wrote:
>> wmiir xwrite /ctl quit
>>
>> > properly anyway.. I never switch .. ) and I'd be happy because I could
>> > just use the hacky way which I already know to be working without much
>> > testing or rebuilding etc..
>> > I won't harm anyone stepping in fixing this properly. :)
>>
>> Yes, but we should avoid to commit hacky stuff as long as this is not
>> a primary issue for most of the users.
> so how do we destinguish the case wmii has been quit and should be
> restarted from wmii has been quit?
>
> one way would be
> touch /var/run/wmii-restart
>
> and then use
>
> A)
>  rm /var/run/wmii-restart

You should put that inside the loop

>  while :; do
>    wmii
>    [ -e /var/run/wmii-restart ] || break
>  done
>
> B)
> restartWmii(){
>  touch /var/run/wmii-restart
>  pkill wmii; # HACKY! try wmii quit ?

I had a look inside wmii code and I am guessing they are closing the
file hierarchy at the end wmii, so you won't have any choices in this
case.

>  wmii
>  rm /var/run/wmii-restart

The two previous lines should not be here, but at the beginning of the A) loop.

> }
>
> Where A) could be put into a shubshell to keep one PID so that waitPID
> can be used?

That's the idea, so if the file does not exists (FIXME: with some
security to ensure that no other user can control that), then you have
to two following scripts:

A)

( touch /var/run/wmii-restart
  while [ -e /var/run/wmii-restart ]; do
    rm /var/run/wmii-restart
    wmii
  done ) &
waitPID=$!

B)

# probably inside your wmii configuration
restartWmii(){
  touch /var/run/wmii-restart
  pkill wmii
}

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
- If you are doing something twice then you should try to do it once.



More information about the nix-dev mailing list