How to place transient windows at center of parent window?

It appears that by default, transient windows are placed just like any other window.

Is it possible to have transient windows placed at the center of the corresponding parent window (assuming the parent window is at least partially visible)?


Yes, if you use FvwmEvent, the Visible condition, and some mathematics to do so – you will need to also use xprop to ascertain the parent window of the transient window (via the WM_TRANSIENT_FOR XAtom). You’d have to evaluate that in a PipeRead.


– Thomas Adam

The question popped into my head when I noticed that the evolution spell checker window insisted on being placed half off the screen (left half visible, right half off the screen). However, I see now that FVWMIdent shows the spell checker window isn’t a transient at all.

My placement policy is MinOverlapPlacement and I’ve set NoPPosition and NoUSPosition, but they have no discernable impact. I’m aware of no other windows that get placed partially off the screen and I have no idea why this particular window is misbehaving.

‘Style “Spell checker” CenterPlacement’ will force the window to be placed fully visible, but I’d like to understand what’s going on.


Add the option:

BugOpts ExplainWindowPlacement On

Into your .fvwm2rc file somewhere, then start up this window that’s giving you the problems. Look then at ~/.xsession-errors, to see why FVWm placed it where it did.

I suspect (since you mention Evolutioon) that it might be a EWMH issue. But one thing at a time. You’re sure it’s not a transient window, right?

See above.

– Thomas Adam

Okay, no .xsession-errors, but this was printed out on the console:

[FVWM][__explain_placement]: placed new window 0x1212b63 'Spell checker':
   desk 0 (current desk)
   current page
   position 1167 0, placed by fvwm (normal placement)
      placement method: MinOverlap

FVWMIdent shows ‘Transient: No’, and this is supported by xprop which shows a distinct lack of ‘WM_TRANSIENT_FOR’ lines.

My resolution is 1280x1024 and the window dims are 276x210.


Woops. I completely forgot that I had started to answer this. I can’t see anything overtly obvious in the output you provided. My only suggestion to you (if you can’t fix it by some of the many FP placement policies described in the manpage) is to use FvwmEvent to place the window, hence:

DestroyModuleConfig FE-AW: *

*FE-AW: add_window 'ThisWindow ("Spell checker") AnimatedMove 300 600'

AddToFunc StartFunction I Module FvwmEvent FE-AW

I don’t like this suggestion though as there’s obviously something wrong with that window for it to placed off-kilter in the first place. I am not prepared to download that application though to see if I can reproduce it. :slight_smile:

– Thomas Adam

Is there some advantage (besides positional flexibility) to using FvwmEvent over ‘Style “Spell checker” CenterPlacement’?

Ugg. I wouldn’t be using it either except that our Exchange admins won’t turn IMAP on for some reason. evolution-exchange is the only Linux-based solution I’ve found so far that lets me read my email and store it locally.

Thanks again for your help. I can’t tell you how much I appreciate your prompt, informed, and informative responses.

– Flatline

No, not at all. Not if CenterPlacement works for you. But I thought you said that even with it set, the window was still being mis-placed? If that’s wrong, then ignore FvwmEvent entirely.

You’re welcome.

– Thomas Adam

I’ve learned something interesting: if I use PlaceAgain on the spell checker window, it gets placed correctly. I think that somehow Evolution is mis-reporting the initial dimensions of the spell checker window. This is corroborated by the fact that when using CenterPlacement, the spell checker window isn’t quite centered, but then when PlaceAgain is used, it is adjusted correctly.

Does that sound familiar?

Nope, but PlaceAgain is doing what it’s meant to. Of course in this case, you shoudn’t really need to be using it, as the Spell Check window should be in the right place.

The world’s not perfect after all.

– Thomas.