Centring Windows

A very easy function to center your window without any hardcoded screen height and width:

DestroyFunc CenterWindow
AddToFunc   CenterWindow
+ I ThisWindow Piperead "echo Move \
    $(( $[vp.width]/2-$[w.width]/2 ))p \
    $(( $[vp.height]/2-$[w.height]/2 ))p"

Key KP\_Begin A 4 CenterWindow

Note that in Fvwm >=2.5.12, one can use a default style ‘‘CenterPlacement’’, hence:

Style myapp CenterPlacement

And with FVWM >=2.5.27, the CenterPlacement style was folded into the PositionPlacement style option, hence:

Style myapp PositionPlacement center

If the window still doesn’t follow correctly, try to disable PPosition and USPosition:

Style myapp PositionPlacement center, NoPPosition, NoUSPosition