store the previous coordinates of a window?


I am writing my own configuration and falling love with this fantastic WM.

After many trials and googling, I still cannot solve a problem that I met these days (hopefully this is where I should put my first post…):

I would like to be able to move a window to the center of the current page. No problem. There are already many posts giving the solution.

But I also expect to move the centered window back to its previous location, which I have no idea how to realize. I guess the previous coordinates of the window should be stored somewhere, not sure of this though…

Is there a way to store the coordinates so that the window could be pushed back to the previous location?
Or is there a function/script already cover this?

Thus it would be greatly appreciated if anyone could shed some light on the solution to the problem above.

Many thanks in advance and
with kind regards,


Some people might naively suggest you use SetEnv to store OLDW $[w.x] OLDY $[w.y]. I am going to suggest you use ResizeMoveMaximize to move the window – then you can just unmaximize the window (which is still keeping the original size of the window) to put the window in its original location.

– Thomas Adam

To elaborate:

Pick ResizeMoveMaximize $[w.width]p $[w.height]p +0 +0

Moves a window to 0 0 (top left corner of the screen) without resizing – unmaximizing the window restores its position.

– Thomas Adam

Thanks for the reply!

well, for some reason unknown it doesn’t work here. the window is taken to (0, 0), but subsequent calls to the function don’t bring it back, but grow the height of the window…

maybe there is something wrong elsewhere in my config.

my humble opinion is I may still need to store the info of the previous location as I would like to animated-move the windows…

Could you please demonstrate how to do this, or confirm if this is feasible?

with kind regards,

Well, obviously – the ResizeMoveMaximize isn’t toggleable – and what’s this about growing the height of the window? That wasn’t in your original requirements.

No, you just misunderstand.

Well, you can do whatever you like, but:

DestroyFunc Foo
AddToFunc    Foo
+ I ThisWindow (State 0, Maximized) Maximize off
+ I TestRc (Match) State 0 off
+ I TestRc (NoMatch) ResizeMoveMaximize $[w.width]p $[w.height]p +0 +0
+ I TestRc (Match) State 0 on
Pick Foo

– Thomas Adam