# metisse rc revision 10
#

# It is preferable to do not edit this files. Edit: applications, background,
# bindings-functions, desks, extra, fonts, menustyle, styles
#
# If you really need, edit: bindings, panels, menus and metisserc
#

# ---------------------------------------------------------------------------
# the following commands should not be changed/override  
# ---------------------------------------------------------------------------

EdgeScroll 0 0
EdgeThickness 0
EdgeResistance 0 0

# out line move and resize does not work well
OpaqueMoveSize unlimited
Style * ResizeOpaque

# We need SloopyFocus for certain compositor auto mode, see below

# do not use icons (should work any way)
Style * NoIcon

ModuleTimeout 5


# ---------------------------------------------------------------------------
# start function(s)
# ---------------------------------------------------------------------------

# define the background: AFuncSetBackground
read background

# always executed (start, restart, session)
DestroyFunc StartFunction
AddToFunc   StartFunction
#+ I FvwmTrace -n fmtrace
# set the root bg
+ I AFuncSetBackground
# start the event handler
+ I ModuleSynchronous FvwmEvent FvwmEvent-EventsHandler
# start our panel
+ I FuncStartFuncStartPanel
+ I Echo fvwmi StartFunction executed

# only executed at start without a session manager (not restart)
DestroyFunc InitFunction
AddToFunc   InitFunction
+ I Echo fvwmi InitFunction executed

# as above under a session manager
DestroyFunc SessionInitFunction
AddToFunc   SessionInitFunction
+ I Echo fvwmi SessionInitFunction executed

# only executed at restart without a session manager (not start)
DestroyFunc RestartFunction
AddToFunc   RestartFunction
+ I Echo fvwmi RestartFunction executed

# as above under a session manager
DestroyFunc SessionRestartFunction
AddToFunc   SessionRestartFunction
+ I Echo fvwmi SessionRestartFunction executed

DestroyFunc ExitFunction
AddToFunc   ExitFunction
+ I Test (Quit) Echo fvwmi ExitFunction quiting 
+ I Test (ToRestart) Echo fvwmi ExitFunction to restart
 
DestroyFunc SessionExitFunction
AddToFunc   SessionExitFunction
+ I Test (Quit) Exec killall Xmetisse
+ I Test (Quit) Echo fvwmi SessionExitFunction quiting
+ I Test (ToRestart) Echo fvwmi SessionExitFunction to restart

# ---------------------------------------------------------------------------
# Desk config (e.g., number of desks)
# ---------------------------------------------------------------------------

read desks

# ---------------------------------------------------------------------------
# mini-icons
# ---------------------------------------------------------------------------

# support fot wm-icons ...
DestroyFunc AFuncSetupWmIcon
AddToFunc   AFuncSetupWmIcon
+ I PipeRead 'echo Read `wm-icons-config --inst-dir`/../../wm-icons/fvwm2rc-wm-icons'
+ I Style * NoIcon
+ I Style * EWMHNoMiniIconOverride
+ I Mouse 3 R CM -
+ I DestroyMenu "Window-Ops"
+ I DestroyMenu "Quit-Verify"

DestroyFunc AFuncTestSetupWmIcon
AddToFunc   AFuncTestSetupWmIcon
+ I Test (x wm-icons-config)   AFuncSetupWmIcon
+ I TestRc (Match) Break
+ I Read $[FVWM_CONFIG_DIR]/opale-common/styles-mini-icons'

# do not use wm-icons 
# AFuncTestSetupWmIcon
Read $[FVWM_CONFIG_DIR]/opale-common/styles-mini-icons'

#MiniIconSize 18 18
Style * NoIcon
Style * EWMHNoMiniIconOverride
Style * EWMHDonateIcon

# ---------------------------------------------------------------------------
# global feel (focus, placement policy, ...) and specific style
# ---------------------------------------------------------------------------

DestroyFunc AFuncWindowThemesOverride
AddToFunc   AFuncWindowThemesOverride

read styles

# ---------------------------------------------------------------------------
# Mouse and Key Bindings
# ---------------------------------------------------------------------------

# NOTE: it is better to edit functions-bindings than bindings

# define some generic functions for window bindings
read bindings-functions

# the real bindings
read bindings

read stroke

# ---------------------------------------------------------------------------
# fonts
# ---------------------------------------------------------------------------

read fonts

# ---------------------------------------------------------------------------
# Modules (The Panels and some related stuff)
# ---------------------------------------------------------------------------

Read panels

# ---------------------------------------------------------------------------
# set the general colorset (see the colours theme)
# ---------------------------------------------------------------------------

DefaultColorset 0

Style * Colorset 1, HilightColorset 2
Style * IconTitleColorset 1, HilightIconTitleColorset 2

TitleStyle AllInActive Colorset 1
TitleStyle AllActive Colorset 2

# nect are redifined in colours themes
BorderStyle InActive Colorset 3
BorderStyle Active Colorset 4
Style * BorderColorset 3
Style * HilightBorderColorset 4

# Better with Xmetisse ...
Style * IconBackgroundColorset 1

# ---------------------------------------------------------------------------
# Theme Window + Colours Theme
# ---------------------------------------------------------------------------

DestroyFunc FuncTheme
AddToFunc   FuncTheme
+ I read themes/$0.theme
+ I read menustyle
#
+ I DestroyFunc FuncConfigMenuCurrentTheme
+ I AddToFunc   FuncConfigMenuCurrentTheme
+ I + I + "Current: $0"
#
+ I FuncThemeUpdateMenu
#
+ I AFuncWindowThemesOverride
#
+ I DestroyFunc FuncSaveConfigTheme
+ I AddToFunc   FuncSaveConfigTheme
+ I + I Exec echo "FuncTheme $0" >> $[FVWM_USERDIR]/.aconfig
+ I AFuncSaveConfig

DestroyFunc FuncThemeUpdateMenu
AddToFunc   FuncThemeUpdateMenu
+ I DestroyMenu MenuConfigTheme
+ I AddToMenu   MenuConfigTheme "Themes" Title
+ I PipeRead 'for f in `ls $[FVWM_USERDIR]/themes/*.theme`; do \
	cmd=`basename $$f | sed -e s/\.theme//`; \
	title=`basename $$f | sed -e s/\.theme//`; \
	echo "+ \"$$title\" FuncTheme $$cmd"; \
    done
+ I + "" Nop
+ I FuncConfigMenuCurrentTheme


# ---------------------------------------------------------------------------
# Our general propose Event Handler 
# ---------------------------------------------------------------------------

DestroyModuleConfig FvwmEvent-EventsHandler: *

*FvwmEvent-EventsHandler: PassId
*FvwmEvent-EventsHandler: startup		AEFuncStartup
*FvwmEvent-EventsHandler: enter_window		AEFuncEnterWindow
*FvwmEvent-EventsHandler: leave_window		AEFuncLeaveWindow
*FvwmEvent-EventsHandler: configure_window 	AEFuncConfigureWindow
*FvwmEvent-EventsHandler: add_window 		AEFuncAddWindow
*FvwmEvent-EventsHandler: focus_change 		AEFuncFocusChange
#*FvwmEvent-EventsHandler: raise_window 	AEFuncRaise

#DestroyFunc AEFuncRaise
#AddToFunc   AEFuncRaise
#+ I sma Scale 1.1111111
#+ I sma Scale 0.9

DestroyFunc FuncEnterWindowAutoRaisePanel
AddToFunc   FuncEnterWindowAutoRaisePanel
+ I All (FvwmPager-Swallowed-Panel) Raise
+ I All (FvwmButtons-Panel*) Raise

DestroyFunc FuncEnterWindowAutoRaise
AddToFunc   FuncEnterWindowAutoRaise
#+ I WindowId $0 (FvwmButtons-Panel*)  FuncEnterWindowAutoRaisePanel
+ I WindowId $0 (FvwmButtons-Panel*)  Raise
+ I WindowId $0 (FvwmPager) Raise
+ I WindowId $0 (FvwmTaskBar) Raise
+ I WindowId $0 (gnome-panel) Raise
+ I WindowId $0 (kicker) Raise
+ I WindowId $0 (fvwm_menu) Raise

DestroyFunc AEFuncEnterWindow
AddToFunc   AEFuncEnterWindow
+ I Deschedule 6 
+ I Schedule 300 6 FuncEnterWindowAutoRaise $0
+ I FuncShaderEnterWindow
# ...etc.

DestroyFunc AEFuncLeaveWindow
AddToFunc   AEFuncLeaveWindow
+ I FuncShaderLeaveWindow

DestroyFunc AEFuncAddWindow
AddToFunc   AEFuncAddWindow
+ I FuncShaderAddWindow

DestroyFunc AEFuncConfigureWindow
AddToFunc   AEFuncConfigureWindow


DestroyFunc AEFuncStartup
AddToFunc   AEFuncStartup

DestroyFunc AEFuncFocusChange
AddToFunc   AEFuncFocusChange
#+ I All (Gaim Focused) sma SetTransparency 1.0
#+ I All (Gaim !Focused) sma SetTransparency 0.5


read shading

# -----------------------------------------------------------------------------
# Config Stuff
# -----------------------------------------------------------------------------

# --------------------------------------
# Configurable Move
 
DestroyFunc AFuncConfigMoveTransparencyUpdateMenu
AddToFunc   AFuncConfigMoveTransparencyUpdateMenu
+ I DestroyMenu AMenuConfigMoveTransparency
+ I AddToMenu   AMenuConfigMoveTransparency "Transparency" Title
+ I + "1 (None)" AFuncConfigMoveTransparency 1
+ I + "0.9" AFuncConfigMoveTransparency 0.9
+ I + "0.8" AFuncConfigMoveTransparency 0.8
+ I + "0.7" AFuncConfigMoveTransparency 0.7
+ I + "0.6" AFuncConfigMoveTransparency 0.6
+ I + "0.5" AFuncConfigMoveTransparency 0.5
+ I + "0.4" AFuncConfigMoveTransparency 0.4
+ I + "0.3" AFuncConfigMoveTransparency 0.3
+ I + "0.2" AFuncConfigMoveTransparency 0.2
+ I + "0.1" AFuncConfigMoveTransparency 0.1
+ I + "" Nop
+ I AFuncConfigMenuCurrentMoveTransparency

DestroyFunc AFuncConfigMoveTransparency
AddToFunc   AFuncConfigMoveTransparency
+ I DestroyFunc AFuncMove
+ I AddToFunc   AFuncMove
+ I + I ModuleWindowOperation FvwmCompositor Move MOVE $0
#
+ I DestroyFunc AFuncTmpMove
+ I AddToFunc   AFuncTmpMove
+ I + I ModuleWindowOperation FvwmCompositor TmpMove MOVE 1.0
#
+ I DestroyFunc  AFuncConfigMenuCurrentMoveTransparency
+ I AddToFunc    AFuncConfigMenuCurrentMoveTransparency
+ I + I AddToMenu AMenuConfigMoveTransparency "Current: $0"
#
+ I AFuncConfigMoveTransparencyUpdateMenu
#
+ I DestroyFunc AFuncSaveConfigMoveTransparency
+ I AddToFunc   AFuncSaveConfigMoveTransparency
+ I + I Exec echo "AFuncConfigMoveTransparency $0" >> $[FVWM_USERDIR]/.aconfig
+ I AFuncSaveConfig

# See also the Config section below

# -------------------------------------
# Resize Transparency Config
 
DestroyFunc AFuncConfigResizeTransparencyUpdateMenu
AddToFunc   AFuncConfigResizeTransparencyUpdateMenu
+ I DestroyMenu AMenuConfigResizeTransparency
+ I AddToMenu   AMenuConfigResizeTransparency "Transparency" Title
+ I + "1 (None)" AFuncConfigResizeTransparency 1
+ I + "0.9" AFuncConfigResizeTransparency 0.9
+ I + "0.8" AFuncConfigResizeTransparency 0.8
+ I + "0.7" AFuncConfigResizeTransparency 0.7
+ I + "0.6" AFuncConfigResizeTransparency 0.6
+ I + "0.5" AFuncConfigResizeTransparency 0.5
+ I + "0.4" AFuncConfigResizeTransparency 0.4
+ I + "0.3" AFuncConfigResizeTransparency 0.3
+ I + "0.2" AFuncConfigResizeTransparency 0.2
+ I + "0.1" AFuncConfigResizeTransparency 0.1
+ I + "" Nop
+ I AFuncConfigMenuCurrentResizeTransparency

DestroyFunc AFuncConfigResizeTransparency
AddToFunc   AFuncConfigResizeTransparency
+ I sma ResizeTransparency $0
#
+ I DestroyFunc  AFuncConfigMenuCurrentResizeTransparency
+ I AddToFunc    AFuncConfigMenuCurrentResizeTransparency
+ I + I AddToMenu AMenuConfigResizeTransparency "Current: $0"
#
+ I AFuncConfigResizeTransparencyUpdateMenu
#
+ I DestroyFunc AFuncSaveConfigResizeTransparency
+ I AddToFunc   AFuncSaveConfigResizeTransparency
+ I + I Exec echo "AFuncConfigResizeTransparency $0" >> $[FVWM_USERDIR]/.aconfig
+ I AFuncSaveConfig


# -----------------------------------
# Default and saved config

DestroyFunc AFuncSaveConfig
AddToFunc   AFuncSaveConfig

DestroyFunc AFuncUpdateConfigMenu
AddToFunc   AFuncUpdateConfigMenu

# Default Config
DestroyFunc FuncLoadDefaultConfig
AddToFunc   FuncLoadDefaultConfig
+ I FuncTheme Metisse
+ I AFuncConfigMoveTransparency 0.7
+ I AFuncConfigResizeTransparency 0.7
+ I FuncPanConfigPanel Panel $[vp.width] 22 +0-0 12 22 16x16/ 176 12
+ I FuncPanConfigWindowListResolution Page
+ I Echo Default Config Loaded

SetEnv METISSERC_DEF_CONFIG_VER 0
read .aconfig

Test (!EnvMatch METISSERC_DEF_CONFIG_VER 2) FuncLoadDefaultConfig

# ---------------------------------------------------------------------------
# menus styles
# ---------------------------------------------------------------------------

# already read in .aconfig or via the default config
#read menustyle

# ---------------------------------------------------------------------------
# some menus (root, window ops, ..., Programs is in "applications")
# ---------------------------------------------------------------------------

read menus

# ---------------------------------------------------------------------------
#  Aplications
# ---------------------------------------------------------------------------

# Edit this file to setup your prefered applications
Read applications

# ---------------------------------------------------------------------------
# Should be defined only now!

DestroyFunc AFuncSaveConfig
AddToFunc   AFuncSaveConfig
+ I PipeRead 'echo "#Automatically generated!" > $[FVWM_USERDIR]/.aconfig'
+ I PipeRead 'echo "SetEnv METISSERC_DEF_CONFIG_VER 2" >> $[FVWM_USERDIR]/.aconfig'
+ I AFuncSaveConfigMoveTransparency
+ I AFuncSaveConfigResizeTransparency
+ I FuncSaveConfigTheme
+ I FuncPanSaveConfigModulePanel
+ I FuncPanSaveConfigWindowListResolution

# -----------------------------------
# Configuration menu

DestroyMenu AMenuConfig
AddToMenu   AMenuConfig "WM Configuration" Title
+ "Move Transparency"		Popup AMenuConfigMoveTransparency
+ "Resize Transparency"		Popup AMenuConfigResizeTransparency
+ "Themes" 			Popup MenuConfigTheme
+ "Panel Config"		Popup MenuModConfigPanel
+ "Extended Inputs"		Popup MenuInterExtendedInputs
+ "" TearMenuOff

# ------------------------------------------------------------------------------
# For more user customization
# ------------------------------------------------------------------------------

Silent read extra
