My "Show Desktop" Function

This is my “Show Desktop” function after a week into fvwm.

  • When called the first time, iconify all uniconified windows.
  • When called the second time, restore the original set of windows and their stacking order.

Note that the “Thumbnail” function is not fast enough to preserve the stacking order. i.e. if the thumbnail function is used in place of iconify, once out of ten times the stacking order wouldn’t be preserved.

Key d A 4 ShowDesktop

AddToFunc StartFunction I Module FvwmEvent
DestroyModuleConfig FvwmEvent: *
*FvwmEvent: Cmd Function
*FvwmEvent: deiconify State4False

Toggle show desktop / restore

DestroyFunc ShowDesktop
AddToFunc ShowDesktop

  • I Any (CurrentPage, State 4) ShowDesktop-deiconify
  • I TestRc (NoMatch) ShowDesktop-iconify

DestroyFunc ShowDesktop-deiconify
AddToFunc ShowDesktop-deiconify

  • I All Reverse UseStack (CurrentPage, State 4) Iconify

DestroyFunc ShowDesktop-iconify
AddToFunc ShowDesktop-iconify

  • I All UseStack (CurrentPage, Iconifiable, !Iconic) State 4 True
  • I All UseStack (CurrentPage, Iconifiable, !Iconic) Iconify

DestroyFunc State4False
AddToFunc State4False

  • I All (CurrentPage) State 4 False[/code]

I learned in the forums that using state is a bad idea, but I can’t think of any other idea to flag windows for my current knowlegde level.

Look at the fvwm wiki for my solution.

State isn’t such a bad idea. Why do you think this?

Wow. It seems that the basic ideas are the same. :smiley:
It might be better to use “UseStack” to restore the window stacking order? :smiley:

I can’t remember where I got this impression. It’s probably due to misunderstanding. :smiley: :slight_smile:
EDIT: I was probably referring to this: viewtopic.php?p=13582#p13582

Great function! It is also good to add

*FvwmEvent: add_window State0False

I use it like this.

[code]AddToFunc StartFunction

  • I Module FvwmEvent

*FvwmEvent: deiconify State0False
*FvwmEvent: add_window State0False

AddToFunc ShowDesktop

  • I Any (CurrentPage, State 0) ShowDesktopDeiconify
  • I TestRc (!Match) ShowDesktopIconify
  • I TestRc (!Match) Beep
    AddToFunc ShowDesktopDeiconify
  • I All Reverse UseStack (CurrentPage, State 0) Iconify
    AddToFunc ShowDesktopIconify
  • I All UseStack (CurrentPage, Iconifiable, !Iconic) State 0 True
  • I All UseStack (CurrentPage, Iconifiable, !Iconic) Iconify
    AddToFunc State0False
  • I All (CurrentPage) State 0 False
    #Ctrl+Alt+D – show desktop/restore
    Key D A CM ShowDesktop