StaysOnTop Toggle, Borderless Maximization, and ReleaseFocus

I’m new to FVWM and have spent the last few days reading the documentation and other peoples’ configs but have had only limited success with my own, even with things that seem pretty simple. Any help with the following problems would be greatly appreciated.

1) A function that to toggle windows between Layer 4 and 6. I thought this would work:

[code] + C ThisWindow(Layer 4) Layer 0 6

  • C TestRc Layer 0 4[/code]
    And tried several variations of WindowStyle StaysOnTop but the only thing that had any effect was explicitly telling a window where to go.

2) Stripping borders from maximized windows. I thought I had this figured out too:

[code] + C Maximize

  • C ThisWindow(Maximized) WindowStyle !Borders
  • C TestRc WindowStyle Borders[/code]
    But that had no effect on borders. I’m probably using conditionals wrong.

3) Release focus from lowered and iconified windows
I like ClickToFocus and with it it makes sense for windows that are dismissed by iconification or lowering to release their focus like closed windows with FPReleaseFocus. Is there a simple, elegant way to do this? I came up with this:

 + I Prev (CurrentDesk, CurrentPage) Focus

But it seems kludgy and doesn’t always work correctly.

Can you provide the context under which each of those functions are invoked? I noticed you have “+ C” which would indicate when you clicked on the window, but where, how?

What you actually want to do is replace your functions similar to these:

+ I ThisWindow(Layer 4) Layer 0 6
+ I TestRc Layer 0 4

And then define your click instance to call the function that the above defines. You should be using I for Immediately in this context.

As for maximising goes…

+ I Maximize
+ I ThisWindow(Maximized) WindowStyle !Borders
+ I TestRc  WindowStyle Borders

There was also a thread on this earlier on in the forum, which you should dig up…


– Thomas Adam

I’m not sure I understand your first suggestion. The where and how of a function are defined with bindings; it doesn’t make sense to have a function set to operate immediately when you only want it to happen with a click.

The thread you referred to was quite helpful however, leading me to the solution to my first two problems. The suggestion there was to use the State command to toggle whether window decorations should be drawn. This was exactly what I needed for Problem 1, leading me to this function:

[code]DestroyFunc FvwmToggleOnTop
AddToFunc FvwmToggleOnTop

  • C State 1 toggle
  • C ThisWindow (State 1) Layer 0 6
  • C ThisWindow (!State 1) Layer 0 4
  • C ThisWindow (!State 1) Raise[/code]
    The last line keeps windows from being lowered when their layer is changed.

I found I could use this same solution to toggle window borders for maximized windows but this was a suboptimal solution. For one thing windows already have a Maximized property for use in conditionals, and secondly doing it this way leaves dead space around maximized windows where their borders used to be. The problem, I realized, was that these changes weren’t being completed in order, but rather all at once some time after the function ended. Which is exactly the situation RefreshWindow is for:

[code]DestroyFunc FvwmFullMaximize
AddToFunc FvwmFullMaximize

  • I ThisWindow (!Maximized) WindowStyle !Borders
  • I TestRc WindowStyle Borders
  • I RefreshWindow
  • I Maximize[/code]

As for the third issue, changing my original function to this:

+ I Prev (AcceptsFocus, CurrentDesk, CurrentPage, !Iconic) Focus

seems to solve most of the issues, but only works when it’s actually called, not, for example, when the taskbar is used to minimize a window. It’d be nice if there was an option to extend FPReleaseFocus to iconification and lowering, but this probably won’t be an issue for me once I replace the taskbar with a better solution (FvwmButtons + FvwmIconMan is supposed to be good).

So thanks a bunch for your help ThomasAdam, I’m sure I’ll have more questions later. :slight_smile:

Sorry to reply to myself but this bears emphasis since I’d hate for other beginners to get the same subtle error:

This works (and is a better solution then what I came up with earlier):

[code]+ C ThisWindow (Layer 4) Layer 0 6

  • C TestRc ThisWindow (Layer 6) Layer 0 4
  • C TestRc (Match) Raise[/code]
    while this (my original attempt):

[code]+ C ThisWindow(Layer 4) Layer 0 6

  • C TestRc Layer 0 4[/code]
    does not, because there needs to be a space between a conditional command and its list of conditions :imp:

Right – I misunderstood what it was you were trying to do.

What you should also have as the last line is:

+ I UpdateStyles

It’s slightly different from the RefreshWindow statement you have, and is used only inside functions where one is updarinf style references on windows.

You’e welcome.

– Thomas Adam