Automatically change layer upon going fullscreen

I’d like to automatically change the layer of a particular window (emacs) when it goes fullscreen. Also the window should be changed back to layer 4 when leaving fullscreen. Is there a way to acheive that? I found this in the FAQ: fvwm.org/documentation/faq/#3.30 and it’s probably part of the solution. But how to I trigger this upon entering and leaving fullscreen.

Background: I’m trying to come up with a configuration for my xfce4-panel. Basically I’d like the same behavior as in OS X: the panel should never be covered by any other window unless that other window is in fullscreen. My planned solution: put the panel on layer 5 and temporarily change the layer of windows requesting fullscreen to 6. A weakness of that solution is that maximizing a window will put its top under the panel but I couldn’t find a way to avoid that. It’s possible to change the behavior of maximize such that a bottom part of the screen is spared (Maximize 100 -20p) but that doesn’t seem to work with the top part of the screen.

Thanks for any suggestions.

Titus

Normally you bind your fullscreen action to a key. I do this with[code]#-----------------------------------------------------------------------

F11 maximize active window to fullscreen and back

#-----------------------------------------------------------------------

Keyname Context Modifi Function

Key F11 A M Pick FuncMaximizeFullScreen[/code]The function]#-----------------------------------------------------------------------

This function maximize a window to fullscreen - no title, no buttons, no border

#-----------------------------------------------------------------------
DestroyFunc FuncMaximizeFullScreen
AddToFunc FuncMaximizeFullScreen

  • I ThisWindow (Maximized) WindowStyle Title, Borders
  • I TestRc (!Match) WindowStyle !Title, !Borders
  • I TestRc (!Match) Raise
  • I TestRc (!Match) UpdateStyles
  • I Maximize ewmhiwa[/code]On my system the window goes upon my panels in fullscreen. Also it has no title and borders.

To put your panel to layer 5]
Style “xfce4-panel” Layer 0 5
[/code]
Also, you can define a working area to prevent windows to overlap panels, pager and that stuff]#-----------------------------------------------------------------------

Define bands at the edge of the screen. It is used to compute the

Working Area

#-----------------------------------------------------------------------
EwmhBaseStruts [/code]
– Thomas –

Works beautifully! Thank you very much, Thomas. FVWM is a fantastic tool but without your service in this forum many people (like myself) wouldn’t be able to fully take advantage of it.

Follow-up question: what if an application requests fullscreen (e.g. a movie player or Firefox). Is it possible to catch that and to change the layer when that happens?

Haven’t seen this behaviour yet (or can’t remember :unamused: ) … anyway …

I’ve played around that and if the application requests fullscreen and sets _NET_WM_STATE_FULLSCREEN then you can use the code below.

First you need an event handler]#-----------------------------------------------------------------------

Event Handler

#-----------------------------------------------------------------------
DestroyModuleConfig FvwmEventWMState: *
*FvwmEventWMState: configure_window FE-WMStateChanged[/code]
As the event “configure_window” appear the function FE-WMStateChanged will be executed.
The function]DestroyFunc FE-WMStateChanged
AddToFunc FE-WMStateChanged

  • I Current (Maximized, Raised, CurrentPage)
    PipeRead ‘if [ xprop -id $[w.id] |grep -c _NET_WM_STATE_FULLSCREEN = 1 ]; then
    echo WindowId $[w.id] Layer 0 10;
    fi;’[/code]What does this function:
  1. It checks wether the current window is maximized, raised and on the current page.
  2. It runs xprop to get information about this window. If it found _NET_WM_STATE_FULLSCREEN it sets the window to layer 10 (or whatever layer you like).

To activate this stuff add to your StartFunction]# activate event module for WM_STATE changes

  • I Module FvwmEvent FvwmEventWMState[/code]
    :mrgreen:
    – Thomas –