CenterPlacement on a dual-screen setup


I’ve got this function in my config [code]DestroyFunc CenterWindow
AddToFunc CenterWindow

  • I Current WindowStyle CenterPlacement
  • I PlaceAgain Anim
  • I WarpToWindow 50 50[/code] bound like this Key Space A 4 CenterWindow

I’ve got two monitors, each running at 1280x1024, combined by nvidia’s TwinView.

If I have a window on the left monitor and press the stated keycombo, the windows is placed on the center of this monitor - as I want it. If I have a window on the right monitor and press the combo, it gets moved to the vertical middle and the horizontal left on this monitor(seen over both monitors, the window appears at +1280x(1024/2 - windowheight/2). This is not what I want, I want it to be centered on the right monitor.

Is this a (known) bug in fvwm(2.5.21) or does the function need some mathematics?

Please start using 2.5.25.

I suspect this is related to your PlaceAgain command and the definition as to which your primary screen is. When I get home, I will again look at the code.

– Thomas Adam

I’d like to, but portage-maintainers didn’t bump for ages and 6thpink’s(?) ebuild for 2.5.25 doesn’t work for me. After all, this is my production machine and I’d rather not install things without portage if it’s not absolutely neccessary.


And low and behold, I can’t reproduce this, either.

If I find out this isn’t reproducible with FVWM 2.5.25, I will be very annoyed.

As a tip, CenterWindow is a deprecated Style command, you will need:

WindowStyle PositionPlacement Center

– Thomas Adam

Alright, as stated in the other thread, I successfully updated to 2.5.25 and now my function looks like this [code]DestroyFunc WindowAtMiddle
AddToFunc WindowAtMiddle

  • I Current WindowStyle PositionPlacement Center
  • I PlaceAgain Anim
  • I WarpToWindow 50 50[/code]

So, when invoked, this code brings the window to the absolute middle aka on half on the left monitor and the other on the right. While this can be usefull sometimes, I’d like the window to go in the middle of the screen it resides. I guess that there’s no automatic for it, so some mathematics would be involved(which I’m not very good at).

Do you - or someone else - have a good starting point how to achieve this or have I just overlooked something in the manpage?

It’s working exactly as it should, I cannot get any window to span both monitors in the centre.

– Thomas Adam

How do you mean that? It sounds like you mean I want to have one window “doubled” on both screens and both on the center of both screens? If that’s the case, that’s not what I meant.

If I start the window in the x-area of 0->1280, it should be moved so that the middle of the window is on 640. If it’s started on x 1281->2560 then it should be moved so that the middle of the window is on 1920.

That is what I want and that I think of that there’s no easy solution for it, so it’ll need some mathematics.

OK. PipeRead that then.

– Thomas Adam