Moving windows between layers

I have a couple of cool uses for layers. One is that I have a digital clock,
an analog clock (okay, a pseudo-analog clock), a large single pager, and a
smaller four-desk pager in the upper right corner of my screen, all sticky.
These are started when FVWM starts, and are all on layer 1, which is below
even the stays-on-bottom layer. I have a function defined to move them
all from layer 1 to layer 7 (above the stays-on-top layer) on first invocation,
and then back to layer 1 when called again. In other words, it’s a toggle.
Here is the function:

DestroyFunc “SwapLayers1-7”
AddToFunc “SwapLayers1-7”

  • “I” All (Layer 7) Layer 0 0
  • “I” All (Layer 1) Layer 0 7
  • “I” All (Layer 0) Layer 0 1

I don’t use layers 0, 1, or 7 for anything else (except a taskbar that I
rarely bring up). I usually run most programs full screen, but occasionally
have something else, like a small xterm window, on top, and I don’t want my
clocks or pagers getting in the way, but when I want them, they’re just a
hotkey away, and when I’m through with them, the same hotkey puts them back
where they were. That hotkey is Hyper-, with my control keys being reassigned
as Hyper keys, in case anyone is wondering (I use the CapsLock key as a control

The other thing I do with layers is that the Hyper-Up and Hyper-Down key
combinations raise and lower windows a layer at a time. That comes in handy
when I have a program that likes to keep bringing itself up on top of the stack.
I can either lower the offending program one layer, or I can raise the program
that keeps getting hidden against my wishes by a layer, and the problem is

Whilst you could use Layers for this, you’ll end up grating against the EWMH specification where some windows will transcend layers. Rather than thinking of moving windows between layers as you have them now, instead use State to to the toggling.

– Thomas Adam