########################################################################
#             _____________________________                        
#            / ___________________________/ 
#           / /_   ___      ______ ___
#          / __/| / / | /| / / __ `__ \   ___
#         / / | |/ /| |/ |/ / / / / / /  /__/
#        /_/  |___/ |__/|__/_/ /_/ /_/ 
#
#       _   ___        __    __       __              __    
#      / | / (_)____ _/ /_  / /______/ /_  ____ _____/ /___ 
#     /  |/ / // __ `/ __ \/ __/ ___/ __ \/ __ `/ __  // _ \
#    / /|  / // /_/ / / / / /_(__  ) / / / /_/ / /_/ //  __/
#   /_/ |_/_/ \__, /_/ /_/\__/____/_/ /_/\__,_/\__,_/ \___/ 
#            /____/                                         
#
#
# Fvwm Nightshade Configuration
InfoStoreAdd ns_version 0.8~beta2.5
# Copyright (C) 2012 - 2016
#
# Authors:
#   Thomas Funk <t.funk@web.de>
#   Bernhard Popp <kermit.popp@googlemail.com>
#
# Thanks to (in no specific order):
#   Thomas Adam, Tavis Ormandy, Aelsi, Scientific, unambiguous, Kermit
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or 
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but 
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
########################################################################
#
# Introductions:
# 
# There are many comments, but a good reading of the fvwm FAQ, of the man
# pages of fvwm and its modules is suggested/recommended.
#
########################################################################
#
# Overview:
#
# 1. GLOBAL SETTINGS
#    1.1 Paths, Variables (SetEnv, InfoStore)
#        1.2.1 Paths and directories
#        1.2.2 Environment settings
#        1.2.3 Default applications
#        1.2.3 Others
#    1.3 Miscellaneous (BugOpts)
# 2. GLOBAL LOOK
#    2.1 Cursors
#    2.2 Fonts
#    2.3 Colorsets
#    2.4 Windows Decorations
#        2.4.1 General
#        2.4.2 Icons
#        2.4.3 Applications
#    2.5 Theme related decorations
# 3. GLOBAL FEEL
#    3.1 General
#    3.2 Windows
# 4. APPLCATIONS LOOK
#    4.1 Windows Decorations
#        4.1.1 General
#        4.1.2 Icons
#    4.2 Menus
#        4.2.1 WinOps menu
# 5. APPLICATIONS FEEL
#    5.1 General
#    5.2 Applications
# 6. BINDINGS
#    6.1 Mouse
#        6.1.1. Pointer in Root or anywhere
#        6.1.2. Pointer in Window Buttons
#        6.1.3. Pointer in Window Decorations
#        6.1.4. Pointer in Icons
#        6.1.5. Pointer in Window (and in Icon for consistency)
#    6.2 Keyboard
#        6.2.1 ALT + Key
#        6.2.2 ALT-SHIFT + Key
#        6.2.3 ALT-CTRL-SHIFT
#        6.2.4 CTRL + Key
#        6.2.5 CTRL-ALT + Key
#        6.2.6 SHIFT-CTRL + Key
#    6.3 Strokes
# 7. MODULES
#    7.1 FvwmAnimate
#    7.2 FvwmBacker
#    7.3 FvwmBanner
#    7.4 FvwmEvent
#        7.4.1 Common FvwmEvents
#        7.4.2 Sound FvwmEvents
#    7.5 FvwmForm
#        7.5.1 RunCommand
#        7.5.2 About box
#        7.5.2 Message box
#        7.5.2 Show Colorset
#    7.6 FvwmIdent
#    7.7 FvwmScript
#     7.8 FvwmTransSet
#    7.9 Others
# 8. FUNCTIONS
#    8.1 Startup
#        8.1.1 Start
#        8.1.2 Session
#    8.2 General
#    8.3 Window/Icon
#    8.4 Menus
# 9. MENUS
#    9.1 Root menu
#    9.2 Help menu
#    9.3 Modules and Applets menus
#    9.4 Configuration menu
#    9.5 Fvwm Quit menu
#    9.6 Window Ops menus
#
########################################################################


########################################################################
#                 1. G L O B A L  S E T T I N G S 
########################################################################

#=======================================================================
# 1.1 Paths, Variables (SetEnv, InfoStore)
#=======================================================================

#-----------------------------------------------------------------------
# Set shell for Exec command
#-----------------------------------------------------------------------
ExecUseShell /bin/bash


#***********************************************************************
# 1.2.1 Paths and directories
#***********************************************************************
#-----------------------------------------------------------------------
# ModulePath is builtin, you may add some directories here
#
# IMPORTANT: if you decide to set a ModulePath, please note that modules
# are normally installed into a version-dependent directory.  Be sure to
# update this file after installing a new version.
#-----------------------------------------------------------------------
ModulePath $[FVWM_USERDIR]/lib:$[FNS_SYSTEMDIR]/lib:+

#-----------------------------------------------------------------------
# LocalePath specifies a colon separated list of "locale path" in which
# to search for string translations. A locale path is constituted by a
# directory path and a text domain separated by a semicolon (';').
#-----------------------------------------------------------------------
LocalePath $[FVWM_USERDIR]/locale;fvwm-nightshade:;fvwm-nightshade:+

#-----------------------------------------------------------------------
# The default ImagePath for icons is: 
# /usr/include/X11/bitmap:/usr/include/X11/pixmaps
#
# If the fvwm_icons are not installed in one of these directories or if
# you want to add a personal image put them here
#-----------------------------------------------------------------------
ImagePath $[FVWM_USERDIR]/artwork/icons:$[FVWM_USERDIR]/artwork/icons/scalable:+
ImagePath +:$[FNS_SYSTEMDIR]/artwork/icons:$[FNS_SYSTEMDIR]/artwork/icons/scalable
ImagePath +:/usr/share/pixmaps:/usr/share/pixmaps/fvwm

#-----------------------------------------------------------------------
# FnsSoundPath is a Fvwm-Nightshade builtin, you may add some directories here.
# You can search for sounds over 'fns-find-file [file name]' which returns
# the full path of the specified sound file (if available).
# The predefine sound search paths are:
# $[FVWM_USERDIR]/artwork/sounds:$[FNS_SYSTEMDIR]/artwork/sounds
#-----------------------------------------------------------------------
FnsSoundPath +:/usr/share/sounds

#-----------------------------------------------------------------------
# actual wallpaper
#-----------------------------------------------------------------------
InfoStoreAdd fvwm_wallpaper $[FVWM_USERDIR]/.wallpaper


#***********************************************************************
# 1.2.2 Environment settings
#***********************************************************************
# These settings are rolled out to $[FVWM_USERDIR]/.settings
# They can configured with the FNS-BaseSetup
Load .settings
FuncSetThemeDir $[infostore.used_theme]

#-----------------------------------------------------------------------
# State of pcmanfm
#-----------------------------------------------------------------------
PipeRead 'if [ -z `pidof pcmanfm` ]; then echo SetEnv PcmanFmStatus 0 ;fi'


#***********************************************************************
# 1.2.3 Others
#***********************************************************************

#-----------------------------------------------------------------------
# Adjust ratio to calculate resolution dependant things
#-----------------------------------------------------------------------
PipeRead "echo InfoStoreAdd aspect_ratio `perl -e 'printf \"%.2f\",$[vp.width]/$[vp.height]'`"

# find the smallest resolution depending on the aspect ratio
PipeRead `perl -e 'if ($[infostore.aspect_ratio] > 2.0) { \
                         print "InfoStoreAdd ref_width 800\\n"; \
                         print "InfoStoreAdd ref_height 384\\n"; \
                   } elsif ($[infostore.aspect_ratio] > 1.6) { \
                         print "InfoStoreAdd ref_width 960\\n"; \
                         print "InfoStoreAdd ref_height 540\\n"; \
                   } elsif ($[infostore.aspect_ratio] > 1.4) { \
                         print "InfoStoreAdd ref_width 960\\n"; \
                         print "InfoStoreAdd ref_height 640\\n"; \
                   } else { \
                         print "InfoStoreAdd ref_width 800\\n"; \
                         print "InfoStoreAdd ref_height 600\\n"; \
                   }'`


#InfoStoreAdd ratio 1.1
PipeRead "echo InfoStoreAdd ratio `perl -e 'printf \"%.2f\",log($[vp.width]*$[vp.height])/log(10)-log($[infostore.ref_width]*$[infostore.ref_height])/log(10)+1'`"

#InfoStoreAdd hratio 0.8
PipeRead "echo InfoStoreAdd hratio `perl -e 'printf \"%.2f\",($[vp.height]/540)'`"

#InfoStoreAdd wratio 2
PipeRead "echo InfoStoreAdd wratio `perl -e 'printf \"%.2f\",($[vp.width]/800)'`"



#=======================================================================
# 1.3 Miscellaneous
#=======================================================================
# This commands controls several workarounds for bugs in third party
# programs

#-----------------------------------------------------------------------
# Disables ConfigureNotify events that are usually sent to an application
# while it is moved. If some windows flicker annoyingly while being moved,
# this option may help
#-----------------------------------------------------------------------
BugOpts FlickeringMoveWorkaround True

#-----------------------------------------------------------------------
# Enabling this option might help for Qt applications using DragnDrop.
# Surpresses the forwarding of unknown ClientEvent messages to windows
# -- usually this is harmless, but Qt has problems handling unrecognised
# ClientEvent messages.
#-----------------------------------------------------------------------
#BugOpts QtDragnDropWorkaround True


########################################################################
#                  2. G L O B A L  L O O K 
########################################################################
# Cursors, default fonts, Windows Decoration and Menu Styles
########################################################################

#=======================================================================
# 2.1 Cursors
#=======================================================================
CursorStyle ROOT            left_ptr                black    white
CursorStyle TITLE           top_left_arrow          black    white
CursorStyle DEFAULT         top_left_arrow          black    white
CursorStyle SYS             hand2                   black    white
CursorStyle MENU            top_left_arrow          black    white
CursorStyle POSITION        top_left_corner         black    white
CursorStyle MOVE            fleur                   black    white
CursorStyle RESIZE          sizing                  black    white
CursorStyle WAIT            watch                   black    white
CursorStyle SELECT          crosshair               black    white
CursorStyle DESTROY         pirate                  black    white
CursorStyle TOP             top_side                black    white
CursorStyle RIGHT           right_side              black    white
CursorStyle BOTTOM          bottom_side             black    white
CursorStyle LEFT            left_side               black    white
CursorStyle TOP_LEFT        top_left_corner         black    white
CursorStyle TOP_RIGHT       top_right_corner        black    white
CursorStyle BOTTOM_LEFT     bottom_left_corner      black    white
CursorStyle BOTTOM_RIGHT    bottom_right_corner     black    white
CursorStyle TOP_EDGE        top_side                black    white
CursorStyle RIGHT_EDGE      right_side              black    white
CursorStyle BOTTOM_EDGE     bottom_side             black    white
CursorStyle LEFT_EDGE       left_side               black    white
CursorStyle STROKE          plus                    black    white


#=======================================================================
# 2.2 Fonts
#=======================================================================

# For window titles, another for icons, and another for the menus
Style * Font "xft:$[infostore.used_font]:pixelsize=$[infostore.fontsize]"

Style * IconFont "xft:monospace:pixelsize=$[infostore.fontsize]:Medium"


#=======================================================================
# 2.3 Colorsets (based on Fvwm-Themes)
#=======================================================================
# You will find all colorsets in the theme specific file:
#-----------------------------------------------------------------------
Load $[FNS_THEMEDIR]/colorsets


#=======================================================================
# 2.4 Window Decorations
#=======================================================================

#=======================================================================
# 2.5 Theme related decorations
#=======================================================================
# In the decor file there a all decoration stuff needed for the specific
# theme like
# window bar: buttons, titlebar, ...
# Menus: for the Root and WinOps menu style
# mouse bindings for the buttons
#-----------------------------------------------------------------------
Load $[FNS_THEMEDIR]/decor


########################################################################
#                     3. G L O B A L  F E E L 
########################################################################

#=======================================================================
# 3.1 General
#=======================================================================

#-----------------------------------------------------------------------
# Xinerama support
#-----------------------------------------------------------------------
Xinerama on

#-----------------------------------------------------------------------
# Resize and move feedback windows in the center of the screen
#-----------------------------------------------------------------------
Emulate mwm

#-----------------------------------------------------------------------
# How hard it should be to change the desktop viewport by moving the
# mouse over the edge of the screen
#-----------------------------------------------------------------------
EdgeResistance 350

#-----------------------------------------------------------------------
# Scrolling complete page when hiting the edge of a page
# EdgeScroll 0 0 disables scrolling
#-----------------------------------------------------------------------
Test (EnvMatch DesktopScrollOn 1) EdgeScroll 100 100
Test (EnvMatch DesktopScrollOn 0) EdgeScroll 0 0

#-----------------------------------------------------------------------
# In order to enable page scrolling via the mouse, four windows called
# the "pan frames" are placed at the very edge of the screen. 1 gives
# the smallest pan frames, which seem to work best except on some servers.
#-----------------------------------------------------------------------
EdgeThickness 1

#-----------------------------------------------------------------------
# makes fvwm attempt to recognize and respect the mwm decoration hints
# that applications occasionally use
#-----------------------------------------------------------------------
Style * MWMDecor

#-----------------------------------------------------------------------
# makes fvwm shade out operations that mwm would prohibit, but it lets
# you perform the operation anyway
#-----------------------------------------------------------------------
Style * HintOverride

#-----------------------------------------------------------------------
# makes fvwm attempt to recognize and respect the olwm and olvwm hints
# that many older XView and OLIT applications use
#-----------------------------------------------------------------------
Style * OLDecor

#-----------------------------------------------------------------------
# This command controls the cursor during the execution of certain commands
#-----------------------------------------------------------------------
BusyCursor * True

#-----------------------------------------------------------------------
# Specifies the maximum delay in milliseconds between a button press and
# a button release for the Function command to consider the action a
# mouse click. Default is 150 ms
#-----------------------------------------------------------------------
ClickTime 300

#-----------------------------------------------------------------------
# Use EWMH hints and respect EWMH hints which change the window layer.
#-----------------------------------------------------------------------
Style * EWMHUseStackingOrderHints


#=======================================================================
# 3.2 Windows
#=======================================================================

#-----------------------------------------------------------------------
# Never hide the position or size of a window that is usually shown when
# it is moved or resized
#-----------------------------------------------------------------------
HideGeometryWindow Never

#-----------------------------------------------------------------------
# SnapAttraction lets nearby windows snap together, or snap to edges so
# that they are easier to align on your desktop, The default is off.
#-----------------------------------------------------------------------
Style * SnapAttraction 3 All

#-----------------------------------------------------------------------
# shows the content of a window while moving
#-----------------------------------------------------------------------
OpaqueMoveSize 100

#-----------------------------------------------------------------------
# shows the content of a window while resizing
#-----------------------------------------------------------------------
Style * ResizeOpaque

#-----------------------------------------------------------------------
# The WindowShadeSteps option selects the number of steps for animation
# when shading a window with WindowShade.
#-----------------------------------------------------------------------
#Style * WindowShadeSteps 20

#-----------------------------------------------------------------------
# The focus policy. Once you are used to clicking *inside* windows to
# raise them you will not want to lose this feature.
#-----------------------------------------------------------------------
Style * ClickToFocus
Style * MouseFocusClickRaises

#-----------------------------------------------------------------------
# You can use the IgnoreModifiers command to turn individual modifiers 
# off for bindings. Now CapsLock, NumLock and ScrollLock are removed from
# the keyboard map.
# For more infos please read http://fvwm.org/documentation/faq/#5.5
#-----------------------------------------------------------------------
IgnoreModifiers L25

#-----------------------------------------------------------------------
# TileCascadePlacement automatically places new windows in a smart
# location - a location in which they do not overlap any other windows
# on the screen.
#-----------------------------------------------------------------------
Style * TileCascadePlacement

#-----------------------------------------------------------------------
# !UsePPosition instructs fvwm to ignore the PPosition field in window
# geometry hints. Emacs annoyingly sets PPosition to (0,0)!
#-----------------------------------------------------------------------
Style * !UsePPosition

#Style * !FPGrabFocus

#-----------------------------------------------------------------------
# transient windows
#-----------------------------------------------------------------------
# You can do a lot of things with transient windows. However, you may
# want to set transient style by application (in styles).
Style * DecorateTransient

#-----------------------------------------------------------------------
# In *general* it is not a good idea to be able to lower transient window
# under its main window, but why not...
#-----------------------------------------------------------------------
#Style * DontRaiseTransient

#-----------------------------------------------------------------------
# Remove the relief around an iconified apps
#-----------------------------------------------------------------------
Style * IconBackgroundRelief 0


########################################################################
#                4. A P P L I C A T I O N S  L O O K
########################################################################
# If needed put in here all application specific styles. For information
# see style comments in GLOBAL LOOK

#=======================================================================
# 4.1 Windows Decorations
#=======================================================================

#***********************************************************************
# 4.1.1 General
#***********************************************************************
# If any application needs a specific window related style put it here

#-----------------------------------------------------------------------
# All Fvwm* named windows
#-----------------------------------------------------------------------
Style Fvwm* Colorset 0

#-----------------------------------------------------------------------
# FvwmBanner
#-----------------------------------------------------------------------
Style FvwmBanner !Title, !Borders, !Handles
Style FvwmBanner Sticky, StaysOnTop
Style FvwmBanner WindowListSkip, CirculateSkip

#-----------------------------------------------------------------------
# FvwmForm-Messages 
#-----------------------------------------------------------------------
Style FvwmForm-Messages !Title

#-----------------------------------------------------------------------
# FvwmForm-RunCommand 
#-----------------------------------------------------------------------
Style FvwmForm-RunCommand !Title

#-----------------------------------------------------------------------
# FvwmForm-About 
#-----------------------------------------------------------------------
Style FvwmForm-About !Title

#-----------------------------------------------------------------------
# FNS-BaseSetup - should be positioned in the center at initial start
#-----------------------------------------------------------------------
Test (!f $[FVWM_USERDIR]/.settings) Style FNS-BaseSetup PositionPlacement Center


#***********************************************************************
# 4.1.2 Icons
#***********************************************************************
# If a window has no icon associated, then the below will use.
Style Untitled        EWMHMiniIconOverride, Icon question2.svg:48x48, MiniIcon question2.svg:16x16
Style NoClass         UseStyle Untitled
Style NoResource      UseStyle Untitled
Style X*              EWMHMiniIconOverride, Icon x.svg:48x48, MiniIcon x.svg:16x16
Style error           EWMHMiniIconOverride, Icon bomb.svg:48x48, MiniIcon bomb.svg:16x16
Style FvwmIdent       EWMHMiniIconOverride, Icon question.svg:48x48, MiniIcon question.svg:16x16
Style FvwmConsole     EWMHMiniIconOverride, Icon fvwm_footprint.svg:48x48, MiniIcon fvwm_footprint.svg:16x16
Style FvwmForm        EWMHMiniIconOverride, Icon fvwm_footprint.svg:48x48, MiniIcon fvwm_footprint.svg:16x16
Style FvwmScript      EWMHMiniIconOverride, Icon fvwm_footprint.svg:48x48, MiniIcon fvwm_footprint.svg:16x16

#-----------------------------------------------------------------------
# FNS related icons
#-----------------------------------------------------------------------
Style FNS-BaseSetup             EWMHMiniIconOverride, Icon icon_fns.svg:48x48, MiniIcon icon_fns.svg:16x16
Style FNS-WindowsBehaviour      EWMHMiniIconOverride, Icon WinBehaviour.svg:48x48, MiniIcon WinBehaviour.svg:16x16
Style FNS-MenuConfigurator      EWMHMiniIconOverride, Icon MenuConfigurator.svg:48x48, MiniIcon MenuConfigurator.svg:16x16
Style FNS-CompConfigurator      EWMHMiniIconOverride, Icon CompConfigurator.svg:48x48, MiniIcon CompConfigurator.svg:16x16
Style FNS-MenuBuilder           EWMHMiniIconOverride, Icon PersonalMenuCreator.svg:48x48, MiniIcon PersonalMenuCreator.svg:16x16
Style FNS-Script-FileBrowser    EWMHMiniIconOverride, Icon filemanager.svg:48x48, MiniIcon filemanager.svg:16x16
Style FNS-CpuPerformance        EWMHMiniIconOverride, Icon cpu.svg:48x48, MiniIcon cpu.svg:16x16
Style FNS-Script-Date           EWMHMiniIconOverride, Icon clock.svg:48x48, MiniIcon clock.svg:16x16
Style Chrono                    EWMHMiniIconOverride, Icon Chrono.svg:48x48, MiniIcon Chrono.svg:16x16
Style Kalende                   EWMHMiniIconOverride, Icon Kalende.svg:48x48, MiniIcon Kalende.svg:16x16


########################################################################
#                5. A P P L I C A T I O N S  F E E L
########################################################################

#=======================================================================
# 5.1 General
#=======================================================================

#-----------------------------------------------------------------------
# makes fvwm attempt to recognize and respect the mwm prohibited
# operations hints that applications occasionally use. But should only
# used for applications with problems because setting this globally will
# break Java programs by respecting MwmLayer.
#-----------------------------------------------------------------------
#Style <app> MWMFunctions


#=======================================================================
# 5.2 Applications
#=======================================================================

#-----------------------------------------------------------------------
# Stalonetray
#-----------------------------------------------------------------------
Style stalonetray EWMHUseStackingOrderHints
Style stalonetray WindowListSkip


########################################################################
#                       6. B I N D I N G S 
########################################################################

#=======================================================================
# 6.1 Mouse
#=======================================================================
# Handle some Mouse bindings now...
# Recall that mouse formats look like this:
#
# +------------+
# | ||  ||  || |
# |            |
# +------------+
#   1   2   3

#-----------------------------------------------------------------------
# Contexts:                                  Desktop
#     R = Root Window                 rrrrrrrrrrrrrrrrrrrrrr
#     W = Application Window          rIrrrrFSSSSSSSSSFrrrrr
#     F = Frame Corners               rrrrrrS13TTTT642Srrrrr
#     S = Frame Sides                 rIrrrrSwwwwwwwwwSrrrrr
#     T = Title Bar                   rrrrrrSwwwwwwwwwSrrrrr
#     I = Icon                        rIrrrrFSSSSSSSSSFrrrrr
#                                     rrrrrrrrrrrrrrrrrrrrrr
# Numbers are buttons: 1 3 5 7 9   0 8 6 4 2
#
# Modifiers: (A)ny, (C)ontrol, (S)hift, (M)eta, (N)othing
#-----------------------------------------------------------------------
# Buttons:
# +----------------------------------------------------------+
# | X  X  X  X  X                              X  X  X  X  X |
# +----------------------------------------------------------+
# | 1  3  5  7  9                              0  8  6  4  2 |
# |                                                          |
#

#***********************************************************************
# 6.1.1. Pointer in Root or anywhere
#***********************************************************************
#     Button    Context Modifi      Function
Mouse 1         R       A           Menu MenuRoot
Mouse 2         R       A           WindowList
Mouse 3         RFT     A           Menu MenuDesktopOps

#-----------------------------------------------------------------------
# Roll mouse wheel anywhere with SHIFT-ALT + cursor left/right for goto page
#-----------------------------------------------------------------------
Mouse 4         A       SC          FuncGotoPage +1p +0p
Mouse 5         A       SC          FuncGotoPage -1p +0p

#-----------------------------------------------------------------------
# Roll mouse wheel anywhere with SHIFT-CTRL + cursor left/right for goto page
# with active window
#-----------------------------------------------------------------------
Mouse 4         A       SM          Current FuncMoveWindowToPage +1p +0p
Mouse 5         A       SM          Current FuncMoveWindowToPage -1p +0p

#-----------------------------------------------------------------------
# Help info with SHIFT-CTRL-ALT in Root
#-----------------------------------------------------------------------
#     Button    Context Modifi     Function
Mouse 0         R       SCM        FuncShowMessage  "Mouse Bindings for Root area" \
"Mouse 1:   Root menu. With icons on desktop use left Win key" \
"Mouse 2:   Window list" \
"Mouse 3:   Desktop Oops menu. With icons on desktop use" \
"           CTRL + left Win key" \
"Mouse 4/5: Switch to page left/right with" \
"           SHIFT-ALT + rolling wheel up/down anywhere" \
"           Switch with window to page left/right with" \
"           SHIFT-CTRL + rolling wheel up/down anywhere" \


#***********************************************************************
# 6.1.2. Pointer in Window Buttons
#***********************************************************************
# Bindings for window buttons in the theme related file
# $[FNS_THEMEDIR]/decor


#***********************************************************************
# 6.1.3. Pointer in Window Decorations
#***********************************************************************
#     Button    Context Modifi      Function

#-----------------------------------------------------------------------
# Button 1 in the titlebar, with any modifiers, gives
# move <- drag, resize <- click or maximize <- double click
#-----------------------------------------------------------------------
Mouse 1         T       A           FuncMoveOrRaiseOrMaximize
#-----------------------------------------------------------------------
# Button 1 in the corners or sides, with any modifiers, gives
# resize <- drag, raise <- click or maximize <- double click
#-----------------------------------------------------------------------
Mouse 1         SF      A           FuncResizeOrRaiseOrMaximize
#-----------------------------------------------------------------------
# Button 2 in the titlebar, corners or sides, with any modifiers, gives
# move <- drag, raise/lower <- click
#-----------------------------------------------------------------------
Mouse 2         TSF     A           FuncMoveOrRaiseLower
#-----------------------------------------------------------------------
# Button 2 in the window, with ALT key, gives
# move <- drag, raise/lower <- click
#-----------------------------------------------------------------------
Mouse 2         W       M           FuncMoveOrRaiseLower
#-----------------------------------------------------------------------
# Button 3 in the titlebar, corners or sides, with any modifiers, gives
# WindowOps2 menu <- click, with ALT key WindowOps menu <- click
#-----------------------------------------------------------------------
Mouse 3         TSF     A           Menu MenuWindowOpsTrimmed
Mouse 3         TSF     M           Menu MenuWindowOpsFull
#-----------------------------------------------------------------------
# Roll mouse wheel on Titlebars to shade/unshade
#-----------------------------------------------------------------------
Mouse 4         T       A           FuncWheelToggleShade True
Mouse 5         T       A           FuncWheelToggleShade False


#-----------------------------------------------------------------------
# Help info with SHIFT-CTRL-ALT to Pointer in Window Decorations
#-----------------------------------------------------------------------
#     Button    Context Modifi      Function
Mouse 0         T       SCM         FuncShowMessage  "Mouse Bindings for Titlebar" \
"Mouse 1:   Drag moves window" \
"           Maximize on double click" \
"Mouse 2:   Drag moves window" \
"           Raise or lower with click" \
"Mouse 3:   WindowOpsTrimmed menu with click" \
"           WindowOpsFull menu with ALT + click" \
"Mouse 4/5: Shade/unshade window" \
"           with rolling wheel up/down"

Mouse 0         SF      SCM         FuncShowMessage  "Mouse Bindings for Corners and Sides" \
"Mouse 1:   Drag resize window" \
"           Maximize on double click" \
"Mouse 2:   Drag moves window" \
"           Raise or lower with click" \
"Mouse 3:   WindowOpsTrimmed menu with click" \
"           WindowOpsFull menu with ALT + click"

Mouse 0         W       SCM         FuncShowMessage  "Mouse Bindings for Window area" \
"Mouse 1:   Root menu with ALT + click" \
"Mouse 2:   Drag + ALT moves window" \
"           Raise or lower with ALT + click" \
"Mouse 4/5: Switch to page left/right with" \
"           SHIFT-CTRL + rolling wheel up/down anywhere" \
"           Switch with window to page left/right with" \
"           SHIFT-ALT + rolling wheel up/down anywhere" \


#***********************************************************************
# 6.1.4. Pointer in Icons
#***********************************************************************
#     Button    Context Modifi     Function

#-----------------------------------------------------------------------
# Button 1 in icon, with any modifiers, gives
# move <- drag, deiconify <- double click
#-----------------------------------------------------------------------
Mouse 1         I       A          FuncMoveOrIconify
#-----------------------------------------------------------------------
# Button 2 in icon, with any modifiers, gives
# deiconify <- click
#-----------------------------------------------------------------------
Mouse 2         I       A           FuncIconify
#-----------------------------------------------------------------------
# Button 2 in icon, with CTRL key, gives
# deiconify all icons from the same resource group <- click
#-----------------------------------------------------------------------
Mouse 2         I       C           FuncIconifySameResource toggle
#-----------------------------------------------------------------------
# Button 3 in icon, with any modifiers, gives
# WindowOps2 menu <- click
#-----------------------------------------------------------------------
Mouse 3         I       A           Menu MenuWindowOpsTrimmed
#-----------------------------------------------------------------------
# Button 3 in icon, with CTRL key, gives
# WindowGroupOps menu
#-----------------------------------------------------------------------
Mouse 3         I       C           Menu MenuWindowGroupOps


#-----------------------------------------------------------------------
# Help info with SHIFT-CTRL-ALT to Pointer in Icons
#-----------------------------------------------------------------------
#     Button    Context Modifi      Function
Mouse 0         I       SCM         FuncShowMessage  "Mouse Bindings for Icons" \
"Mouse 1:   Drag moves icon" \
"           Deiconify with double click" \
"           Root menu with ALT + click" \
"Mouse 2:   Deiconify icon with click" \
"           All of same resource group with CTRL + click" \
"Mouse 3:   WindowOpsTrimmed menu with click" \
"           WindowGroupOps menu with CTRL + click"


#***********************************************************************
# 6.1.5. Pointer in Window (and in Icon for consistency)
#***********************************************************************
#     Button    Context Modifi      Function
Mouse 1         WI      M           Menu MenuRoot


#=======================================================================
# 6.2 Keyboard
#=======================================================================
# All keyboard bindings are located in $FNS_SYSTEMDIR/.bindings or
# $FVWM_USERDIR/.bindings
Load .bindings


#=======================================================================
# 6.3 Strokes
#=======================================================================
# You need fvwm compiled with stroke support and libstroke installed
# See the Stroke and StrokeFunc entries in the fvwm man page
# We use mostly simple stroke motion. For complex stroke motions we need
# to consider many sloppy stroke motions for each action.

#-----------------------------------------------------------------------
#STROKE 2
#-----------------------------------------------------------------------
#     Button    Context Modifi      Function
#Mouse    3    R    N    StrokeFunc FeedBack DrawMotion
#Mouse    3     W     M     StrokeFunc FeedBack DrawMotion

#-----------------------------------------------------------------------
#STROKE 2 We need to redefine the default bindings
#-----------------------------------------------------------------------
#Stroke    0    0     RN     WindowList mouse -1p -1p
#Stroke    0    0    WM    WindowList mouse -1p -1p

#-----------------------------------------------------------------------
#PREF 11
#STROKE 2 A | from the top to the bottom
#-----------------------------------------------------------------------
#Stroke    N852    0    RN    Exec exec xterm
#Stroke    N852    0    WM       Exec exec xterm

#-----------------------------------------------------------------------
#STROKE 2 A | from the bottom to the top
#-----------------------------------------------------------------------
#Stroke    N258    0    RN    Exec exec emacs
#Stroke    N258    0    WM    Exec exec emacs

#-----------------------------------------------------------------------
#STROKE 2 A / from the bottom to the top
#-----------------------------------------------------------------------
#Stroke    N159    0    RN    Exec exec xfm
#Stroke    N159    0    WM    Exec exec xfm

#-----------------------------------------------------------------------
#STROKE 2 A C from the top
#-----------------------------------------------------------------------
#Stroke    N9874123 0    RN    Exec exec xcalc
#Stroke    N9874123 0    WM    Exec exec xcalc

#-----------------------------------------------------------------------
#STROKE 11 A N (from the bottom)
#-----------------------------------------------------------------------
#Stroke    7415963     0    RN    Exec exec mozilla
#Stroke    74148963 0    RN    Exec exec mozilla
#Stroke    74158963 0    RN    Exec exec mozilla
#Stroke    7418963     0    RN    Exec exec mozilla
#Stroke    415963     0    RN    Exec exec mozilla
#
#Stroke    7415963     0    WM    Exec exec mozilla
#Stroke    74148963 0    WM    Exec exec mozilla
#Stroke    74158963 0    WM    Exec exec mozilla
#Stroke    7418963     0    WM    Exec exec mozilla
#Stroke    415963     0    WM    Exec exec mozilla

#-----------------------------------------------------------------------
#STROKE 4 A clockwise box from the top left
#-----------------------------------------------------------------------
#Stroke    N78963214  0    RN    FvwmForm FvwmForm-QuitVerify
#Stroke    N789632147 0    RN    FvwmForm FvwmForm-QuitVerify
#Stroke    N78963214  0    WM    FvwmForm FvwmForm-QuitVerify
#Stroke    N789632147 0    WM    FvwmForm FvwmForm-QuitVerify



########################################################################
#                         7. M O D U L E S 
########################################################################
# Definitions used by Fvwm modules.
# (Alphabetic order is used, but the Form are at the end)

#=======================================================================
# 7.1 FvwmAnimate
#=======================================================================
DestroyModuleConfig FvwmAnimate: *

*FvwmAnimate: Color #6e6e6e
*FvwmAnimate: Effect twist
*FvwmAnimate: Delay 3
*FvwmAnimate: Iterations 50
*FvwmAnimate: Width 5

#=======================================================================
# 7.2 FvwmBacker
#=======================================================================
DestroyModuleConfig FvwmBacker: *
*FvwmBacker: Command(Desk 0, Page * *) Colorset 24

#=======================================================================
# 7.3 FvwmBanner
#=======================================================================
DestroyModuleConfig FvwmBanner: *
*FvwmBanner: NoDecor
*FvwmBanner: Pixmap $[infostore.used_banner]
*FvwmBanner: Timeout 3

#=======================================================================
# 7.4 FvwmEvent
#=======================================================================

#***********************************************************************
# 7.4.1 Common FvwmEvents
#***********************************************************************
DestroyModuleConfig FvwmEventCommon: *
*FvwmEventCommon: deiconify    FuncDeThumbnail

#***********************************************************************
# 7.4.2 Sound FvwmEvents
#***********************************************************************
DestroyModuleConfig FvwmEventSound: *

# replace rplay by a sound player that can play .au sound file
#*FvwmEvent: Cmd "Exec exec rplay "

*FvwmEventSound: StartDelay 3
*FvwmEventSound: Delay 1

#*FvwmEventSound: startup          "/usr/share/sounds/gong.au"
#*FvwmEventSound: add_window       "/usr/share/sounds/wipe.au"
#*FvwmEventSound: destroy_window   "/usr/share/sounds/pook.au"
#*FvwmEventSound: iconify          "/usr/share/sounds/clong.au"
#*FvwmEventSound: deiconify        "/usr/share/sounds/clong.au"
#*FvwmEventSound: windowshade      "/usr/share/sounds/slide.au"
#*FvwmEventSound: dewindowshade    "/usr/share/sounds/slide.au"
#*FvwmEventSound: new_page         "/usr/share/sounds/slide.au"


#=======================================================================
# 7.5 FvwmForm
#=======================================================================

#***********************************************************************
# 7.5.1 RunCommand Window
#***********************************************************************
DestroyModuleConfig  FvwmForm-RunCommand: *
*FvwmForm-RunCommand: WarpPointer
*FvwmForm-RunCommand: Font 8x13
*FvwmForm-RunCommand: Title         "$[gt.Run Command]"
*FvwmForm-RunCommand: Line          center
*FvwmForm-RunCommand: Text          "$[gt.Run Command]"
*FvwmForm-RunCommand: Line          left
*FvwmForm-RunCommand: Text          "$[gt.Command:]"
*FvwmForm-RunCommand: Input         Command 30 ""
*FvwmForm-RunCommand: Line          center
*FvwmForm-RunCommand: Selection     cmd multiple
*FvwmForm-RunCommand: Choice        TERM    TERM     off      "$[gt.Run in Terminal]"
*FvwmForm-RunCommand: Line          expand
*FvwmForm-RunCommand: Button        quit "$[gt.Execute]" ^M
*FvwmForm-RunCommand: Command       $(TERM?exec xterm -hold -T "$(Command)" -n "$(Command)" -e $(Command))
*FvwmForm-RunCommand: Command       exec $(Command)
*FvwmForm-RunCommand: Button        quit "$[gt.Cancel]"
*FvwmForm-RunCommand: Command       Nop

#***********************************************************************
# 7.5.2 About box
#***********************************************************************
DestroyModuleConfig FvwmForm-About: *
*FvwmForm-About: WarpPointer
*FvwmForm-About: Title      "$[gt.About]"
*FvwmForm-About: Font       10x20
*FvwmForm-About: Line       center
*FvwmForm-About: Text       "FVWM-Nightshade"
*FvwmForm-About: Font       8x13bold
*FvwmForm-About: Line       center
*FvwmForm-About: Text       "$[gt.Version]: $[infostore.ns_version]"
*FvwmForm-About: Line       center
*FvwmForm-About: Line       center
*FvwmForm-About: Line       center
*FvwmForm-About: Text       "$[gt.Authors]:"
*FvwmForm-About: Font       8x13
*FvwmForm-About: Line       center
*FvwmForm-About: Text       "Thomas Funk <t.funk@web.de>"
*FvwmForm-About: Line       center
*FvwmForm-About: Text       "Bernhard Popp <kermit.popp@googlemail.com>"
*FvwmForm-About: Line       center
*FvwmForm-About: Line       center
*FvwmForm-About: Line       center
*FvwmForm-About: Button     quit " $[gt.Close] " ^M
*FvwmForm-About: Command    Nop
*FvwmForm-About: Line       center

#***********************************************************************
# 7.5.2 Message box
#***********************************************************************
#-----------------------------------------------------------------------
# Shows a FvwmForm Infobox with one or multiple message line(s)
# realized with shell commands over PipeRead
#-----------------------------------------------------------------------
# Example:
# FuncShowMessage "<title>" "<message_1>" ... "<message_n>"
DestroyFunc FuncShowMessage
AddToFunc   FuncShowMessage
+ I PipeRead `echo 'DestroyModuleConfig  FvwmForm-Messages: *' > ${FVWM_USERDIR}/FvwmForm-Messages; \
              echo '*FvwmForm-Messages: Font 8x13' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
              echo '*FvwmForm-Messages: WarpPointer' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
              echo "*FvwmForm-Messages: Title   \\"\\$\[gt.$0\]\\"" >> ${FVWM_USERDIR}/FvwmForm-Messages `
+ I PipeRead `start=0; for i in $*; do \
              if [ "$start" -gt "0" ]; then \
                echo '*FvwmForm-Messages: Line    left' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
                msg=$i; \
                echo "*FvwmForm-Messages: Text  \\"\\$\[gt.$msg\]\\"" >> ${FVWM_USERDIR}/FvwmForm-Messages; \
              fi; \
              start=$(($start+1)); \
              done `
+ I PipeRead `echo '*FvwmForm-Messages: Line   center' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
              echo '*FvwmForm-Messages: Button  quit \"\$\[gt. Ok \]\" ^M' >> ${FVWM_USERDIR}/FvwmForm-Messages; \
              echo '*FvwmForm-Messages: Command !(rm -f ${FVWM_USERDIR}/FvwmForm-Messages)' >> ${FVWM_USERDIR}/FvwmForm-Messages `
+ I Schedule 100 Module FvwmForm FvwmForm-Messages



#=======================================================================
# 7.7 FvwmIdent
#=======================================================================
#  A xwininfo replacement
DestroyModuleConfig FvwmIdent: *
*FvwmIdent: Colorset  21
*FvwmIdent: Font      "xft:$[infostore.used_font]:pixelsize=$[infostore.fontsize]"


#=======================================================================
# 7.7 FvwmScript
#=======================================================================
# Add the third path to search for FvwmScript scripts
DestroyModuleConfig FvwmScript: *
*FvwmScript: Path $[FVWM_USERDIR]/scripts


#=======================================================================
# 7.8 FvwmTransSet
#=======================================================================
# Module to set true transparency to windows if a composite manager is running
DestroyModuleConfig FvwmTransSet: *
*FvwmTransSet: Excludes FvwmButtons, FvwmPager, FvwmIconMan, stalonetray, conky_cpu, conky_clock, Pcmanfm_Daemon, FvwmBanner
*FvwmTransSet: Opacity 1.0
*FvwmTransSet: Transparency 0.8
*FvwmTransSet: UsedTransset $[infostore.default_transset]


#=======================================================================
# 7.9 Others
#=======================================================================
# Other modules will be located in the modules dir


########################################################################
#                         8. F U N C T I O N S 
########################################################################
# "I" stands for Immediate
# "M" stands for Motion
# "C" stands for Click
# "H" stands for Hold
# "D" stands for Double Click

#=======================================================================
# 8.1 Startup
#=======================================================================

#***********************************************************************
# 8.1.1 Start
#***********************************************************************
# The StartFunction is used at start and restart with or without a Session
# Manager.
DestroyFunc StartFunction
AddToFunc StartFunction
#-----------------------------------------------------------------------
# check for apps needed for full config functionality
+ I Test (Init) FuncAppCheck
#-----------------------------------------------------------------------
# show splash sceen
#+ I Test (Init) Test (EnvMatch SplashOn 1) Test (f $[FVWM_USERDIR]/.settings) Module FvwmBanner
#-----------------------------------------------------------------------
# Start pcmanfm as daemon for mounting 
+ I FuncStartMountDaemon
#-----------------------------------------------------------------------
# Start policykit for using pkexec 
+ I FuncStartPolkit
#-----------------------------------------------------------------------
# activate automatical raise of windows
+ I Module FvwmAuto 300
#-----------------------------------------------------------------------
# activate animation module used with iconiy for example
+ I Module FvwmAnimate
#-----------------------------------------------------------------------
# activate module for event actions
+ I Module FvwmEvent FvwmEventCommon
#-----------------------------------------------------------------------
# activate module for sound event actions
#+ I Module FvwmEvent FvwmEventSound
#-----------------------------------------------------------------------
# activate module for smart maximize
+ I Module FvwmSmartMaximize
#-----------------------------------------------------------------------
# start xscreensaver daemon for locking
+ I Test (x xscreensaver-command) Test (Init) Exec xscreensaver -no-splash
#-----------------------------------------------------------------------
# start FNS-BaseSetup if not configured
+ I Test (!f $[FVWM_USERDIR]/.settings) Module FNS-BaseSetup
#-----------------------------------------------------------------------
# start composite manager if it is activated
+ I Test (!EnvMatch use_composite 0) Exec exec $[infostore.comp_command]
#-----------------------------------------------------------------------
# start FvwmTransSet if composite manager is activated
+ I TestRC (Match) FuncStartFvwmTransSet
#-----------------------------------------------------------------------
# show splash sceen
+ I Test (Init) Test (EnvMatch SplashOn 1) Test (f $[FVWM_USERDIR]/.settings) \
    Schedule 500 Exec exec fns-show-banner $[infostore.used_banner] 2

#-----------------------------------------------------------------------
# load layout
#-----------------------------------------------------------------------
+ I Load $[FVWM_USERDIR]/.layout

AddToFunc StartFunction
#-----------------------------------------------------------------------
# start programs found in .autostart
+ I Test (Init) FuncAutoStartPrograms

#***********************************************************************
# 8.1.2 Exit
#***********************************************************************
# The ExitFunction, executed when exiting or restarting before actually
# quitting FVWM.
DestroyFunc ExitFunction
AddToFunc   ExitFunction
# stop FvwmTransSet and save configuration if composite manager is activated
+ I Test (!EnvMatch use_composite 0) FuncStopFvwmTransSet
#-----------------------------------------------------------------------
# stop composite manager if it is activated
+ I Test (!EnvMatch use_composite 0) FuncKillCompmgr


#=======================================================================
# 8.2 General
#=======================================================================

#-----------------------------------------------------------------------
# Change the original behaviour of UrgencyFunc. Now, if a window is 
# closed, the focus won't switch to the next window in the windowlist
#-----------------------------------------------------------------------
DestroyFunc UrgencyFunc
AddToFunc   UrgencyFunc
+ I Iconify off
+ I Raise

#-----------------------------------------------------------------------
# Stop Fvwm modules
#-----------------------------------------------------------------------
DestroyFunc FuncStopModule
AddToFunc   FuncStopModule
+ I KillModule $0

#-----------------------------------------------------------------------
# Stop Fvwm modules by alias
#-----------------------------------------------------------------------
DestroyFunc FuncStopModuleByAlias
AddToFunc   FuncStopModuleByAlias
+ I KillModule $0 $1

#-----------------------------------------------------------------------
# Restart modules
#-----------------------------------------------------------------------
DestroyFunc FuncRestartModule
AddToFunc   FuncRestartModule
+ I FuncStopModule $0
+ I Module $0

#-----------------------------------------------------------------------
# Restart modules by alias
#-----------------------------------------------------------------------
DestroyFunc FuncRestartModuleByAlias
AddToFunc   FuncRestartModuleByAlias
+ I FuncStopModuleByAlias $0 $1
+ I Module $0 $1 $2

#-----------------------------------------------------------------------
# Resets a definition of all colorsets
#-----------------------------------------------------------------------
DestroyFunc FuncResetColorset
AddToFunc   FuncResetColorset
+ I CleanupColorsets

#-----------------------------------------------------------------------
# Kill running composite manager
#-----------------------------------------------------------------------
DestroyFunc FuncKillCompmgr
AddToFunc   FuncKillCompmgr
+ I PipeRead 'if [ ! -z `pidof xcompmgr` ]; then \
                killall xcompmgr; \
            else \
                if [ ! -z `pidof compton` ]; then \
                    killall compton; \
                fi; \
            fi'

#-----------------------------------------------------------------------
# Start mount daemon if not already running - with or without desktop
#-----------------------------------------------------------------------
DestroyFunc FuncStartMountDaemon
AddToFunc   FuncStartMountDaemon
+ I Test (EnvMatch DesktopIconsOn 0) FuncRunPcmanFmWithoutDesktop
+ I TestRc (!Match) FuncRunPcmanFmWithDesktop

#-----------------------------------------------------------------------
# Run pcmanfm as daemon only
#-----------------------------------------------------------------------
DestroyFunc FuncRunPcmanFmWithoutDesktop
AddToFunc   FuncRunPcmanFmWithoutDesktop
+ I Test (EnvMatch PcmanFmStatus 2) Exec exec pcmanfm --desktop-off
+ I Test (EnvMatch PcmanFmStatus 0) Exec exec pcmanfm -d --class Pcmanfm_Daemon
+ I FuncSetWallpaper
+ I Test (!EnvMatch PcmanFmStatus 1) FuncWriteSetEnvToFileAndSet PcmanFmStatus 1 $[FVWM_USERDIR]/.settings

#-----------------------------------------------------------------------
# Run pcmanfm as desktop
#-----------------------------------------------------------------------
DestroyFunc FuncRunPcmanFmWithDesktop
AddToFunc   FuncRunPcmanFmWithDesktop
+ I Test (EnvMatch PcmanFmStatus 2) PipeRead 'nohup nice pcmanfm --desktop-off >>/dev/null 2>>/dev/null\\&; \
                                              nohup nice pcmanfm --desktop >>/dev/null 2>>/dev/null'
+ I Test (EnvMatch PcmanFmStatus 1) Exec exec pcmanfm --desktop
+ I Test (EnvMatch PcmanFmStatus 0) Exec exec pcmanfm -d --desktop --class Pcmanfm_Daemon
+ I Test (!EnvMatch PcmanFmStatus 2) FuncWriteSetEnvToFileAndSet PcmanFmStatus 2 $[FVWM_USERDIR]/.settings

#-----------------------------------------------------------------------
# Start FvwmTransSet and reread colorset
#-----------------------------------------------------------------------
DestroyFunc FuncStartFvwmTransSet
AddToFunc   FuncStartFvwmTransSet
+ I Module FvwmTransSet
+ I Test (!EnvMatch use_composite 2) SetEnv use_composite 2
+ I Load $[FNS_THEMEDIR]/colorsets

#-----------------------------------------------------------------------
# Stop FvwmTransSet and save current configuration before stopping
#-----------------------------------------------------------------------
DestroyFunc FuncStopFvwmTransSet
AddToFunc   FuncStopFvwmTransSet
+ I SendToModule FvwmTransSet save
+ I SendToModule FvwmTransSet stop
+ I Test (!EnvMatch use_composite 0) SetEnv use_composite 0
+ I Load $[FNS_THEMEDIR]/colorsets

#-----------------------------------------------------------------------
# Remove all buttons for a theme and its bindings
#-----------------------------------------------------------------------
DestroyFunc FuncRemoveAllButtons
AddToFunc   FuncRemoveAllButtons
+ I Style * !Button 1, !Button 3, !Button 5, !Button 7, !Button 9
+ I Style * !Button 2, !Button 4, !Button 6, !Button 8, !Button 0
+ I FuncRemoveAllButtonBindings
+ I ButtonStyle Reset
+ I TitleStyle Height 5

#-----------------------------------------------------------------------
# Remove all key bindings higher than the current desks/pages.
# - key 1-x move current window to page n
# - Go to page n with SHIFT-CTRL + number
#-----------------------------------------------------------------------
DestroyFunc FuncUnsetDeskKeyBindings
AddToFunc   FuncUnsetDeskKeyBindings
+ I PipeRead 'unst=1; \
              max=$(($[infostore.x_desks]*$[infostore.y_desks])); \
              while [ $unst -le $max ]; do \
                  if [ $unst -ne 10 ]; then \
                      echo "Key $unst A SM -"; \
                      echo "Key $unst A SC -"; \
                  else \
                      echo "Key 0 A SM -"; \
                      echo "Key 0 A SC -"; \
                  fi; \
              unst=$(($unst+1)); \
              done'

#-----------------------------------------------------------------------
# Change a decor on the fly
#-----------------------------------------------------------------------
DestroyFunc FuncChangeDecor
AddToFunc   FuncChangeDecor
+ I PipeRead 'echo InfoStoreAdd used_theme $0'
+ I FuncSetThemeDir $[infostore.used_theme]
+ I FuncRemoveAllButtons
+ I Load $[FNS_THEMEDIR]/colorsets
+ I Load $[FNS_THEMEDIR]/decor
+ I FuncWriteInfoStoreToFileAndSet used_theme $0 $[FVWM_USERDIR]/.settings
+ I ReloadLayoutParts $[infostore.used_layout]


#-----------------------------------------------------------------------
# Change a Layout on the fly
#-----------------------------------------------------------------------
DestroyFunc FuncChangeLayout
AddToFunc   FuncChangeLayout
+ I PipeRead "rm -f ${FVWM_USERDIR}/.layout; \
              ln -s $0/layouts/$1 ${FVWM_USERDIR}/.layout"
+ I FuncWriteInfoStoreToFileAndSet used_layout $1 $[FVWM_USERDIR]/.settings
+ I FuncRestart


#-----------------------------------------------------------------------
# Update/Create an InfoStore variable in a file
# FuncWriteInfoStoreToFile <var_name> <var_value> <file>
#-----------------------------------------------------------------------
DestroyFunc FuncWriteInfoStoreToFileAndSet
AddToFunc   FuncWriteInfoStoreToFileAndSet
+ I PipeRead 'Val=`echo "$1" | sed "s/[[:blank:]]*$//"`; \
            if [ `grep -c $0 $2` -gt 0 ] ; then \
                sed -i --follow-symlinks "s#^InfoStoreAdd $0.*#InfoStoreAdd $0 \\"$Val\\"#" $2; \
            else \
                sed -i --follow-symlinks "$ a\InfoStoreAdd $0 \\"$Val\\"" $2; \
            fi; \
            Val=`echo "$Val" | sed "s/ /\\\\\\\\\\ /g"`; \
            echo InfoStoreAdd $0 "$Val"'


#-----------------------------------------------------------------------
# Update/Create an SetEnv variable in a file
# FuncWriteSetEnvToFile <var_name> <var_value> <file>
#-----------------------------------------------------------------------
DestroyFunc FuncWriteSetEnvToFileAndSet
AddToFunc   FuncWriteSetEnvToFileAndSet
+ I PipeRead 'Val=`echo "$1" | sed "s/[[:blank:]]*$//"`; \
            if [ `grep -c $0 $2` -gt 0 ] ; then \
                sed -i --follow-symlinks "s#^SetEnv $0.*#SetEnv $0 \\"$Val\\"#" $2; \
            else \
                sed -i --follow-symlinks "$ a\SetEnv $0 \\"$Val\\"" $2; \
            fi; \
            Val=`echo "$Val" | sed "s/ /\\\\\\\\\\ /g"`; \
            echo SetEnv $0 "$Val"'

#-----------------------------------------------------------------------
# Update window opacity
#-----------------------------------------------------------------------
DestroyFunc FuncUpdateWindowOpacity
AddToFunc   FuncUpdateWindowOpacity
+ I PipeRead "echo SendToModule FvwmTransSet opac `perl -e 'printf \"%.1f\",($0/100)'`"
+ I PipeRead "echo SendToModule FvwmTransSet save"
+ I FuncWriteInfoStoreToFileAndSet used_windowopacity $0 $[FVWM_USERDIR]/.settings

#-----------------------------------------------------------------------
# Update window transparency
#-----------------------------------------------------------------------
DestroyFunc FuncUpdateWindowTransparency
AddToFunc   FuncUpdateWindowTransparency
+ I PipeRead "echo SendToModule FvwmTransSet trans `perl -e 'printf \"%.1f\",($0/100)'`"
+ I PipeRead "echo SendToModule FvwmTransSet save"
+ I FuncWriteInfoStoreToFileAndSet used_windowtransparency $0 $[FVWM_USERDIR]/.settings

#-----------------------------------------------------------------------
# Update menu tint value in .settings
#-----------------------------------------------------------------------
DestroyFunc FuncUpdateMenuTint
AddToFunc   FuncUpdateMenuTint
+ I FuncWriteInfoStoreToFileAndSet used_menutint $0 $[FVWM_USERDIR]/.settings
+ I Load $[FNS_THEMEDIR]/colorsets

#-----------------------------------------------------------------------
# Check which appliction are installed to get full functionality
# print a message in .xsession-errors if check for app failed
#-----------------------------------------------------------------------
DestroyFunc FuncAppCheck
AddToFunc   FuncAppCheck
# xterm
+ I Test (!x xterm) FuncPrintMsg "AppCheck" "xterm (view, edit) not installed"
# clock, cpu
+ I Test (!x conky) FuncPrintMsg "AppCheck" "conky (clock, cpu) not installed"
# default terminal
+ I Test (!x $[infostore.default_terminal]) FuncPrintMsg "AppCheck" "default terminal $[infostore.default_terminal] not installed"
# default browser
+ I Test (!x $[infostore.default_browser]) FuncPrintMsg "AppCheck" "default browser $[infostore.default_browser] not installed"
# xscreensaver
+ I Test (!x xscreensaver-command) FuncPrintMsg "AppCheck" "xscreensaver (lock) not installed"
# feh
+ I Test (!x feh) FuncPrintMsg "AppCheck" "feh (for background) not installed"
# import in package imagemagick
+ I Test (!x import) FuncPrintMsg "AppCheck" "imagemagick (import for screenshot, thumbs) not installed"
# xwd
+ I Test (!x xwd) FuncPrintMsg "AppCheck" "xwd (for thumbnailing) not installed"
# stalonetray
+ I Test (!x stalonetray) FuncPrintMsg "AppCheck" "stalonetray (systray) not installed"
# systray app volumeicon
+ I Test (!x volumeicon) FuncPrintMsg "AppCheck" "volumeicon (systray volume control) not installed"
# systray app nm-applet
+ I Test (!x nm-applet) FuncPrintMsg "AppCheck" "nm-applet (systray network control) not installed"
# systray app bluetooth-applet
+ I Test (!x blueman-applet) FuncPrintMsg "AppCheck" "bluetooth-applet (systray blueman) not installed"
# systray clipboard 1 (main)
+ I Test (!x clipit) FuncPrintMsg "AppCheck" "clipit (clipboard) not installed"
# systray clipboard 2 (for gentoo)
+ I TestRc (Match) Test (!x parcellite) FuncPrintMsg "AppCheck" "parcellite (clipboard) not installed"
# systray battery app 1 (main)
+ I Test (!x fdpowermon) FuncPrintMsg "AppCheck" "fdpowermon (systray pm control) not installed"
# systray battery app 2 (for Arch)
+ I TestRc (Match) Test (!x cbatticon) FuncPrintMsg "AppCheck" "cbatticon (systray pm control) not installed"
# Mount daemon pcmanfm
+ I Test (!x pcmanfm) FuncPrintMsg "AppCheck" "pcmanfm (mounting) not installed"
# policy kit agent
+ I FuncCheck4Polkit

#-----------------------------------------------------------------------
# Starts policykit for pkexec use
#-----------------------------------------------------------------------
DestroyFunc FuncStartPolkit
AddToFunc   FuncStartPolkit
+ I PipeRead 'echo SetEnv polkit `find /usr/lib* -name polkit-gnome-authentication-agent-1 2> /dev/null`'
+ I Test (EnvIsSet polkit) PipeRead 'if [ -z `pidof polkit-gnome-authentication-agent-1` ]; then \
                                        echo SetEnv notRun 1; \
                                    fi'
+ I Test (EnvIsSet notRun) Exec exec $[polkit]
+ I UnsetEnv notRun

#-----------------------------------------------------------------------
# Check for policykit and set path
#-----------------------------------------------------------------------
DestroyFunc FuncCheck4Polkit
AddToFunc   FuncCheck4Polkit
+ I PipeRead 'echo SetEnv polkit `find /usr/lib* -name polkit-gnome-authentication-agent-1 2> /dev/null`'
+ I Test (!x $[polkit]) FuncPrintMsg "AppCheck" "polkit-gnome (pkexec) not installed"

#-----------------------------------------------------------------------
# Starts system tray applets like network, sound, etc
#-----------------------------------------------------------------------
DestroyFunc FuncStartSystrayApplets
AddToFunc   FuncStartSystrayApplets
+ I PipeRead 'echo SetEnv systray_started `ps -e |grep -c stalonetray`'
+ I Test (EnvMatch systray_started 0 ) break
# volume
+ I Test (x volumeicon) exec exec volumeicon
# battery
+ I Test (x fdpowermon) exec exec fdpowermon
# network
+ I Test (x nm-applet) exec exec nm-applet
# bluetooth
+ I Test (x blueman-applet) exec exec blueman-applet
# clipboard
+ I Test (x clipit) exec exec clipit
+ I TestRc (!Match) Test (x parcellite) exec exec parcellite

#-----------------------------------------------------------------------
# Starts programs while startup
#-----------------------------------------------------------------------
DestroyFunc FuncAutoStartPrograms
AddToFunc   FuncAutoStartPrograms
+ I Test (f $[FVWM_USERDIR]/.autostart) \
    Exec exec fns-start-programs Autostart $[FVWM_USERDIR]/.autostart

#-----------------------------------------------------------------------
# Starts a FvwmConsole
#-----------------------------------------------------------------------
DestroyFunc FuncFvwmConsole
AddToFunc   FuncFvwmConsole
+ I Module FvwmConsole -terminal xterm -fg $[fg.cs22] -bg $[bg.cs22] $*

#-----------------------------------------------------------------------
# Starts a xterm to run something in it
#-----------------------------------------------------------------------
DestroyFunc FuncRunInXterm
AddToFunc   FuncRunInXterm
+ I exec xterm $3 -fg black -bg snow2 -g 80x40 -fn 7x14 -fb 7x14bold \
                +sb -ut -T "$0" -n "$0" -e $1

#-----------------------------------------------------------------------
# starts a xterm to view a file
#-----------------------------------------------------------------------
DestroyFunc FuncViewFile
AddToFunc   FuncViewFile
+ I Exec exec xterm -fg $[fg.cs28] -bg $[bg.cs28] -g 80x24 -fn 7x14 -fb 7x14bold \
                    -n "File Viewer - $0" -T "File Viewer - $0" -e less -e "$0"

#-----------------------------------------------------------------------
# Edit a file
#-----------------------------------------------------------------------
DestroyFunc FuncFvwmEditFile
AddToFunc   FuncFvwmEditFile
+ I Test (EnvIsSet EDITOR) FuncRunInXterm 'Edit File - $0' '$ENV[EDITOR] "$0"'
+ I TestRc (!Match) FuncRunInXterm 'Edit File - $0' 'vi "$0"'

#-----------------------------------------------------------------------
# starts a xterm to tail some a log or so
#-----------------------------------------------------------------------
DestroyFunc FuncViewFileTail
AddToFunc   FuncViewFileTail
+ I Exec exec xterm -fg $[fg.cs27] -bg $[bg.cs27] -g 80x40 -fn 7x14 -fb 7x14bold \
                    -n "Tail File - $0" -T "Tail File - $0" -e less +F -f "$1"

#-----------------------------------------------------------------------
# Creates a screenshot from the actual window
#-----------------------------------------------------------------------
DestroyFunc FuncWindowCreateScreenshot
AddToFunc   FuncWindowCreateScreenshot
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/screenshots" && mkdir "${FVWM_USERDIR}/screenshots"'
+ I PipeRead 'echo InfoStoreAdd picpath "$[FVWM_USERDIR]/screenshots/screenshot-`date +%F-%H%M%S`.$[w.id].png"'
+ I Test (x import) ThisWindow (!Shaded, !Iconic, Iconifiable) \
                  PipeRead 'import -frame -window $[w.id] $[infostore.picpath]'
+ I TestRc (Match)  FuncShowMessage "\$\[gt.Screenshot Info for window\] $[w.id]" \
                                    "\$\[gt.Screenshot created:\] $[infostore.picpath]"
+ I TestRc (!Match) FuncShowMessage "\$\[gt.Screenshot Info for window\]" \
                                    "ImageMagick isn't installed. No screenshot created."
+ I InfoStoreRemove picpath

#-----------------------------------------------------------------------
# Creates a screenshot from the desktop
#-----------------------------------------------------------------------
DestroyFunc FuncDesktopCreateScreenshot
AddToFunc   FuncDesktopCreateScreenshot
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/screenshots" && mkdir "${FVWM_USERDIR}/screenshots"'
+ I Test (!x import) FuncShowMessage "Desktop Screenshot Info" \
                                     "ImageMagick isn't installed. No screenshot created."
+ I TestRc (Match) Break 1
+ I PipeRead 'echo InfoStoreAdd picpath "$[FVWM_USERDIR]/screenshots/screenshot-`date +%F-%H%M%S`.png"'
+ I Exec sleep $0; import -window root -quality 100 -silent $[infostore.picpath]
+ I PipeRead 'echo InfoStoreAdd pause `expr $0 \\* 1000`'
+ I Schedule $[infostore.pause] FuncShowMessage "Desktop Screenshot Info" \
                                                "\$\[gt.Screenshot created:\] $[infostore.picpath]"
+ I InfoStoreRemove picpath
+ I InfoStoreRemove pause

#-----------------------------------------------------------------------
# Open an URL in a browser
#-----------------------------------------------------------------------
DestroyFunc FuncOpenURL
AddToFunc   FuncOpenURL
+ I Test (x $[infostore.default_browser]) Exec $[infostore.default_browser] '$0'
+ I TestRc (!Match) Test (x firefox) Exec firefox '$0'
+ I TestRc (!Match) Test (x chromium) Exec chromium '$0'
+ I TestRc (!Match) Test (x seamonkey) Exec seamonkey '$0'
+ I TestRc (!Match) Test (x iceweasel) Exec iceweasel '$0'
+ I TestRc (!Match) Test (x iceape) Exec iceape '$0'
+ I TestRc (!Match) Test (x netscape) Exec netscape -remote 'openURL($0, new-window)' 2>/dev/null || netscape '$0'
+ I TestRc (!Match) Test (x galeon) Exec galeon '$0'
+ I TestRc (!Match) Test (x konqueror) Exec konqueror '$0'
+ I TestRc (!Match) Test (x opera) Exec opera '$0'
+ I TestRc (!Match) FuncRunInXterm 'Open URL - $0' 'links "$0"'


#-----------------------------------------------------------------------
# Switching focus between windows with ALT-Tab and SHIFT-ALT-Tab
# from the Russian Fvwm Wiki (http://www.linux.org.ru/wiki/en/FVWM)
#-----------------------------------------------------------------------
DestroyFunc FuncFvwmNextWindow
AddToFunc FuncFvwmNextWindow
+ I Next (CurrentPage, !Iconic, AcceptsFocus) FlipFocus NoWarp
+ I Current Raise

DestroyFunc FuncFvwmPrevWindow
AddToFunc FuncFvwmPrevWindow
+ I Prev (CurrentPage, !Iconic, AcceptsFocus) Focus NoWarp
+ I Current Raise


#-----------------------------------------------------------------------
# Wallpaper Browser by Taviso.
#-----------------------------------------------------------------------
DestroyFunc FuncWallpaperBrowser
AddToFunc   FuncWallpaperBrowser
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/wallpapers" && mkdir "${FVWM_USERDIR}/wallpapers"; \
    test ! -d "${FVWM_USERDIR}/wallpapers/.thumbs" && mkdir "${FVWM_USERDIR}/wallpapers/.thumbs"'
+ I FuncCreateWpDirLinks
+ I PipeRead '_dir_path=`basename "$0"`; \
              sep=`test "$_dir_path" != "wallpapers" && echo /`; \
              echo SetEnv dir_path "${sep}`echo \\"\\$_dir_path\\" | sed \\"s#\\.#/#g;s#//#/\\.#g\\"`${sep}"'
+ I PipeRead ' \
    for i in "$0/"*; do \
        test -f "${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" -a "${i}" -ot "${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" || { \
                convert -define jpeg:size=200 -strip -quality 0 -thumbnail 42 "${i}" "png:${FVWM_USERDIR}/wallpapers/.thumbs/${i##*/}" 2>/dev/null \
                    || continue; \
            }; \
    done; \
    fvwm-menu-directory --title "$[dir_path]" \
    --icon-file __PIXMAP__ --links \
    --icon-dir folder-images.svg:$[infostore.MenuIconSize] \
    --dir "$0" --command-file="FuncNewWallpaper \\"%f\\"" \
    --exec-t="^xv -wait 2 *" --func-name FuncWallpaperBrowser | sed \
    "s#__PIXMAP__\\(.*\\)\\\"\\(.*/\\)\\(.*\\)\\\"#\\$[FVWM_USERDIR]/wallpapers/.thumbs/\\3\\1\\2\\3#g"'
+ I UnsetEnv dir_path

#-----------------------------------------------------------------------
# Create links in wallpaper directory to additional directories
#-----------------------------------------------------------------------
DestroyFunc FuncCreateWpDirLinks
AddToFunc   FuncCreateWpDirLinks
+ I PipeRead 'for _dir in `echo $[infostore.additional_wp_dirs] | sed "s#:# #g"`; do \
                if [ -d "$_dir" ]; then \
                    _dir_name=`echo "$_dir" | sed "s#^/##;s#/#.#g"`; \
                    if [ ! -L "${FVWM_USERDIR}/wallpapers/$_dir_name" ]; then \
                        ln -s "$_dir" "${FVWM_USERDIR}/wallpapers/$_dir_name"; \
                    fi; \
                fi; \
              done'
+ I FuncRemoveWpDirLinks

#-----------------------------------------------------------------------
# Remove links of obsolete additional directories in wallpaper directory
#-----------------------------------------------------------------------
DestroyFunc FuncRemoveWpDirLinks
AddToFunc   FuncRemoveWpDirLinks
+ I PipeRead ' \
    _wp_dirs=`echo "$[infostore.additional_wp_dirs]" | sed "s#^/\\|/\\\\$##g;s#:/#:#g;s#/:#:#g;s#/#\\.#g"`; \
    for _link in `find "${FVWM_USERDIR}/wallpapers" -maxdepth 1 -type l`; do \
        if [ -d "$_link" ]; then \
            _basename=`basename "$_link"`; \
            if [ -n "${_wp_dirs##*$_basename*}" ]; then \
                rm -f "$_link"; \
            fi; \
        fi; \
    done'

#-----------------------------------------------------------------------
# Set which wallpaper mode will use
#-----------------------------------------------------------------------
DestroyFunc FuncSetWallpaper
AddToFunc   FuncSetWallpaper
+ I Test (EnvMatch DesktopIconsOn 1) Exec exec pcmanfm -w $[FVWM_USERDIR]/.wallpaper --wallpaper-mode=stretch
+ I TestRC (Match) Break
+ I TestRC (!Match) Test (I $[infostore.fvwm_wallpaper]) Exec exec feh --bg-scale $[infostore.fvwm_wallpaper]
+ I TestRC (!Match) Module FvwmBacker

#-----------------------------------------------------------------------
# switch background from FvwmBacker to chosen wallpaper picture
#-----------------------------------------------------------------------
DestroyFunc FuncNewWallpaper
AddToFunc   FuncNewWallpaper
+ I PipeRead 'ln -sf "$*" "$[FVWM_USERDIR]/.wallpaper"'
+ I FuncSetWallpaper
+ I KillModule FvwmBacker

#-----------------------------------------------------------------------
# delete wallpaper link and activate FvwmBacker
#-----------------------------------------------------------------------
DestroyFunc FuncDelWallpaperlink
AddToFunc   FuncDelWallpaperlink
+ I PipeRead 'rm -f $[infostore.fvwm_wallpaper]'
+ I Module FvwmBacker


#-----------------------------------------------------------------------
# replacement for iconify. Creates a small thumb with little app icon
# on the upper right and the name of the app at the bottom
#-----------------------------------------------------------------------
DestroyFunc FuncThumbnail
AddToFunc   FuncThumbnail
+ I Raise
+ I ThisWindow (!Iconic) PipeRead "echo SetEnv app_name `xprop -id $[w.id] WM_CLASS |cut -d',' -f2 |cut -d'\"' -f2`"
+ I PipeRead "echo SetEnv Icon-$[w.id] `fns-find-icon -i $[w.id]`"
+ I PipeRead 'test ! -d "${FVWM_USERDIR}/temp" && mkdir "${FVWM_USERDIR}/temp"'
+ I ThisWindow (!Shaded, Iconifiable, !Iconic) PipeRead \
    "sleep 0.001; xwd -silent -id $[w.id] | convert -scale 128x72! -frame 1x1 \
    -mattecolor black -quality 0 xwd:- png:$[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png \
    && echo WindowStyle IconOverride, Icon $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png \
    || echo Nop"
+ I TestRc (Match) Test (f $[Icon-$[w.id]], f $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png) PipeRead \
    "convert $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png \\\( $[Icon-$[w.id]] -scale 24x24 \\\) \
    -gravity northeast -geometry +10+10 -compose multiply -composite \
    -fill white -undercolor '#00000080' -gravity south -annotate +0+5 \" $[app_name] \" \
    $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png; echo Nop"
+ I Iconify

#-----------------------------------------------------------------------
# replacement for deiconify.
#-----------------------------------------------------------------------
DestroyFunc FuncDeThumbnail
AddToFunc   FuncDeThumbnail
+ I Test (i $[Icon-$[w.id]]) WindowStyle Icon $[Icon-$[w.id]]
+ I TestRc (NoMatch) WindowStyle NoIconOverride, Icon
+ I Exec rm -f $[FVWM_USERDIR]/temp/icon.tmp.$[w.id].png
+ I All (Iconic, CurrentPage) PlaceAgain icon
+ I PipeRead 'if [ -O $[Icon-$[w.id]] ]; then rm -f $[Icon-$[w.id]];fi'
+ I UnsetEnv Icon-$[w.id]
+ I UnsetEnv app_name

#-----------------------------------------------------------------------
# Suspend the machine
#-----------------------------------------------------------------------
DestroyFunc FuncSuspend
AddToFunc   FuncSuspend
+ I Test (!x pm-is-supported) FuncShowMessage "Suspend Info" "Install pm-utils for full functionality"
+ I TestRc (Match) break
+ I TestRc (!Match) Test (x systemctl) PipeRead 'systemctl suspend'
+ I TestRc (!Match) Test (x /usr/sbin/hald) PipeRead 'dbus-send --system --print-reply --dest=org.freedesktop.Hal \
                                                    /org/freedesktop/Hal/devices/computer \
                                                    org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0 1>&2'
+ I TestRc (!Match) Test (x upower) PipeRead 'dbus-send --print-reply --system --dest=org.freedesktop.UPower \
                                            /org/freedesktop/UPower org.freedesktop.UPower.Suspend 1>&2'
+ I TestRc (!Match) FuncShowMessage "Suspend Info" "Suspend not possible - hald nor upower found!"

#-----------------------------------------------------------------------
# Hibernate the machine
#-----------------------------------------------------------------------
DestroyFunc FuncHibernate
AddToFunc   FuncHibernate
+ I Test (!x pm-is-supported) FuncShowMessage "Hibernate Info" "Install pm-utils for full functionality"
+ I TestRc (Match) break
+ I TestRc (!Match) Test (x systemctl) PipeRead 'systemctl hibernate'
+ I TestRc (!Match) Test (x /usr/sbin/hald) PipeRead 'dbus-send --system --print-reply --dest=org.freedesktop.Hal \
                                                    /org/freedesktop/Hal/devices/computer \
                                                    org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate 1>&2'
+ I TestRc (!Match) Test (x upower) PipeRead 'dbus-send --print-reply --system --dest=org.freedesktop.UPower \
                                            /org/freedesktop/UPower org.freedesktop.UPower.Hibernate 1>&2'
+ I TestRc (!Match) FuncShowMessage "Suspend Info" "Hibernate not possible - hald nor upower found!"

#-----------------------------------------------------------------------
# Activate lockscreen if installed
#-----------------------------------------------------------------------
DestroyFunc FuncLockScreen
AddToFunc   FuncLockScreen
+ I PipeRead 'if [ `pidof xscreensaver` ]; then \
                echo SetEnv isRunning 1; \
              else \
                echo SetEnv isRunning 0; \
              fi'
+ I Test (EnvMatch isRunning 1) Exec exec xscreensaver-command -lock
+ I TestRc (!Match) FuncShowMessage "Lock screen Info" "'xscreensaver' not running or not installed."

#-----------------------------------------------------------------------
# Show screen saver menu
#-----------------------------------------------------------------------
DestroyFunc FuncMenuXScreenSaver
AddToFunc   FuncMenuXScreenSaver
+ I Test (x xscreensaver-command) Popup MenuXScreenSaver
+ I TestRc (!Match) FuncShowMessage "Screensaver Info" "Install xscreensaver for full functionality"     

#-----------------------------------------------------------------------
# Run an application launcher
#-----------------------------------------------------------------------
DestroyFunc FuncRunAppLauncher
AddToFunc   FuncRunAppLauncher
+ I Test (x grun) exec exec grun
+ I TestRc (!Match) exec exec gmrun
+ I TestRc (!Match) Module FvwmForm FvwmForm-RunCommand


#=======================================================================
# 8.3 Window/Icon
#=======================================================================

#-----------------------------------------------------------------------
# This one moves and then raises the window if you drag the mouse,
# only raises the window if you click, or maximize if you double click
#-----------------------------------------------------------------------
DestroyFunc FuncMoveOrRaiseOrMaximize
AddToFunc   FuncMoveOrRaiseOrMaximize
+ H Move
+ M Move
+ C Raise
+ D Maximize

#-----------------------------------------------------------------------
# This one resizes and then raises the window if you drag the mouse, only
# raises the window if you click,  or maximize if you double click
#-----------------------------------------------------------------------
DestroyFunc FuncResizeOrRaiseOrMaximize
AddToFunc   FuncResizeOrRaiseOrMaximize
+ H Resize $0
+ M Resize $0
+ C Raise
+ D Maximize

#-----------------------------------------------------------------------
# This one moves the window if you drag the mouse and RaiseLower if you click
#-----------------------------------------------------------------------
DestroyFunc FuncMoveOrRaiseLower
AddToFunc   FuncMoveOrRaiseLower
+ H Move
+ M Move
+ C RaiseLower

#-----------------------------------------------------------------------
# This moves the icon if you drag the mouse and deiconify it if you double click
#-----------------------------------------------------------------------
DestroyFunc FuncMoveOrIconify
AddToFunc   FuncMoveOrIconify
+ M Move
+ D Iconify

#-----------------------------------------------------------------------
# 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

#-----------------------------------------------------------------------
# This function selects a window, give it the focus and raise it
#-----------------------------------------------------------------------
DestroyFunc FuncSelectWindow
AddToFunc   FuncSelectWindow
+ I Iconify off
+ I Focus
+ I Raise

#-----------------------------------------------------------------------
# Restore the previous state of a window
#-----------------------------------------------------------------------
DestroyFunc FuncRestore
AddToFunc   FuncRestore
+ I ThisWindow (!Iconic !Shaded Maximized) Maximize    false
+ I ThisWindow (!Iconic  Shaded          ) WindowShade false
+ I ThisWindow ( Iconic                  ) Iconify     false


#-----------------------------------------------------------------------
# delete a window (single click) or destroy it (double click)
#-----------------------------------------------------------------------
DestroyFunc FuncDeleteOrDestroy
AddToFunc   FuncDeleteOrDestroy
+ H Nop
+ M Nop
+ C Delete
+ D Destroy

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncMaximize
AddToFunc   FuncMaximize
+ M Nop
+ H Nop
+ C Maximize
+ D Menu MenuWindowMaximize

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncMaximizeVertically
AddToFunc   FuncMaximizeVertically
+ H Maximize 0 100
+ M Maximize 0 100
+ C Maximize 0 100

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncMaximizeHorizontally
AddToFunc   FuncMaximizeHorizontally
+ H Maximize 100 0
+ M Maximize 100 0
+ C Maximize 100 0

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncSimpleMaximize
AddToFunc   FuncSimpleMaximize
+ I Maximize $0

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncSimpleMaximizeVertically
AddToFunc   FuncSimpleMaximizeVertically
+ I Maximize $0 0 100

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncSimpleMaximizeHorizontally
AddToFunc   FuncSimpleMaximizeHorizontally
+ I Maximize $0 100 0

#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
DestroyFunc FuncSimpleMaximizePartially
AddToFunc   FuncSimpleMaximizePartially
+ I Maximize $0 0 95

#-----------------------------------------------------------------------
# Iconify/deiconify all apps with the same resource
#-----------------------------------------------------------------------
DestroyFunc FuncIconifySameResource
AddToFunc   FuncIconifySameResource
#+ I All ($[w.resource]) Iconify $0
+ I All ($[w.resource]) FuncThumbnail

#-----------------------------------------------------------------------
# Iconify a window
#-----------------------------------------------------------------------
DestroyFunc FuncIconify
AddToFunc   FuncIconify
#+ C Iconify
+ C FuncThumbnail

#-----------------------------------------------------------------------
# Shade or unshade the window when the Mouse wheel is rolled up or
# down on the Titlebar. Rolling the Wheel up calls the Function with
# argument `True` and rolling it down uses `False`, so rolling the wheel
# down when the window isnt shaded has no effect, which I like :)
#-----------------------------------------------------------------------
DestroyFunc FuncWheelToggleShade
AddToFunc   FuncWheelToggleShade
+ D WindowShade $0

#-----------------------------------------------------------------------
# Move active window to next/previous page
#-----------------------------------------------------------------------
DestroyFunc FuncMoveWindowToPage
AddToFunc   FuncMoveWindowToPage
+ I MoveToPage $0 $1
+ I GotoPage $0 $1

#-----------------------------------------------------------------------
# Move active window to next/previous page with animation
# but not outside the visible pages ;)
#-----------------------------------------------------------------------
DestroyFunc FuncAnimatedMove
AddToFunc   FuncAnimatedMove
+ I PipeRead   'if [ "$0" != "w" ]; then \
                    if [ $[page.nx] -eq 0 ] && [ "$0" = "w-100" ]; then \
                        exit; \
                    elif [ $[page.nx] -eq $(($[infostore.x_desks]-1)) ] && [ "$0" = "w+100" ]; then \
                        exit; \
                    fi; \
                else \
                    if [ $[page.ny] -eq 0 ] && [ "$1" = "w-100" ]; then \
                        exit; \
                    elif [ $[page.ny] -eq $(($[infostore.y_desks]-1)) ] && [ "$1" = "w+100" ]; then \
                        exit; \
                    fi; \
                fi; \
                echo AnimatedMove $0 $1'

#-----------------------------------------------------------------------
# GotoPage and set focus to window which is in the foreground
#-----------------------------------------------------------------------
DestroyFunc FuncGotoPage
AddToFunc   FuncGotoPage
+ I GotoPage $0 $1
+ I Next (CurrentPage, !Iconic, !Sticky, !Shaded, !Focused, !Overlapped) FuncSelectWindow

#-----------------------------------------------------------------------
# Move window to top layer and next time back to default
#-----------------------------------------------------------------------
DestroyFunc FuncStaysOnTopAndBack
AddToFunc   FuncStaysOnTopAndBack
+ I ThisWindow (Layer 2) Pick (CirculateHit) Layer 0 6
+ I TestRc (!Match) Pick (CirculateHit) Layer default
+ I Raise



#=======================================================================
# 8.4 Menus
#=======================================================================

#-----------------------------------------------------------------------
# Show a Wallpaper configuration menu
#-----------------------------------------------------------------------
DestroyFunc FuncMenuWallpaperConfiguration
AddToFunc   FuncMenuWallpaperConfiguration
+ I Test (x convert) PipeRead `echo SetEnv appmatch 1`
+ I TestRc (!Match) PipeRead `echo SetEnv appmatch 0`
+ I Test (x feh) PipeRead 'echo SetEnv appmatch `expr $appmatch + 1`'
+ I Test (EnvMatch appmatch 2) Popup MenuWallpaperConfiguration
+ I TestRc (!Match) FuncShowMessage "Wallpaper browser Info" "Install ImageMagick AND feh for full functionality."

#-----------------------------------------------------------------------
# Creates a dynamic menu for all available Fvwm and FNS manpages
#-----------------------------------------------------------------------
DestroyFunc FuncFManpageMenu
AddToFunc   FuncFManpageMenu
+ I PipeRead 'fvwm-menu-directory \
              --dir "/usr/share/man/man1" \
              --title "Man Pages" --exec-file "^xterm -fg $[fg.cs28] -bg $[bg.cs28] -g 80x40 -n Fvwm-Help -T Fvwm-Help -e man" |\
              grep -i "^Destroy\\|^AddTo\\|^+ Dynamic\\|^+ Missing\\|^+ \\"f\\(vwm\\|ns\\)" |sed -e "s#\\.1\\.gz##g" \
              -e "s#/usr/share/man/man1/##g" -e "s#\\"##3" -e "s#\\"##3" '

#-----------------------------------------------------------------------
# Start the correct keyboard layouter app
#-----------------------------------------------------------------------
DestroyFunc FuncKbdLayouter
AddToFunc   FuncKbdLayouter
+ I Test (x gxneur) Exec exec gxneur
+ I TestRc (!Match) Test (x xneur) Exec exec xneur
+ I TestRc (!Match) FuncShowMessage "Keyboard Layout Info" "Install xneur/gxneur for full functionality"

#-----------------------------------------------------------------------
# Start Gtk config tool if available
#-----------------------------------------------------------------------
DestroyFunc FuncLxappearance
AddToFunc   FuncLxappearance
+ I Test (x lxappearance) Exec exec lxappearance
+ I TestRc (!Match) FuncShowMessage "Gtk+ Decor Info" "Install LxApearance for Gtk+ apps"

#-----------------------------------------------------------------------
# Start Qt4 config tool if available
#-----------------------------------------------------------------------
DestroyFunc FuncQt4Decor
AddToFunc   FuncQt4Decor
+ I Test (x qtconfig-qt4) Exec exec qtconfig-qt4
+ I TestRc (!Match) FuncShowMessage "Qt4 Decor Info" "Install qtconfig-qt4 for Qt4 apps"


########################################################################
#                            9. M E N U S
########################################################################

#=======================================================================
# 9.1 Root menu
#=======================================================================
# Dynamic menu realized with DynamicPopupAction
AddToMenu MenuRoot DynamicPopupAction FuncMenuRoot

DestroyFunc FuncMenuRoot
AddToFunc   FuncMenuRoot
+ I SetMenuIconSize
+ I DestroyMenu MenuRoot
+ I AddToMenu MenuRoot DynamicPopupAction FuncMenuRoot
+ I AddToMenu MenuRoot "$[gt.Root Menu]" Title
+ I AddToMenu MenuRoot "$[gt.&Personal Applications]%home.svg:$[infostore.MenuIconSize]%"       Popup MenuFvwmPersonal
+ I Popup FvwmMenu
+ I AddToMenu MenuRoot "" Nop
+ I AddToMenu MenuRoot "$[gt.&Configuration]%system.svg:$[infostore.MenuIconSize]%"             Popup MenuConfiguration
+ I AddToMenu MenuRoot "$[gt.&Help]%help.svg:$[infostore.MenuIconSize]%"                        Popup MenuHelp
+ I AddToMenu MenuRoot "" Nop
+ I AddToMenu MenuRoot "$[gt.Fvwm &Modules]%modules.svg:$[infostore.MenuIconSize]%"             Popup MenuFvwmModules
+ I AddToMenu MenuRoot "$[gt.&Window Operations]%window.svg:$[infostore.MenuIconSize]%"         Popup MenuWindowOpsFull
+ I AddToMenu MenuRoot "" Nop
+ I AddToMenu MenuRoot "$[gt.Lock Screen]	Alt-Ctrl+L%lock.svg:$[infostore.MenuIconSize]%"     FuncLockScreen
+ I AddToMenu MenuRoot "$[gt.&Run Command]	Alt-F2%executable.svg:$[infostore.MenuIconSize]%"   FuncRunAppLauncher
+ I AddToMenu MenuRoot "$[gt.&Terminal]	Alt-Ctrl-T%terminal.svg:$[infostore.MenuIconSize]%"     exec exec $[infostore.default_terminal]
+ I AddToMenu MenuRoot "$[gt.&Quit Fvwm-Nightshade]%logout.svg:$[infostore.MenuIconSize]%"      Popup MenuFvwmQuit


#-----------------------------------------------------------------------
# Dynamic FvwmMenu sub menu for XDG menus
# realized with DynamicPopupAction
#-----------------------------------------------------------------------
AddToMenu FvwmMenu DynamicPopupAction FuncXdgMenusInRoot

DestroyFunc FuncXdgMenusInRoot
AddToFunc   FuncXdgMenusInRoot
+ I AddToMenu FvwmMenu DynamicPopupAction FuncXdgMenusInRoot
+ I Test (f $[FVWM_USERDIR]/.menu) Read $[FVWM_USERDIR]/.menu
+ I TestRc (!Match) PipeRead 'fns-menu-desktop --insert-in-menu MenuRoot > $[FVWM_USERDIR]/.menu &&  echo "Read $[FVWM_USERDIR]/.menu"'


#-----------------------------------------------------------------------
# Dynamic personal applications sub menu for favorite apps
# realized with DynamicPopupAction
#-----------------------------------------------------------------------
AddToMenu MenuFvwmPersonal DynamicPopupAction FuncMenuFvwmPersonal

DestroyFunc FuncMenuFvwmPersonal
AddToFunc   FuncMenuFvwmPersonal
+ I DestroyMenu MenuFvwmPersonal
+ I AddToMenu MenuFvwmPersonal DynamicPopupAction FuncMenuFvwmPersonal
+ I AddToMenu MenuFvwmPersonal "$[gt.Personal Applications]" Title
+ I AddToMenu MenuFvwmPersonal "$[gt.&Configure Personal Applications]%PersonalMenuCreator.svg:$[infostore.MenuIconSize]%"    Exec exec FNS-MenuBuilder
+ I Test (f  $[FVWM_USERDIR]/.personal) PipeRead `sed -e '/^#/ d;/^ *$/ d;/^ *$/,$ d' $FVWM_USERDIR/.personal`


#=======================================================================
# 9.2 Help
#=======================================================================
AddToMenu MenuHelp DynamicPopupAction FuncMenuHelp

DestroyFunc FuncMenuHelp
AddToFunc   FuncMenuHelp
+ I DestroyMenu MenuHelp
+ I AddToMenu MenuHelp DynamicPopupAction FuncMenuHelp
+ I AddToMenu MenuHelp "$[gt.Help]" Title
# Dynamic Fvwm Manpages realized with MissingSubmenuFunction
+ I AddToMenu MenuHelp MissingSubmenuFunction FuncFManpageMenu
+ I AddToMenu MenuHelp "$[gt.Fvwm/Fns &Man Pages]%help.svg:$[infostore.MenuIconSize]%"          Popup "/usr/share/man/man1"
+ I AddToMenu MenuHelp "$[gt.Fvwm &Web Pages]%www.svg:$[infostore.MenuIconSize]%"               Popup MenuFvwmWebPages
+ I AddToMenu MenuHelp "$[gt.Fvwm-&Nightshade Web Pages]%www.svg:$[infostore.MenuIconSize]%"    Popup FNSWebPagesMenu
+ I AddToMenu MenuHelp "$[gt.&Other Helps]%help.svg:$[infostore.MenuIconSize]%"                 Popup MenuHelpOthers
+ I AddToMenu MenuHelp "$[gt.&Show Fvwm Version]%fvwm_footprint.svg:$[infostore.MenuIconSize]%" FuncShowMessage "Fvwm Version Info" "$[version.line]"
+ I AddToMenu MenuHelp "$[gt.&About Fvwm-Nightshade]%icon_fns.svg:$[infostore.MenuIconSize]%"   Module FvwmForm FvwmForm-About


#-----------------------------------------------------------------------
# Dynamic other help application sub menu for miscellaneous help tools
# realized with DynamicPopupAction
#-----------------------------------------------------------------------
AddToMenu MenuHelpOthers DynamicPopupAction FuncMenuHelpOthers

DestroyFunc FuncMenuHelpOthers
AddToFunc   FuncMenuHelpOthers
+ I DestroyMenu  MenuHelpOthers
+ I AddToMenu MenuHelpOthers DynamicPopupAction FuncMenuHelpOthers
+ I AddToMenu MenuHelpOthers "$[gt.Others]" Title
+ I Test (x xman) AddToMenu MenuHelpOthers "%x.svg:$[infostore.MenuIconSize]%$[gt.&X Man Pages]"                    Exec exec xman
+ I Test (x gnome-help) AddToMenu MenuHelpOthers "%gnome.svg:$[infostore.MenuIconSize]%$[gt.&GNOME Help]"           Exec exec gnome-help
+ I Test (x gnome-help-browser) AddToMenu MenuHelpOthers "%gnome.svg:$[infostore.MenuIconSize]%$[gt.&GNOME Help]"   Exec exec gnome-help-browser
+ I Test (x kdehelp) AddToMenu MenuHelpOthers "%kde.svg:$[infostore.MenuIconSize]%$[gt.&KDE Help]"                  Exec exec kdehelp
+ I Test (x khelpcenter) AddToMenu MenuHelpOthers "%kde.svg:$[infostore.MenuIconSize]%$[gt.&KDE Help]"              Exec exec khelpcenter


#-----------------------------------------------------------------------
# Help submenu Fvwm web pages
#-----------------------------------------------------------------------
AddToMenu MenuFvwmWebPages DynamicPopupAction FuncMenuFvwmWebPages

DestroyFunc FuncMenuFvwmWebPages
AddToFunc   FuncMenuFvwmWebPages
+ I DestroyMenu  MenuFvwmWebPages
+ I AddToMenu MenuFvwmWebPages DynamicPopupAction FuncMenuFvwmWebPages
+ I AddToMenu MenuFvwmWebPages "$[gt.Fvwm Web Pages]" Title
+ I AddToMenu MenuFvwmWebPages "$[gt.Home Page]%webpage.svg:$[infostore.MenuIconSize]%"                 FuncOpenURL http://www.fvwm.org/
+ I AddToMenu MenuFvwmWebPages "$[gt.FAQ]%webpage.svg:$[infostore.MenuIconSize]%"                       FuncOpenURL http://www.fvwm.org/generated/FAQ.html
+ I AddToMenu MenuFvwmWebPages "$[gt.Documentation]%webpage.svg:$[infostore.MenuIconSize]%"             FuncOpenURL http://fvwm.org/doc/unstable/index.html
+ I AddToMenu MenuFvwmWebPages "" Nop
+ I AddToMenu MenuFvwmWebPages "$[gt.Wiki]%webpage.svg:$[infostore.MenuIconSize]%"                      FuncOpenURL http://fvwmwiki.xteddy.org/
+ I AddToMenu MenuFvwmWebPages "$[gt.Forum]%webpage.svg:$[infostore.MenuIconSize]%"                     FuncOpenURL http://www.fvwmforums.org/
+ I AddToMenu MenuFvwmWebPages "" Nop
+ I AddToMenu MenuFvwmWebPages "$[gt.In the beginning was ...]%webpage.svg:$[infostore.MenuIconSize]%"  FuncOpenURL http://www.xteddy.org/fvwm/user_enumerate.html
+ I AddToMenu MenuFvwmWebPages "$[gt.Beginners Guide]%webpage.svg:$[infostore.MenuIconSize]%"           FuncOpenURL http://zensites.net/fvwm/guide/
+ I AddToMenu MenuFvwmWebPages "$[gt.FAQ inofficial]%webpage.svg:$[infostore.MenuIconSize]%"            FuncOpenURL http://edulinux.homeunix.org/fvwm/fvwmchanfaq.html
+ I AddToMenu MenuFvwmWebPages "$[gt.How Styles are Applied]%webpage.svg:$[infostore.MenuIconSize]%"    FuncOpenURL http://linuxgazette.net/127/adam.html
+ I AddToMenu MenuFvwmWebPages "$[gt.Session Management]%webpage.svg:$[infostore.MenuIconSize]%"        FuncOpenURL http://linuxgazette.net/100/adam.html


#-----------------------------------------------------------------------
# Dynamic Fvwm-Nightshade help sub menu with names of each found html 
# page with DynamicPopupAction and recreation
#-----------------------------------------------------------------------
DestroyMenu FNSWebPagesMenu
AddToMenu   FNSWebPagesMenu
+ "$[gt.FNS Web Pages]" Title
+ DynamicPopupAction Function FuncFNSWebPagesMenu

DestroyFunc FuncFNSWebPagesMenu
AddToFunc   FuncFNSWebPagesMenu
+ I DestroyMenu recreate FNSWebPagesMenu
+ I AddToMenu FNSWebPagesMenu "$[gt.FNS Web Pages]" Title
+ I PipeRead 'for i in `ls -1 $FNS_SYSTEMDIR/../doc/fvwm-nightshade/html/*.html | sed "s#.*/##"`; \
  do echo AddToMenu FNSWebPagesMenu "${i}%webpage.svg:$[infostore.MenuIconSize]%" FuncOpenURL file://$[FNS_SYSTEMDIR]/../doc/fvwm-nightshade/html/$i; done'
+ I AddToMenu FNSWebPagesMenu "$[gt.Fvwm-Nightshade Website]%webpage.svg:$[infostore.MenuIconSize]%" FuncOpenURL hhttp://fvwm-nightshade.github.io/Fvwm-Nightshade/
+ I AddToMenu FNSWebPagesMenu "$[gt.SimpleGtk2 Website]%webpage.svg:$[infostore.MenuIconSize]%" FuncOpenURL http://thomasfunk.github.io/SimpleGtk2/files/SimpleGtk2-pm.html


#=======================================================================
# 9.3 Modules and Applets
#=======================================================================
AddToMenu MenuFvwmModules DynamicPopupAction FuncMenuFvwmModules

DestroyFunc FuncMenuFvwmModules
AddToFunc   FuncMenuFvwmModules
+ I DestroyMenu  MenuFvwmModules
+ I AddToMenu MenuFvwmModules DynamicPopupAction FuncMenuFvwmModules
+ I AddToMenu MenuFvwmModules "$[gt.Fvwm Modules]" Title
+ I AddToMenu MenuFvwmModules "$[gt.Start Regular Modules]%modules.svg:$[infostore.MenuIconSize]%"      Popup MenuStartRegularModules
+ I AddToMenu MenuFvwmModules "$[gt.Stop Regular Modules]%stop.svg:$[infostore.MenuIconSize]%"          Popup MenuStopRegularModules

#-----------------------------------------------------------------------
# Modules sub menu for starting regular Fvwm modules
#-----------------------------------------------------------------------
AddToMenu MenuStartRegularModules DynamicPopupAction FuncMenuStartRegularModules

DestroyFunc FuncMenuStartRegularModules
AddToFunc   FuncMenuStartRegularModules
+ I DestroyMenu  MenuStartRegularModules
+ I AddToMenu MenuStartRegularModules DynamicPopupAction FuncMenuStartRegularModules
+ I AddToMenu MenuStartRegularModules "$[gt.Start Regular Modules]" Title
+ I AddToMenu MenuStartRegularModules "$[gt.&Animation]%window-iconify.svg:$[infostore.MenuIconSize]%"              FuncRestartModule FvwmAnimate
+ I AddToMenu MenuStartRegularModules "$[gt.Backe&r]%display.svg:$[infostore.MenuIconSize]%"                        FuncRestartModule FvwmBacker
+ I AddToMenu MenuStartRegularModules "$[gt.Ba&nner]%display.svg:$[infostore.MenuIconSize]%"                        Module FvwmBanner
+ I AddToMenu MenuStartRegularModules "$[gt.Co&mmandS]%terminal.svg:$[infostore.MenuIconSize]%"                     FuncRestartModule FvwmCommandS
+ I AddToMenu MenuStartRegularModules "$[gt.&Console]%terminal.svg:$[infostore.MenuIconSize]%"                      FuncFvwmConsole
+ I AddToMenu MenuStartRegularModules "$[gt.&GtkDebug]%bug.svg:$[infostore.MenuIconSize]%"                          Module FvwmGtkDebug
+ I AddToMenu MenuStartRegularModules "$[gt.&Debug Console]%bug.svg:$[infostore.MenuIconSize]%"                     Module FvwmDebug --xconsole
+ I AddToMenu MenuStartRegularModules "$[gt.&Identify]%question.svg:$[infostore.MenuIconSize]%"                     Module FvwmIdent
+ I AddToMenu MenuStartRegularModules "$[gt.ScrollBar (1/2 &app)]%window-scrollbar.svg:$[infostore.MenuIconSize]%"  Module FvwmScroll 2 2
+ I AddToMenu MenuStartRegularModules "$[gt.ScrollBar (75%% &scr)]%window-scrollbar.svg:$[infostore.MenuIconSize]%" Module FvwmScroll 75p 75p
+ I AddToMenu MenuStartRegularModules "$[gt.Auto Raise (&1/2 sec)]%arrow-up.svg:$[infostore.MenuIconSize]%"         FuncRestartModule 'FvwmAuto 500 "Silent Raise" Nop'
+ I AddToMenu MenuStartRegularModules "$[gt.Auto Raise (&2 sec)]%arrow-up.svg:$[infostore.MenuIconSize]%"           FuncRestartModule 'FvwmAuto 2000 "Silent Raise" Nop'
+ I AddToMenu MenuStartRegularModules "" Nop
+ I AddToMenu MenuStartRegularModules "$[gt.&Forms]%window2.svg:$[infostore.MenuIconSize]%"                         Popup  MenuFvwmForms

#-----------------------------------------------------------------------
# Modules sub menu for stoping regular Fvwm modules
#-----------------------------------------------------------------------
AddToMenu MenuStopRegularModules DynamicPopupAction FuncMenuStopRegularModules

DestroyFunc FuncMenuStopRegularModules
AddToFunc   FuncMenuStopRegularModules
+ I DestroyMenu  MenuStopRegularModules
+ I AddToMenu MenuStopRegularModules DynamicPopupAction FuncMenuStopRegularModules
+ I AddToMenu MenuStopRegularModules "$[gt.Stop Regular Modules]" Title
+ I AddToMenu MenuStopRegularModules "$[gt.&Animation]%stop.svg:$[infostore.MenuIconSize]%"          KillModule FvwmAnimate
+ I AddToMenu MenuStopRegularModules "$[gt.Backe&r]%stop.svg:$[infostore.MenuIconSize]%"             KillModule FvwmBacker
+ I AddToMenu MenuStopRegularModules "$[gt.Co&mmandS]%stop.svg:$[infostore.MenuIconSize]%"           KillModule FvwmCommandS
+ I AddToMenu MenuStopRegularModules "$[gt.&Console]%stop.svg:$[infostore.MenuIconSize]%"            KillModule FvwmConsole
+ I AddToMenu MenuStopRegularModules "$[gt.&GtkDebug]%stop.svg:$[infostore.MenuIconSize]%"           KillModule FvwmGtkDebug
+ I AddToMenu MenuStopRegularModules "$[gt.&Identify]%stop.svg:$[infostore.MenuIconSize]%"           KillModule FvwmIdent
+ I AddToMenu MenuStopRegularModules "$[gt.&ScrollBar]%stop.svg:$[infostore.MenuIconSize]%"          KillModule FvwmScroll
+ I AddToMenu MenuStopRegularModules "$[gt.Auto Rais&e]%stop.svg:$[infostore.MenuIconSize]%"         KillModule FvwmAuto
+ I AddToMenu MenuStopRegularModules "$[gt.All Events]%stop.svg:$[infostore.MenuIconSize]%"          KillModule FvwmEvent
+ I AddToMenu MenuStopRegularModules "$[gt.All &Buttons]%stop.svg:$[infostore.MenuIconSize]%"        KillModule FvwmButtons
+ I AddToMenu MenuStopRegularModules "$[gt.All &Forms]%stop.svg:$[infostore.MenuIconSize]%"          KillModule FvwmForm

#-----------------------------------------------------------------------
# Modules sub menu for Fvwm Form modules
#-----------------------------------------------------------------------
AddToMenu MenuFvwmForms DynamicPopupAction FuncMenuFvwmForms

DestroyFunc FuncMenuFvwmForms
AddToFunc   FuncMenuFvwmForms
+ I DestroyMenu  MenuFvwmForms
+ I AddToMenu MenuFvwmForms DynamicPopupAction FuncMenuFvwmForms
+ I AddToMenu MenuFvwmForms "$[gt.FvwmForm Tools]" Title
+ I AddToMenu MenuFvwmForms "$[gt.&Capture]%printer.svg:$[infostore.MenuIconSize]%"     Module FvwmForm FvwmForm-Capture
+ I AddToMenu MenuFvwmForms "$[gt.&Rlogin]%network.svg:$[infostore.MenuIconSize]%"      Module FvwmForm FvwmForm-Rlogin
+ I AddToMenu MenuFvwmForms "$[gt.&Talk]%network.svg:$[infostore.MenuIconSize]%"        Module FvwmForm FvwmForm-Talk
+ I AddToMenu MenuFvwmForms "$[gt.&QuitVerify]%halt.svg:$[infostore.MenuIconSize]%"     Module FvwmForm FvwmForm-QuitVerify


#=======================================================================
# 9.4 Configuration Menu
#=======================================================================
AddToMenu MenuConfiguration DynamicPopupAction FuncMenuConfiguration

DestroyFunc FuncMenuConfiguration
AddToFunc   FuncMenuConfiguration
+ I DestroyMenu  MenuConfiguration
+ I AddToMenu MenuConfiguration DynamicPopupAction FuncMenuConfiguration
+ I AddToMenu MenuConfiguration "$[gt.Configuration]" Title
+ I AddToMenu MenuConfiguration "$[gt.&Fvwm]%fvwm_footprint.svg:$[infostore.MenuIconSize]%"         Popup MenuFvwmConfiguration
+ I AddToMenu MenuConfiguration "$[gt.Fvwm-&Nightshade]%icon_fns.svg:$[infostore.MenuIconSize]%"    Popup MenuFNSConfiguration
+ I AddToMenu MenuConfiguration "$[gt.&System]%system2.svg:$[infostore.MenuIconSize]%"              Popup MenuSystemConfiguration
+ I AddToMenu MenuConfiguration "" Nop
+ I AddToMenu MenuConfiguration "$[gt.&Tail .xsession-errors]%text.svg:$[infostore.MenuIconSize]%"  FuncViewFileTail ".xsession-errors" $[HOME]/.xsession-errors


#-----------------------------------------------------------------------
# Sub menu for Fvwm configuration
#-----------------------------------------------------------------------
AddToMenu MenuFvwmConfiguration DynamicPopupAction FuncMenuFvwmConfiguration

DestroyFunc FuncMenuFvwmConfiguration
AddToFunc   FuncMenuFvwmConfiguration
+ I DestroyMenu  MenuFvwmConfiguration
+ I AddToMenu MenuFvwmConfiguration DynamicPopupAction FuncMenuFvwmConfiguration
+ I AddToMenu MenuFvwmConfiguration "$[gt.Fvwm]" Title
+ I AddToMenu MenuFvwmConfiguration "$[gt.&Animation Control]%window-iconify.svg:$[infostore.MenuIconSize]%"    Popup MenuFvwmAnimate
+ I AddToMenu MenuFvwmConfiguration "$[gt.Fvwm Form &Defaults]%fvwm_footprint.svg:$[infostore.MenuIconSize]%"   Module FvwmForm FvwmForm-Form


#-----------------------------------------------------------------------
# Sub menu for Fvwm-Nightshade configuration
#-----------------------------------------------------------------------
AddToMenu MenuFNSConfiguration DynamicPopupAction FuncMenuFNSConfiguration

DestroyFunc FuncMenuFNSConfiguration
AddToFunc   FuncMenuFNSConfiguration
+ I DestroyMenu  MenuFNSConfiguration
+ I AddToMenu MenuFNSConfiguration DynamicPopupAction FuncMenuFNSConfiguration
+ I AddToMenu MenuFNSConfiguration "$[gt.Fvwm-Nightshade]" Title
+ I AddToMenu MenuFNSConfiguration MissingSubmenuFunction FuncMenuWallpaperConfiguration
+ I AddToMenu MenuFNSConfiguration "$[gt.Configure &Background]%background.svg:$[infostore.MenuIconSize]%"      Popup MenuWallpaperConfiguration
+ I AddToMenu MenuFNSConfiguration "$[gt.&Compositing]%compositing.svg:$[infostore.MenuIconSize]%"              Popup MenuCompositing
+ I AddToMenu MenuFNSConfiguration "$[gt.&Decoration]%themes.svg:$[infostore.MenuIconSize]%"                    Popup MenuDecoration
+ I AddToMenu MenuFNSConfiguration "$[gt.FNS Base &Setup]%icon_fns.svg:$[infostore.MenuIconSize]%"       		Module FNS-BaseSetup
+ I AddToMenu MenuFNSConfiguration "$[gt.FNS &Windows Behaviour]%WinBehaviour.svg:$[infostore.MenuIconSize]%"	Module FNS-WindowsBehaviour


#-----------------------------------------------------------------------
# Sub menu for system configuration
#-----------------------------------------------------------------------
AddToMenu MenuSystemConfiguration DynamicPopupAction FuncMenuSystemConfiguration

DestroyFunc FuncMenuSystemConfiguration
AddToFunc   FuncMenuSystemConfiguration
+ I DestroyMenu  MenuSystemConfiguration
+ I AddToMenu MenuSystemConfiguration DynamicPopupAction FuncMenuSystemConfiguration
+ I AddToMenu MenuSystemConfiguration "$[gt.System]" Title
+ I AddToMenu MenuSystemConfiguration "$[gt.&Keyboard]%keyboard.svg:$[infostore.MenuIconSize]%"         Popup MenuKeyboard
+ I AddToMenu MenuSystemConfiguration "$[gt.&Mouse]%mouse.svg:$[infostore.MenuIconSize]%"               Popup MenuMouse
+ I AddToMenu MenuSystemConfiguration MissingSubmenuFunction FuncMenuXScreenSaver
+ I AddToMenu MenuSystemConfiguration "$[gt.Sc&reen Saver]%screensaver.svg:$[infostore.MenuIconSize]%"  Popup MenuXScreenSaver
+ I AddToMenu MenuSystemConfiguration "$[gt.&CPU Performance]%cpu.svg:$[infostore.MenuIconSize]%"    	Exec exec FNS-CpuPerformance
+ I AddToMenu MenuSystemConfiguration "$[gt.Set &Date/Time]%clock.svg:$[infostore.MenuIconSize]%"    	FvwmScript FNS-Script-Date


#-----------------------------------------------------------------------
# Sub menu for keyboard configuration
#-----------------------------------------------------------------------
AddToMenu MenuKeyboard DynamicPopupAction FuncMenuKeyboard

DestroyFunc FuncMenuKeyboard
AddToFunc   FuncMenuKeyboard
+ I DestroyMenu  MenuKeyboard
+ I AddToMenu MenuKeyboard DynamicPopupAction FuncMenuKeyboard
+ I AddToMenu MenuKeyboard "$[gt.Keyboard]" Title
+ I AddToMenu MenuKeyboard "$[gt.&Settings]%keyboard.svg:$[infostore.MenuIconSize]%"    FvwmScript FvwmScript-KeyboardSetup
+ I AddToMenu MenuKeyboard "$[gt.&Layout]%keyboard.svg:$[infostore.MenuIconSize]%"      FuncKbdLayouter

#-----------------------------------------------------------------------
# Sub menu for Mouse settings
#-----------------------------------------------------------------------
AddToMenu MenuMouse DynamicPopupAction FuncMenuMouse

DestroyFunc FuncMenuMouse
AddToFunc   FuncMenuMouse
+ I DestroyMenu  MenuMouse
+ I AddToMenu MenuMouse DynamicPopupAction FuncMenuMouse
+ I AddToMenu MenuMouse "$[gt.Mouse]" Title
+ I AddToMenu MenuMouse "$[gt.&Settings]%mouse.svg:$[infostore.MenuIconSize]%"          FvwmScript FvwmScript-PointerSetup
+ I AddToMenu MenuMouse "$[gt.Root &Cursor]%pointer.svg:$[infostore.MenuIconSize]%"     Module FvwmForm FvwmForm-RootCursor

#-----------------------------------------------------------------------
# Sub menu for window decoration
#-----------------------------------------------------------------------
AddToMenu MenuDecoration DynamicPopupAction FuncMenuDecoration

DestroyFunc FuncMenuDecoration
AddToFunc   FuncMenuDecoration
+ I DestroyMenu  MenuDecoration
+ I AddToMenu MenuDecoration DynamicPopupAction FuncMenuDecoration
+ I AddToMenu MenuDecoration "$[gt.Decoration]" Title
+ I AddToMenu MenuDecoration "$[gt.&Decors]%windows.svg:$[infostore.MenuIconSize]%"     Popup FvwmDecorMenu
+ I AddToMenu MenuDecoration "$[gt.&Layouts]%layout.svg:$[infostore.MenuIconSize]%"     Popup FvwmLayoutMenu
+ I AddToMenu MenuDecoration "$[gt.&Qt Decor]%qt.svg:$[infostore.MenuIconSize]%"        FuncQt4Decor
+ I AddToMenu MenuDecoration "$[gt.&Gtk+ Decor]%gtk.svg:$[infostore.MenuIconSize]%"     FuncLxappearance

#-----------------------------------------------------------------------
# Dynamic decor sub menu with names of each decor folder
# with DynamicPopupAction and recreation
#-----------------------------------------------------------------------
AddToMenu FvwmDecorMenu DynamicPopupAction FuncFvwmDecorMenu

DestroyFunc FuncFvwmDecorMenu
AddToFunc   FuncFvwmDecorMenu
+ I DestroyMenu FvwmDecorMenu
+ I AddToMenu FvwmDecorMenu "$[gt.Decors]" Title
+ I AddToMenu FvwmDecorMenu DynamicPopupAction FuncFvwmDecorMenu
+ I PipeRead '[ -d $FVWM_USERDIR/themes ] && echo SetEnv foundem 1 || echo SetEnv foundem 0'
+ I Test (EnvMatch foundem 1) AddToMenu FvwmDecorMenu "$[gt.System]" Nop
+ I TestRc (Match) AddToMenu FvwmDecorMenu "" Nop
+ I PipeRead 'for i in `ls -Fh $FNS_SYSTEMDIR/themes/ | grep /$ | sed s#/##g`; \
  do echo AddToMenu FvwmDecorMenu "${i}%decor.svg:$[infostore.MenuIconSize]%" FuncChangeDecor $i; done'
+ I Test (EnvMatch foundem 0) UnsetEnv foundem
+ I TestRc (Match) Break
+ I AddToMenu FvwmDecorMenu "" Nop
+ I AddToMenu FvwmDecorMenu "$[gt.User]" Nop
+ I AddToMenu FvwmDecorMenu "" Nop
+ I PipeRead 'for i in `ls -Fh $FVWM_USERDIR/themes/ | grep /$ | sed s#/##g`; \
    do echo AddToMenu FvwmDecorMenu "${i}%decor.svg:$[infostore.MenuIconSize]%" FuncChangeDecor $i; done'
+ I UnsetEnv foundem

#-----------------------------------------------------------------------
# Dynamic layout sub menu with names of each layout file
# with DynamicPopupAction and recreation
#-----------------------------------------------------------------------
AddToMenu FvwmLayoutMenu DynamicPopupAction FuncFvwmLayoutMenu

DestroyFunc FuncFvwmLayoutMenu
AddToFunc   FuncFvwmLayoutMenu
+ I DestroyMenu FvwmLayoutMenu
+ I AddToMenu FvwmLayoutMenu "$[gt.Layouts]" Title
+ I AddToMenu FvwmLayoutMenu DynamicPopupAction FuncFvwmLayoutMenu
+ I PipeRead '[ -d $FVWM_USERDIR/layouts ] && echo SetEnv foundem 1 || echo SetEnv foundem 0'
+ I Test (EnvMatch foundem 1) AddToMenu FvwmLayoutMenu "$[gt.System]" Nop
+ I TestRc (Match) AddToMenu FvwmLayoutMenu "" Nop
+ I PipeRead 'for i in `ls -Fh $FNS_SYSTEMDIR/layouts/ | grep -v /$ | sed s/\*//`; \
  do echo AddToMenu FvwmLayoutMenu "${i}%layout.svg:$[infostore.MenuIconSize]%" FuncChangeLayout $[FNS_SYSTEMDIR] $i; done'
+ I Test (EnvMatch foundem 0) UnsetEnv foundem
+ I TestRc (Match) Break
+ I AddToMenu FvwmLayoutMenu "" Nop
+ I AddToMenu FvwmLayoutMenu "$[gt.User]" Nop
+ I AddToMenu FvwmLayoutMenu "" Nop
+ I PipeRead 'for i in `ls -Fh $FVWM_USERDIR/layouts/ | grep -v /$ | sed s/\*//`; \
  do echo AddToMenu FvwmLayoutMenu "${i}%layout.svg:$[infostore.MenuIconSize]%" FuncChangeLayout $[FVWM_USERDIR] $i; done'
+ I UnsetEnv foundem

#-----------------------------------------------------------------------
# Dynamic sub menu for compositing
#-----------------------------------------------------------------------
AddToMenu MenuCompositing DynamicPopupAction FuncMenuCompositing

DestroyFunc FuncMenuCompositing
AddToFunc   FuncMenuCompositing
+ I DestroyMenu  MenuCompositing
+ I AddToMenu MenuCompositing DynamicPopupAction FuncMenuCompositing
+ I AddToMenu MenuCompositing "$[gt.Compositing]" Title
+ I AddToMenu MenuCompositing "$[gt.FNS CompMgr &Configurator]%CompConfigurator.svg:$[infostore.MenuIconSize]%"     Module FNS-CompConfigurator $[infostore.comp_command]
+ I Test (!EnvMatch use_composite 0) \
    AddToMenu MenuCompositing "$[gt.&Menu Transparency]%tint.svg:$[infostore.MenuIconSize]%"                        Popup MenuTintOps
+ I Test (!EnvMatch use_composite 0) \
    AddToMenu MenuCompositing "$[gt.Active Window &Opacity]%tint.svg:$[infostore.MenuIconSize]%"                    Popup MenuOpacityOps
+ I Test (!EnvMatch use_composite 0) \
    AddToMenu MenuCompositing "$[gt.Inactive Window &Transparency]%tint.svg:$[infostore.MenuIconSize]%"             Popup MenuTransparencyOps



#-----------------------------------------------------------------------
# Dynamic Configuration sub menu for setting a background with
# a picture or FvwmBaker (default background) 
# realized with MissingSubmenuFunction (for the pictures)
#-----------------------------------------------------------------------
AddToMenu MenuWallpaperConfiguration DynamicPopupAction FuncMenuWallpaperConfiguration

DestroyFunc FuncMenuWallpaperConfiguration
AddToFunc   FuncMenuWallpaperConfiguration
+ I DestroyMenu MenuWallpaperConfiguration
+ I AddToMenu MenuWallpaperConfiguration "$[gt.Background Configuration]" Title
+ I AddToMenu MenuWallpaperConfiguration DynamicPopupAction FuncMenuWallpaperConfiguration
+ I Test (EnvMatch DesktopIconsOn 0) Test (I $[infostore.fvwm_wallpaper]) \
    AddToMenu MenuWallpaperConfiguration "$[gt.Set &Default background]%delete.svg:$[infostore.MenuIconSize]%"          FuncDelWallpaperlink
+ I AddToMenu MenuWallpaperConfiguration MissingSubmenuFunction FuncWallpaperBrowser
+ I AddToMenu MenuWallpaperConfiguration "$[gt.Set &Wallpaper background]%background.svg:$[infostore.MenuIconSize]%"    Popup $[FVWM_USERDIR]/wallpapers

#-----------------------------------------------------------------------
# Screensaver sub menu for X configuration
#-----------------------------------------------------------------------
AddToMenu MenuXScreenSaver DynamicPopupAction FuncMenuXScreenSaver

DestroyFunc FuncMenuXScreenSaver
AddToFunc   FuncMenuXScreenSaver
+ I DestroyMenu MenuXScreenSaver
+ I AddToMenu MenuXScreenSaver DynamicPopupAction FuncMenuXScreenSaver
+ I AddToMenu MenuXScreenSaver "$[gt.Screen Saver]" Title
+ I AddToMenu MenuXScreenSaver "$[gt.XscreenSaver &Settings]%system2.svg:$[infostore.MenuIconSize]%"    Exec xscreensaver-command -exit; exec xscreensaver; exec xscreensaver-command -demo
+ I AddToMenu MenuXScreenSaver "$[gt.&XscreenSaver (Re)start]%restart.svg:$[infostore.MenuIconSize]%"   Exec xscreensaver-command -exit; exec xscreensaver -no-splash
+ I AddToMenu MenuXScreenSaver "$[gt.XscreenSaver &Stop]%stop.svg:$[infostore.MenuIconSize]%"           Exec exec xscreensaver-command -exit
+ I AddToMenu MenuXScreenSaver "$[gt.XscreenSaver &Lock]%lock.svg:$[infostore.MenuIconSize]%"           Exec exec q -lock
+ I AddToMenu MenuXScreenSaver "$[gt.XscreenSaver &Activate]%hook.svg:$[infostore.MenuIconSize]%"       Exec exec xscreensaver-command -activate


#=======================================================================
# 9.5 Fvwm Quit menu
#=======================================================================
AddToMenu MenuFvwmQuit DynamicPopupAction FuncMenuFvwmQuit

DestroyFunc FuncMenuFvwmQuit
AddToFunc   FuncMenuFvwmQuit
+ I SetMenuIconSize
+ I DestroyMenu MenuFvwmQuit
+ I AddToMenu MenuFvwmQuit DynamicPopupAction FuncMenuFvwmQuit
+ I AddToMenu MenuFvwmQuit "$[gt.Really Quit]?"     Title
+ I AddToMenu MenuFvwmQuit "$[gt.&Restart Fvwm]%restart.svg:$[infostore.MenuIconSize]%"         FuncRestart
+ I AddToMenu MenuFvwmQuit "" Nop
+ I AddToMenu MenuFvwmQuit "$[gt.Re&fresh Screen]%refresh.svg:$[infostore.MenuIconSize]%"       Refresh
+ I AddToMenu MenuFvwmQuit "" Nop
+ I AddToMenu MenuFvwmQuit "$[gt.&Suspend System]%suspend.svg:$[infostore.MenuIconSize]%"       FuncSuspend
+ I AddToMenu MenuFvwmQuit "$[gt.&Hibernate System]%hibernate.svg:$[infostore.MenuIconSize]%"   FuncHibernate
+ I AddToMenu MenuFvwmQuit "" Nop
+ I AddToMenu MenuFvwmQuit "$[gt.&Yes, Really Quit]%hook.svg:$[infostore.MenuIconSize]%"        Quit
+ I AddToMenu MenuFvwmQuit "$[gt.&No, Don't Quit]%exit.svg:$[infostore.MenuIconSize]%"          Nop


#=======================================================================
# 9.6 Window Ops menus
#=======================================================================
# This defines all window operations
AddToMenu MenuWindowOpsFull DynamicPopupAction FuncMenuWindowOpsFull

DestroyFunc FuncMenuWindowOpsFull
AddToFunc   FuncMenuWindowOpsFull
+ I SetMenuIconSize
+ I DestroyMenu MenuWindowOpsFull
+ I AddToMenu MenuWindowOpsFull DynamicPopupAction FuncMenuWindowOpsFull
+ I AddToMenu MenuWindowOpsFull "$[gt.Window Operations]" Title
+ I AddToMenu MenuWindowOpsFull "$[gt.&Move]	Alt+F7%window-move.svg:$[infostore.MenuIconSize]%"                  Move
+ I AddToMenu MenuWindowOpsFull "$[gt.&Resize]	Alt+F8%window-resize.svg:$[infostore.MenuIconSize]%"                Resize
+ I AddToMenu MenuWindowOpsFull "$[gt.(De)&Iconify]	Alt+F9%window-iconify.svg:$[infostore.MenuIconSize]%"           FuncIconify
+ I AddToMenu MenuWindowOpsFull "$[gt.(Un)Ma&ximize]	Alt+F10%window-maximize.svg:$[infostore.MenuIconSize]%"     Maximize
+ I AddToMenu MenuWindowOpsFull "$[gt.(Un)&Shade]%window-shade.svg:$[infostore.MenuIconSize]%"                      WindowShade
+ I AddToMenu MenuWindowOpsFull "$[gt.(Un)S&tick]%pin.svg:$[infostore.MenuIconSize]%"                               Stick "toggle"
+ I AddToMenu MenuWindowOpsFull "$[gt.R&aise]%arrow-up.svg:$[infostore.MenuIconSize]%"                              Raise
+ I AddToMenu MenuWindowOpsFull "$[gt.&Lower]%arrow-down.svg:$[infostore.MenuIconSize]%"                            Lower
+ I AddToMenu MenuWindowOpsFull "" Nop
+ I AddToMenu MenuWindowOpsFull "$[gt.&Delete]%bomb.svg:$[infostore.MenuIconSize]%"                                 Delete
+ I AddToMenu MenuWindowOpsFull "$[gt.&Close]	Alt+F4%exit.svg:$[infostore.MenuIconSize]%"                         Close
+ I AddToMenu MenuWindowOpsFull "$[gt.&Destroy]%destroy.svg:$[infostore.MenuIconSize]%"                             Destroy
+ I AddToMenu MenuWindowOpsFull "" Nop
+ I AddToMenu MenuWindowOpsFull "$[gt.Move to &Page]%window-move.svg:$[infostore.MenuIconSize]%"                    Popup MenuWindowMoveTo
+ I AddToMenu MenuWindowOpsFull "$[gt.&Group Operations]%windows.svg:$[infostore.MenuIconSize]%"                    Popup MenuWindowGroupOps
+ I AddToMenu MenuWindowOpsFull "$[gt.&Window Style]%window.svg:$[infostore.MenuIconSize]%"                         Popup MenuWindowStyle
+ I AddToMenu MenuWindowOpsFull "$[gt.&Maximize Window]%window-maximize.svg:$[infostore.MenuIconSize]%"             Popup MenuWindowMaximize
+ I AddToMenu MenuWindowOpsFull "$[gt.&Refresh Window]%window-refresh.svg:$[infostore.MenuIconSize]%"               Popup MenuWindowRefresh
+ I AddToMenu MenuWindowOpsFull "$[gt.R&earrange All]%windows-rearrange.svg:$[infostore.MenuIconSize]%"             Popup MenuRearrangeWindows
+ I AddToMenu MenuWindowOpsFull "$[gt.Window &Utilities]%window-utilities.svg:$[infostore.MenuIconSize]%"           Popup MenuWindowUtility
+ I AddToMenu MenuWindowOpsFull "" Nop
+ I AddToMenu MenuWindowOpsFull "$[gt.&Identify]	Alt+F12%question.svg:$[infostore.MenuIconSize]%"                Module FvwmIdent
+ I AddToMenu MenuWindowOpsFull "$[gt.Sw&itch to...(WinList)]	Alt+F3%windows.svg:$[infostore.MenuIconSize]%"      WindowList

#-----------------------------------------------------------------------
# A trimmed down version of MenuWindowOps, good for decoration bindings
#-----------------------------------------------------------------------
AddToMenu MenuWindowOpsTrimmed DynamicPopupAction FuncMenuWindowOpsTrimmed

DestroyFunc FuncMenuWindowOpsTrimmed
AddToFunc   FuncMenuWindowOpsTrimmed
+ I SetMenuIconSize
+ I DestroyMenu MenuWindowOpsTrimmed
+ I AddToMenu MenuWindowOpsTrimmed DynamicPopupAction FuncMenuWindowOpsTrimmed
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.Re&store]	Alt+F10%window-restore.svg:$[infostore.MenuIconSize]%"      FuncRestore
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.&Move]	Alt+F7%window-move.svg:$[infostore.MenuIconSize]%"              Move
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.&Resize]	Alt+F8%window-resize.svg:$[infostore.MenuIconSize]%"        Resize
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.&Iconify]	Alt+F9%window-iconify.svg:$[infostore.MenuIconSize]%"       FuncIconify
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.Ma&ximize]	Alt+F10%window-maximize.svg:$[infostore.MenuIconSize]%"     Maximize
+ I ThisWindow (Layer 2) \
    AddToMenu MenuWindowOpsTrimmed "$[gt.Stays On &Top]%arrow-up.svg:$[infostore.MenuIconSize]%"                FuncStaysOnTopAndBack
+ I TestRc (!Match) \
    AddToMenu MenuWindowOpsTrimmed "$[gt.Stays &Back]%arrow-down.svg:$[infostore.MenuIconSize]%"                FuncStaysOnTopAndBack
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.(Un)&Stick]%pin.svg:$[infostore.MenuIconSize]%"                        Stick "toggle"
+ I AddToMenu MenuWindowOpsTrimmed "" Nop
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.&Close]	Alt+F4%exit.svg:$[infostore.MenuIconSize]%"                 Close
+ I AddToMenu MenuWindowOpsTrimmed "" Nop
+ I Test (!EnvMatch use_composite 0) \
    AddToMenu MenuWindowOpsTrimmed "$[gt.Active Window &Opacity]%tint.svg:$[infostore.MenuIconSize]%"           Popup MenuOpacityOps
+ I Test (!EnvMatch use_composite 0) \
    AddToMenu MenuWindowOpsTrimmed "$[gt.Inactive Window &Transparency]%tint.svg:$[infostore.MenuIconSize]%"    Popup MenuTransparencyOps
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.&Identify]	Alt+F12%question.svg:$[infostore.MenuIconSize]%"            Module FvwmIdent
+ I AddToMenu MenuWindowOpsTrimmed "$[gt.Mor&e...]	%window.svg:$[infostore.MenuIconSize]%"                     Menu MenuWindowOpsFull This 0 0

#-----------------------------------------------------------------------
# Menu to move all windows of the same resource to another page
#-----------------------------------------------------------------------
AddToMenu MenuWindowGroupQuickMove DynamicPopupAction FuncMenuWindowGroupQuickMove

DestroyFunc FuncMenuWindowGroupQuickMove
AddToFunc   FuncMenuWindowGroupQuickMove
+ I SetMenuIconSize
+ I DestroyMenu MenuWindowGroupQuickMove
+ I AddToMenu MenuWindowGroupQuickMove DynamicPopupAction FuncMenuWindowGroupQuickMove
+ I PipeRead   'if [ $[infostore.x_desks] -gt 1 ]; then \
                    echo AddToMenu MenuWindowGroupQuickMove "$[gt.&Right\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"       Pick All \\($[w.resource]\\) MoveToPage +1p +0p; \
                    echo AddToMenu MenuWindowGroupQuickMove "$[gt.&Left\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"       Pick All \\($[w.resource]\\) MoveToPage -1p +0p; \
                fi'
+ I PipeRead   'if [ $[infostore.y_desks] -gt 1 ]; then \
                    echo AddToMenu MenuWindowGroupQuickMove "$[gt.D&own\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"       Pick All \\($[w.resource]\\) MoveToPage +0p +1p; \
                    echo AddToMenu MenuWindowGroupQuickMove "$[gt.&Up\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"           Pick All \\($[w.resource]\\) MoveToPage +0p -1p; \
                fi'
+ I AddToMenu MenuWindowGroupQuickMove "" Nop
+ I PipeRead   'fn=0; en=0; mv=1; \
                max=$(($[infostore.x_desks]*$[infostore.y_desks])); \
                while [ "$mv" -le "$max" ]; do \
                    if [ `expr $mv % 2` -eq 0 ]; then \
                        echo AddToMenu MenuWindowGroupQuickMove "&$mv.\\	$[gt.Page]%window-move.svg:$[infostore.MenuIconSize]%" Pick All \\($[w.resource]\\) FuncMoveWindowToPage $fn $en; \
                    else \
                        echo AddToMenu MenuWindowGroupQuickMove "&$mv.\\	$[gt.Page]%window-move.svg:$[infostore.MenuIconSize]%" Pick All \\($[w.resource]\\) FuncMoveWindowToPage $fn $en; \
                    fi; \
                    fn=$(($fn+1)); \
                    if [ "$mv" -eq "$[infostore.x_desks]" ]; then \
                        en=$(($en+1)); \
                        fn=0; \
                    fi; \
                mv=$(($mv+1)); \
                done'

#-----------------------------------------------------------------------
# Menu to move a window to left/right/1-n page
#-----------------------------------------------------------------------
AddToMenu MenuWindowMoveTo DynamicPopupAction FuncMenuWindowMoveTo

DestroyFunc FuncMenuWindowMoveTo
AddToFunc   FuncMenuWindowMoveTo
+ I SetMenuIconSize
+ I DestroyMenu MenuWindowMoveTo
+ I AddToMenu MenuWindowMoveTo DynamicPopupAction FuncMenuWindowMoveTo
+ I AddToMenu MenuWindowMoveTo "$[gt.Move to ...]" Title
+ I PipeRead   'if [ $[infostore.x_desks] -gt 1 ]; then \
                    echo AddToMenu MenuWindowMoveTo "$[gt.&Right\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"       FuncAnimatedMove w+100 w; \
                    echo AddToMenu MenuWindowMoveTo "$[gt.&Left\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"       FuncAnimatedMove w-100 w; \
                fi'
+ I PipeRead   'if [ $[infostore.y_desks] -gt 1 ]; then \
                    echo AddToMenu MenuWindowMoveTo "$[gt.D&own\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"       FuncAnimatedMove w w+100; \
                    echo AddToMenu MenuWindowMoveTo "$[gt.&Up\\	Page]%window-move.svg:$[infostore.MenuIconSize]%"           FuncAnimatedMove w w-100; \
                fi'
+ I AddToMenu MenuWindowMoveTo "" Nop
+ I PipeRead   'fn=0; en=0; mv=1; \
                max=$(($[infostore.x_desks]*$[infostore.y_desks])); \
                while [ "$mv" -le "$max" ]; do \
                    if [ `expr $mv % 2` -eq 0 ]; then \
                        echo AddToMenu MenuWindowMoveTo "&$mv.\\	$[gt.Page]%window-move.svg:$[infostore.MenuIconSize]%" FuncMoveWindowToPage $fn $en; \
                    else \
                        echo AddToMenu MenuWindowMoveTo "&$mv.\\	$[gt.Page]%window-move.svg:$[infostore.MenuIconSize]%" FuncMoveWindowToPage $fn $en; \
                    fi; \
                    fn=$(($fn+1)); \
                    if [ "$mv" -eq "$[infostore.x_desks]" ]; then \
                        en=$(($en+1)); \
                        fn=0; \
                    fi; \
                mv=$(($mv+1)); \
                done'

#-----------------------------------------------------------------------
# Sub menu for tint style
#-----------------------------------------------------------------------
AddToMenu MenuTintOps DynamicPopupAction FuncMenuTintOps

DestroyFunc FuncMenuTintOps
AddToFunc   FuncMenuTintOps
+ I DestroyMenu MenuTintOps
#+ I DestroyMenu recreate MenuTintOps
+ I AddToMenu MenuTintOps DynamicPopupAction FuncMenuTintOps
+ I PipeRead 'for percent in 0 10 20 30 40 50 60 70 80 90 100; do \
                if [ "$percent" = "$[infostore.used_menutint]" ]; then \
                    echo AddToMenu MenuTintOps \"$percent%%%hook.svg:$[infostore.MenuIconSize]%\" Nop; \
                else \
                    echo AddToMenu MenuTintOps \"$percent%%%empty.svg:$[infostore.MenuIconSize]%\" FuncUpdateMenuTint $percent; \
                fi; \
            done'

#-----------------------------------------------------------------------
# Sub menu for window opacity
#-----------------------------------------------------------------------
AddToMenu MenuOpacityOps DynamicPopupAction FuncMenuOpacityOps

DestroyFunc FuncMenuOpacityOps
AddToFunc   FuncMenuOpacityOps
+ I DestroyMenu MenuOpacityOps
#+ I DestroyMenu recreate MenuOpacityOps
+ I AddToMenu MenuOpacityOps DynamicPopupAction FuncMenuOpacityOps
+ I PipeRead 'for percent in 0 10 20 30 40 50 60 70 80 90 100; do \
                if [ "$percent" = "$[infostore.used_windowopacity]" ]; then \
                    echo AddToMenu MenuOpacityOps \"$percent%%%hook.svg:$[infostore.MenuIconSize]%\" Nop; \
                else \
                    echo AddToMenu MenuOpacityOps \"$percent%%%empty.svg:$[infostore.MenuIconSize]%\" FuncUpdateWindowOpacity $percent; \
                fi; \
            done'

#-----------------------------------------------------------------------
# Sub menu for window transparency
#-----------------------------------------------------------------------
AddToMenu MenuTransparencyOps DynamicPopupAction FuncMenuTransparencyOps

DestroyFunc FuncMenuTransparencyOps
AddToFunc   FuncMenuTransparencyOps
+ I DestroyMenu MenuTransparencyOps
#+ I DestroyMenu recreate MenuTransparencyOps
+ I AddToMenu MenuTransparencyOps DynamicPopupAction FuncMenuTransparencyOps
+ I PipeRead 'for percent in 0 10 20 30 40 50 60 70 80 90 100; do \
                if [ "$percent" = "$[infostore.used_windowtransparency]" ]; then \
                    echo AddToMenu MenuTransparencyOps \"$percent%%%hook.svg:$[infostore.MenuIconSize]%\" Nop; \
                else \
                    echo AddToMenu MenuTransparencyOps \"$percent%%%empty.svg:$[infostore.MenuIconSize]%\" FuncUpdateWindowTransparency $percent; \
                fi; \
            done'

#-----------------------------------------------------------------------
# Resource window group operations for the root menu and buttons
#-----------------------------------------------------------------------
AddToMenu MenuWindowGroupOps DynamicPopupAction FuncMenuWindowGroupOps

DestroyFunc FuncMenuWindowGroupOps
AddToFunc   FuncMenuWindowGroupOps
+ I SetMenuIconSize
+ I DestroyMenu MenuWindowGroupOps
+ I AddToMenu MenuWindowGroupOps DynamicPopupAction FuncMenuWindowGroupOps
+ I AddToMenu MenuWindowGroupOps "$[gt.Resource Group Ops]" Title
+ I AddToMenu MenuWindowGroupOps "$[gt.Iconify]%window-iconify.svg:$[infostore.MenuIconSize]%"          Pick All ($[w.resource]) Iconify on
+ I AddToMenu MenuWindowGroupOps "$[gt.De&Iconify]%window-iconify.svg:$[infostore.MenuIconSize]%"       Pick All ($[w.resource]) Iconify off
+ I AddToMenu MenuWindowGroupOps "$[gt.&Shade]%window-shade.svg:$[infostore.MenuIconSize]%"             Pick All ($[w.resource]) WindowShade on
+ I AddToMenu MenuWindowGroupOps "$[gt.Un&Shade]%window-shade.svg:$[infostore.MenuIconSize]%"           Pick All ($[w.resource]) WindowShade off
+ I AddToMenu MenuWindowGroupOps "$[gt.R&aise]%arrow-up.svg:$[infostore.MenuIconSize]%"                 Pick All ($[w.resource]) Raise
+ I AddToMenu MenuWindowGroupOps "$[gt.Lo&wer]%arrow-down.svg:$[infostore.MenuIconSize]%"               Pick All ($[w.resource]) Lower
+ I AddToMenu MenuWindowGroupOps "" Nop
+ I AddToMenu MenuWindowGroupOps "$[gt.&Delete]%bomb.svg:$[infostore.MenuIconSize]%"                    Pick All ($[w.resource]) Delete
+ I AddToMenu MenuWindowGroupOps "$[gt.&Close]%exit.svg:$[infostore.MenuIconSize]%"                     Pick All ($[w.resource]) Close
+ I AddToMenu MenuWindowGroupOps "$[gt.&Destroy]%destroy.svg:$[infostore.MenuIconSize]%"                Pick All ($[w.resource]) Destroy
+ I AddToMenu MenuWindowGroupOps "" Nop
+ I AddToMenu MenuWindowGroupOps "$[gt.&Quick Move To ...]%window-move.svg:$[infostore.MenuIconSize]%"  Popup MenuWindowGroupQuickMove

#-----------------------------------------------------------------------
# Windows Ops sub menu for window styling
#-----------------------------------------------------------------------
AddToMenu MenuWindowStyle DynamicPopupAction FuncMenuWindowStyle

DestroyFunc FuncMenuWindowStyle
AddToFunc   FuncMenuWindowStyle
+ I DestroyMenu MenuWindowStyle
+ I AddToMenu MenuWindowStyle DynamicPopupAction FuncMenuWindowStyle
+ I AddToMenu MenuWindowStyle "$[gt.Window Style]" Title
+ I AddToMenu MenuWindowStyle "$[gt.TitleAtT&op]%window.svg:$[infostore.MenuIconSize]%"             WindowStyle TitleAtTop
+ I AddToMenu MenuWindowStyle "$[gt.TitleAt&Bottom]%window.svg:$[infostore.MenuIconSize]%"          WindowStyle TitleAtBottom
+ I AddToMenu MenuWindowStyle "$[gt.&Title]%window.svg:$[infostore.MenuIconSize]%"                  WindowStyle Title
+ I AddToMenu MenuWindowStyle "$[gt.&NoTitle]%window.svg:$[infostore.MenuIconSize]%"                WindowStyle !Title
+ I AddToMenu MenuWindowStyle "" Nop
+ I AddToMenu MenuWindowStyle "$[gt.&FvwmBorder]%window.svg:$[infostore.MenuIconSize]%"             WindowStyle FvwmBorder
+ I AddToMenu MenuWindowStyle "$[gt.&MWMBorder]%window.svg:$[infostore.MenuIconSize]%"              WindowStyle MWMBorder
+ I AddToMenu MenuWindowStyle "$[gt.&DepressableBorder]%window.svg:$[infostore.MenuIconSize]%"      WindowStyle DepressableBorder
+ I AddToMenu MenuWindowStyle "$[gt.F&irmBorder]%window.svg:$[infostore.MenuIconSize]%"             WindowStyle FirmBorder
+ I AddToMenu MenuWindowStyle "$[gt.&Handles]%window.svg:$[infostore.MenuIconSize]%"                WindowStyle Handles
+ I AddToMenu MenuWindowStyle "$[gt.NoH&andles]%window.svg:$[infostore.MenuIconSize]%"              WindowStyle !Handles
+ I AddToMenu MenuWindowStyle "$[gt.BorderWidth &0]%window.svg:$[infostore.MenuIconSize]%"          WindowStyle BorderWidth 0
+ I AddToMenu MenuWindowStyle "$[gt.BorderWidth &5]%window.svg:$[infostore.MenuIconSize]%"          WindowStyle BorderWidth 5
+ I AddToMenu MenuWindowStyle "$[gt.Handle&Width 0]%window.svg:$[infostore.MenuIconSize]%"          WindowStyle HandleWidth 0
+ I AddToMenu MenuWindowStyle "$[gt.HandleWidth &7]%window.svg:$[infostore.MenuIconSize]%"          WindowStyle HandleWidth 7
+ I AddToMenu MenuWindowStyle "" Nop
+ I AddToMenu MenuWindowStyle "$[gt.Re&sizeOpaque]%window-resize.svg:$[infostore.MenuIconSize]%"    WindowStyle ResizeOpaque
+ I AddToMenu MenuWindowStyle "$[gt.Resi&zeOutline]%window-resize.svg:$[infostore.MenuIconSize]%"   WindowStyle ResizeOutline
+ I AddToMenu MenuWindowStyle "$[gt.S&loppyFocus]%mouse.svg:$[infostore.MenuIconSize]%"             WindowStyle SloppyFocus
+ I AddToMenu MenuWindowStyle "$[gt.&ClickToFocus]%mouse.svg:$[infostore.MenuIconSize]%"            WindowStyle ClickToFocus
+ I AddToMenu MenuWindowStyle "$[gt.Mo&useFocus]%mouse.svg:$[infostore.MenuIconSize]%"              WindowStyle MouseFocus
+ I AddToMenu MenuWindowStyle "$[gt.N&everFocus]%mouse.svg:$[infostore.MenuIconSize]%"              WindowStyle NeverFocus

#-----------------------------------------------------------------------
# Windows Ops sub menu for maximize windows
#-----------------------------------------------------------------------
AddToMenu MenuWindowMaximize DynamicPopupAction FuncMenuWindowMaximize

DestroyFunc FuncMenuWindowMaximize
AddToFunc   FuncMenuWindowMaximize
+ I SetMenuIconSize
+ I DestroyMenu MenuWindowMaximize
+ I AddToMenu MenuWindowMaximize DynamicPopupAction FuncMenuWindowMaximize
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize Window]" Title
+ I AddToMenu MenuWindowMaximize "$[gt.&Maximize Fully]%window-maximize.svg:$[infostore.MenuIconSize]%"                         Maximize On 100 100
+ I AddToMenu MenuWindowMaximize "$[gt.&Unmaximize]%window-unmaximize.svg:$[infostore.MenuIconSize]%"                           Maximize Off
+ I AddToMenu MenuWindowMaximize "" Nop
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize &Vertically]%window-maximize-vertical.svg:$[infostore.MenuIconSize]%"           Pick FuncSimpleMaximizeVertically On
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize &Horizontally]%window-maximize-horizontal.svg:$[infostore.MenuIconSize]%"       Pick FuncSimpleMaximizeHorizontally On
+ I AddToMenu MenuWindowMaximize "" Nop
# these bound functions do not seem to work well if used consequentially
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize &Grow]%window-smart-maximize.svg:$[infostore.MenuIconSize]%"                    Maximize On grow grow
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize &Smart]%window-smart-maximize.svg:$[infostore.MenuIconSize]%"                   SendToModule FvwmSmartMaximize IgnoreMaxWindows screen
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize Grow V&ert.]%window-grow-vertical.svg:$[infostore.MenuIconSize]%"               Maximize On    0 grow
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize Grow H&oriz.]%window-grow-horizontal.svg:$[infostore.MenuIconSize]%"            Maximize On grow    0
+ I AddToMenu MenuWindowMaximize "" Nop
+ I AddToMenu MenuWindowMaximize "$[gt.Maximize &Full Screen]	Alt+F11%window-maximize-fs.svg:$[infostore.MenuIconSize]%"      Pick FuncMaximizeFullScreen
+ I AddToMenu MenuWindowMaximize "$[gt.&Unmaximize Full Screen]	Alt+F11%window-unmaximize-fs.svg:$[infostore.MenuIconSize]%"    Pick FuncMaximizeFullScreen

#-----------------------------------------------------------------------
# Windows Ops sub menu for window refreshing
#-----------------------------------------------------------------------
AddToMenu MenuWindowRefresh DynamicPopupAction FuncMenuWindowRefresh

DestroyFunc FuncMenuWindowRefresh
AddToFunc   FuncMenuWindowRefresh
+ I DestroyMenu MenuWindowRefresh
+ I AddToMenu MenuWindowRefresh DynamicPopupAction FuncMenuWindowRefresh
+ I AddToMenu MenuWindowRefresh "$[gt.Refresh Window]" Title
+ I AddToMenu MenuWindowRefresh "$[gt.Re&fresh Window]%window-refresh.svg:$[infostore.MenuIconSize]%"       RefreshWindow
+ I AddToMenu MenuWindowRefresh "$[gt.Re&capture Window]%window-recapture.svg:$[infostore.MenuIconSize]%"   RecaptureWindow
+ I AddToMenu MenuWindowRefresh "$[gt.&Place Again]%window-replace.svg:$[infostore.MenuIconSize]%"          PlaceAgain anim
+ I AddToMenu MenuWindowRefresh "" Nop
+ I AddToMenu MenuWindowRefresh "$[gt.&Restore]%window-restore.svg:$[infostore.MenuIconSize]%"              FuncRestore

#-----------------------------------------------------------------------
# Windows Ops sub menu for window rearranging
#-----------------------------------------------------------------------
AddToMenu MenuRearrangeWindows DynamicPopupAction FuncMenuRearrangeWindows

DestroyFunc FuncMenuRearrangeWindows
AddToFunc   FuncMenuRearrangeWindows
+ I DestroyMenu MenuRearrangeWindows
+ I AddToMenu MenuRearrangeWindows DynamicPopupAction FuncMenuRearrangeWindows
+ I AddToMenu MenuRearrangeWindows "$[gt.Rearrange Windows]" Title
+ I AddToMenu MenuRearrangeWindows "$[gt.&Cascade]%windows-rearrange.svg:$[infostore.MenuIconSize]%"                    FvwmRearrange -cascade -m 3 3 -incx 2
+ I AddToMenu MenuRearrangeWindows "$[gt.&Place Again]%window-replace.svg:$[infostore.MenuIconSize]%"                   All (CurrentPage !Sticky) PlaceAgain anim
+ I AddToMenu MenuRearrangeWindows "" Nop
+ I AddToMenu MenuRearrangeWindows "$[gt.Tile &horizontally]%windows-tile-horizontal.svg:$[infostore.MenuIconSize]%"    FvwmRearrange -tile -h -m 2 2 98 98
+ I AddToMenu MenuRearrangeWindows "$[gt.Tile &vertically]%windows-tile-vertical.svg:$[infostore.MenuIconSize]%"        FvwmRearrange -tile    -m 2 2 98 98
+ I AddToMenu MenuRearrangeWindows "" Nop
+ I AddToMenu MenuRearrangeWindows "$[gt.&Arrange Icons]%window-icons.svg:$[infostore.MenuIconSize]%"                   All (CurrentDesk Iconic) RecaptureWindow

#-----------------------------------------------------------------------
# Windows Ops sub menu for window utilities like screenshot, layer, etc
#-----------------------------------------------------------------------
AddToMenu MenuWindowUtility DynamicPopupAction FuncMenuWindowUtility

DestroyFunc FuncMenuWindowUtility
AddToFunc   FuncMenuWindowUtility
+ I DestroyMenu MenuWindowUtility
+ I AddToMenu MenuWindowUtility DynamicPopupAction FuncMenuWindowUtility
+ I AddToMenu MenuWindowUtility "$[gt.Window Utilities]" Title
+ I AddToMenu MenuWindowUtility "$[gt.Create &Screenshot]	Print%window.svg:$[infostore.MenuIconSize]%"        Pick (CirculateHit) FuncWindowCreateScreenshot
+ I AddToMenu MenuWindowUtility "$[gt.&Desktop Screenshot]	Alt+Print%display.svg:$[infostore.MenuIconSize]%"   FuncDesktopCreateScreenshot 5
+ I AddToMenu MenuWindowUtility "" Nop
+ I AddToMenu MenuWindowUtility "$[gt.Stays On &Top]%layer-top.svg:$[infostore.MenuIconSize]%"                  Pick (CirculateHit) Layer 0 6
+ I AddToMenu MenuWindowUtility "$[gt.Layer &+1]%layer-+1.svg:$[infostore.MenuIconSize]%"                       Pick (CirculateHit) Layer +1
+ I AddToMenu MenuWindowUtility "$[gt.Stays &Put]%layer-put.svg:$[infostore.MenuIconSize]%"                     Pick (CirculateHit) Layer 0 4
+ I AddToMenu MenuWindowUtility "$[gt.Layer &-1]%layer--1.svg:$[infostore.MenuIconSize]%"                       Pick (CirculateHit) Layer -1
+ I AddToMenu MenuWindowUtility "$[gt.Stays On &Bottom]%layer-bottom.svg:$[infostore.MenuIconSize]%"            Pick (CirculateHit) Layer 0 2
+ I AddToMenu MenuWindowUtility "" Nop
+ I AddToMenu MenuWindowUtility "$[gt.ScrollBar (1/2 &app)]%window-scrollbar.svg:$[infostore.MenuIconSize]%"    Pick Module FvwmScroll 2 2
+ I AddToMenu MenuWindowUtility "$[gt.ScrollBar (75%% &scr)]%window-scrollbar.svg:$[infostore.MenuIconSize]%"   Pick Module FvwmScroll 75p 75p

#-----------------------------------------------------------------------
# Desktop Ops menus
#-----------------------------------------------------------------------
AddToMenu MenuDesktopOps DynamicPopupAction FuncMenuDesktopOps

DestroyFunc FuncMenuDesktopOps
AddToFunc   FuncMenuDesktopOps
+ I SetMenuIconSize
+ I DestroyMenu MenuDesktopOps
+ I AddToMenu MenuDesktopOps DynamicPopupAction FuncMenuDesktopOps
+ I AddToMenu MenuDesktopOps "$[gt.Desktopmenu]" Title
+ I AddToMenu MenuDesktopOps MissingSubmenuFunction FuncMenuWallpaperConfiguration
+ I AddToMenu MenuDesktopOps "$[gt.Configure &Background]%background.svg:$[infostore.MenuIconSize]%"    Popup MenuWallpaperConfiguration
+ I Test (!EnvMatch use_composite 0) \
    AddToMenu MenuDesktopOps "$[gt.&Menu Transparency]%tint.svg:$[infostore.MenuIconSize]%"             Popup MenuTintOps
+ I Test (EnvMatch DesktopIconsOn 0) \
	AddToMenu MenuDesktopOps "$[gt.Help]%help.svg:$[infostore.MenuIconSize]%"                           Popup MenuHelp
+ I TestRc (!Match) \
    AddToMenu MenuDesktopOps "$[gt.Desktop Preferences]%pcmanfm.svg:$[infostore.MenuIconSize]%"    		Exec exec pcmanfm --desktop-pref
+ I AddToMenu MenuDesktopOps "" Nop
+ I Test (EnvMatch DesktopIconsOn 0) \
    AddToMenu MenuDesktopOps "$[gt.Window Operations]%window.svg:$[infostore.MenuIconSize]%"            Popup MenuWindowOpsFull
+ I Test (EnvMatch DesktopIconsOn 1) \
    AddToMenu MenuDesktopOps "$[gt.Root Menu]%icon_fns.svg:$[infostore.MenuIconSize]%"            		Popup MenuRoot

#-----------------------------------------------------------------------
# Clock Ops menu
#-----------------------------------------------------------------------
AddToMenu MenuClockOps DynamicPopupAction FuncMenuClockOps

DestroyFunc FuncMenuClockOps
AddToFunc   FuncMenuClockOps
+ I SetMenuIconSize
+ I DestroyMenu MenuClockOps
+ I AddToMenu MenuClockOps DynamicPopupAction FuncMenuDesktopOps
+ I AddToMenu MenuClockOps "$[gt.Conky Clock Ops]" Title
+ I AddToMenu MenuClockOps "$[gt.Calender]%Kalende.svg:$[infostore.MenuIconSize]%"              FvwmScript FNS-Applet-Kalende -fns -s
+ I AddToMenu MenuClockOps "$[gt.Alarm]%Chrono.svg:$[infostore.MenuIconSize]%"                  FvwmScript FNS-Applet-Chrono -fns -s
+ I AddToMenu MenuClockOps "" Nop
+ I AddToMenu MenuClockOps "$[gt.Set Date/Time]%system.svg:$[infostore.MenuIconSize]%"          FvwmScript FNS-Script-Date
+ I AddToMenu MenuClockOps "$[gt.Restart Conky Clock]%restart.svg:$[infostore.MenuIconSize]%"   Exec exec xkill -id `xwininfo -name conky_clock|grep "Window id"|cut -d ' ' -f4`

#-----------------------------------------------------------------------
# CPU Ops menu
#-----------------------------------------------------------------------
AddToMenu MenuCpuOps DynamicPopupAction FuncMenuCpuOps

DestroyFunc FuncMenuCpuOps
AddToFunc   FuncMenuCpuOps
+ I SetMenuIconSize
+ I DestroyMenu MenuCpuOps
+ I AddToMenu MenuCpuOps DynamicPopupAction FuncMenuCpuOps
+ I AddToMenu MenuCpuOps "$[gt.Conky Cpu Ops]" Title
+ I AddToMenu MenuCpuOps "$[gt.CPU Performance]%cpu.svg:$[infostore.MenuIconSize]%"          Exec exec FNS-CpuPerformance
+ I AddToMenu MenuCpuOps "" Nop
+ I AddToMenu MenuCpuOps "$[gt.Restart Conky CPU]%restart.svg:$[infostore.MenuIconSize]%"       Exec exec xkill -id `xwininfo -name conky_cpu|grep "Window id"|cut -d ' ' -f4`


#-----------------------------------------------------------------------
# user speific changes
#-----------------------------------------------------------------------
Test (f $[FVWM_USERDIR]/.user) Load .user
