On 03/03/2008, Michael Treibton <[EMAIL PROTECTED]> wrote:
> On 24/02/2008, Jaimos Skriletz <[EMAIL PROTECTED]> wrote:
>
> > I have not run across any built in way to do this. Bascailly all it does is 
> > move each
>  > window to the current location of the corresponding window. If the windows 
> are the
>  > same size you get nice results (such as terminals), if windows are 
> different size you
>  > could push them off the screen or get other strange behavior.
>
>
> ok - i have gone back to using this. can i have it that when i use
>  this to swap windows around the focus satys with the orginal window?
>  at present it swaps focus with the prev window and i dont want this.

So you probably want something like this (completely untested):

DestroyFunc SwapWin
AddToFunc   SwapWin
+ I SwapWin2 1
+ I Direction $0 (!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 WindowId $[win1-id] FlipFocus
+ I UnsetEnv win1-x
+ I UnsetEnv win1-y
+ I UnsetEnv win1-id
+ I UnsetEnv win2-x
+ I UnsetEnv win2-y
+ I UnsetEnv win2-id

This includes the change needed for Direction (since you noted as such
in a previous email) as well as the call to WindowId to attempt to
keep focus.  Hence you would then bind keys to it thus:

Key Left    A   S4  SwapWin West
Key Right  A   S4  SwapWin East

As I say, it ought to work, but it's completely untested.  What is it
about these which give you your "odd" results?  The functions look OK
to me - albeit they could be cleaned up a little, but that's a
cosmetic thing rather than an operational one.

-- Thomas Adam

Reply via email to