On Sun, Feb 24, 2008 at 04:14:20PM +0000, Michael Treibton wrote:
> Hi,
>
> Assume i have two windows, A and B.  Is it possible to swap their
> positions with each other?
>

I was able to get these functions to swap two window locations (under limited 
testing). One thing you may want to note is they have to be on the CurrentPage. 
If you wish to swap windows on different pages you will have to add some more 
detial and include MoveToPage options. You should be able to see the idea I am 
using extend this with MoveToPage options if you desire.

DestroyFunc SwapWin
AddToFunc   SwapWin
+ I SwapWin2 1
+ I Next (!Iconic, CurrentPage) SwapWin2 2
+ I Test (EnvIsSet win1-id, EnvIsSet win2-id) WindowId $[win1-id] Move 
$[win2-x]p $[win2-y]p
+ I TestRc (Match) WindowId $[win2-id] Move $[win1-x]p $[win1-y]p
+ I UnsetEnv win1-x
+ I UnsetEnv win1-y
+ I UnsetEnv win1-id
+ I UnsetEnv win2-x
+ I UnsetEnv win2-y
+ I UnsetEnv win2-id

DestroyFunc SwapWin2
AddToFunc   SwapWin2
+ I ThisWindow (AcceptsFocus, !Iconic) SetEnv win$0-x $[w.x]
+ I TestRc (Match) SetEnv win$0-y $[w.y]
+ I TestRc (Match) SetEnv win$0-id $[w.id]

You will need both functions and in my limited test running the function as

Pick SwapWin

will swap the chosen window with the next window it finds that is not iconic 
and accepts focus. You could replace next with your directional options if you 
desire of course.

jaimos


Reply via email to