Stack Firefox windows on different layers?

Desired setup:

  • First Firefox window full screen on layer 4, without window decorations.
  • Subsequent Firefox windows floating and with window decorations on layer 6.

And what would be really cool:

  • When the first Firefox window is closed, then another one open is moved to layer 4 and made full screen.

I guess I could do some of it using FvwmEvent and wmctrl on window open/close. Devil’s Pie also looks interesting. At first glance, these tools seem to provide all the features necessary, incl. setting windows to always be above or always be below other windows.

Suggestions?

In the end I realized that with only FVWM. Taken from the hiwiwi configuration, and edited (typos possible):

AddToFunc MyMaximizeInLayer3
+ I All ("Firefox", Layer 3, !Transient) ResizeMove 2592p 1620p 288p 0p
+ I UpdateStyles
+ I All (Layer 3, !Transient) WindowStyle \
    FixedPosition, FixedUSPosition, FixedPPosition, \
    FixedSize, FixedUSSize, FixedPSize

AddToFunc MyUndecorateInLayer3
+ I All (Layer 3, !Transient) WindowStyle NoTitle, !Borders

AddToFunc MyUpdateLayer3
+ I MyUndecorateInLayer3
+ I UpdateStyles
+ I MyMaximizeInLayer3

AddToFunc MyUpdate
+ I Layer 0 3
+ I UpdateStyles # Firefox may open more windows now -> current may change
+ I MyUpdateLayer3

AddToFunc MyUpdateIfInList
+ I Current (!Transient, "Firefox") MyUpdate

AddToFunc MyResizeInLayer4
+ I Current (Layer 4, "Firefox") Resize 1024p 768p

AddToFunc MyOnWindowAdd
+ I Any (CurrentDesk, Layer 3) MyResizeInLayer4
+ I None (CurrentDesk, Layer 3) MyUpdateIfInList

Module FvwmEvent
*FvwmEvent: Cmd
*FvwmEvent: add_window MyOnWindowAdd

Full screen in this case actually leaves some space for a navigation bar on the left side, 288px wide.