fvwm-ewmh: sample.fvwm-ewmh


# ------------- FVWM EWMH sample configuration -------------

# ------------------------
# 1. Starting FvwmNetHints
# ------------------------

### You should choose one of the next 3 methods.

# fvwm-themes users can add this in the personal startup (or startup-extra)
# component (and select this component).

# method 1: Always start FvwmNetHints:
AddToFunc StartFunction  I Module FvwmNetHints

# method 2: To start it only when fvwm2 is started by a session manager
# (e.g., ksmserver or gnome-session)
# AddToFunc SessionInitFunction  I Module FvwmNetHints
# AddToFunc SessionRestartFunction  I Module FvwmNetHints

# method 3: to start it only when fvwm2 is not started by a session manager
# AddToFunc InitFunction  I Module FvwmNetHints
# AddToFunc RestartFunction  I Module FvwmNetHints

# You may also want to be able to restart or stop it via a menu.
# Note that if you start a copy of FvwmNetHints and one already run, the
# old copy will be burned.
# Here an example for fvwm-themes users (put this, says, in your personal
# modules-extra component).
DestroyFunc FuncFvwmRestartFvwmNetHints
AddToFunc   FuncFvwmRestartFvwmNetHints
+ I SendToModule FvwmNetHints Quit
+ I Module FvwmNetHints

AddToMenu MenuFvwmStartRegularModules "EWMH Support%menu/windows.xpm%" \
	FuncFvwmRestartFvwmNetHints
AddToMenu MenuFvwmStopRegularModules "Stop EWMH Support%menu/windows.xpm%" \
	SendToModule FvwmNetHints Quit


# --------------------------------------------------------------
# 2. Module config and styles for special compliant applications
# --------------------------------------------------------------

# fvwm-themes user: put this section in modules-extra
# other user: put this section after you have defined your "general style".

# ---------- FvwmNetHints Configuration options

# defaults are good in my opinion :o), see the man page!
# However here a few suggestions

DestroyModuleConfig FvwmNetHints*

# Number of desktop at startup to be displayed in a compliant pager:
*FvwmNetHints: NumberOfDesktops 4

# if you do not like stay on top application:
#*FvwmNetHints: AcceptStaysOnTop False
# really you do not like it (4 = default default layer):
#*FvwmNetHints: MenuNetStyle Layer 4

# Animation: work with kicker, but you should not (re)start FvwmNetHints
# when kicker is masked and the result of the animation is false if kicker
# is masked (bug in the EWMH spec.) 
*FvwmNetHints: NoIconAction SendToModule FvwmAnimate animate


# When you use animation you must use a complex function here.
*FvwmNetHints: ActivateWindowCmd FuncFvwmDeiconifyFocusAndRaise

# Note: if you are not a fvwm-themes user you should define the function
# FuncFvwmDeiconifyFocusAndRaise or replace it by your own:
#DestroyFunc FuncFvwmDeiconifyFocusAndRaise
#AddToFunc   FuncFvwmDeiconifyFocusAndRaise
#+ I Iconify off
#+ I Focus
#+ I Raise

# if you want that the fvwm2 MiniIcon styles apply to non NET hints
# compliant app
*FvwmNetHints: SendMiniIcon All

# A good idea:
*FvwmNetHints: UseExtendedName True

# Since version 0.6, the default to UseWorkAreaPlacement is True (safe)
# If you experiment strange window placement you may try to uncomment
# the "next" line (try also the MaxWindowSize, NoPPosition and NoUsePosition
# fvwm2 styles).
#*FvwmNetHints: UseWorkAreaPlacement False

# ---------- FvwmPager config:

# if you use a desktop application you should add
# "*PagerAliseName: UseListSkip"
# for your pagers with name "PagerAliseName". 
# For fvwm-themes:
*FvwmPager-Desker: UseListSkip
*FvwmPager-Single: UseListSkip

# ---------- Default layer Workaround:

# if you use the the DefaultLayer fvwm2 command to change the Default layer:
#*FvwmNetHints: StaysPutLayer l
#*FvwmNetHints: StaysOnTopLayer k
# where l and k are the new stays put and stays on top layer (respectively)
  
# ---------- Startup Workaround: 
# (to fix that we should not use a module(?))

# to get a clean start up with kdedesktop
Style "KDE Desktop" Sticky,WindowListSkip,CirculateSkip,BorderWidth 0,\
	HandleWidth 0, NoTitle

# ---------- Focus Workaround:
 
# I hope that all this will be not needed in the future:

# if you use kicker: forbid beep (grab problem?) when popup a kicker menu
*FvwmNetHints: DockNetStyle Focus
# then you should decides the kicker focus policy (not NeverFocus)
# So that kicker do not take the focus too often
Style "kicker" ClickToFocus

# now if you use the KDE Desktop:
# 
# Really needed (Grrrr!!):
*FvwmNetHints: DesktopNetStyle Focus
*FvwmNetHints: DesktopMenuStyle Focus
# For a SloppyFocus user:
Style "KDE Desktop" ClickToFocus
# For a MouseFocus (or SloppyFocus) user
#Style "KDE Desktop" MouseFocus
# For a ClickToFocus User:
#Style "KDE Desktop" ClickToFocus 


# ------------------------------
# 3. Mouse (and stroke) Bindings
# ------------------------------

# Problems arise when you use a desktop application, if you do not use
# such application you can skip this section ...
# If you use a desktop application (which work as kdesktop): The root 
# window is now a normal window, the desktop application, which needs/wants
# Mouse bindings. However, the context for bindings under the desktop window
# is R (root) and not W (window), and the associated action is also executed
# under the root context (e.g., if the action implies a move then FVWM will
# ask you to select a (normal) window and will not move the desktop window).

# ------ My .fnh-desktop-start file

# So, create a file called .fnh-desktop-start in your FVWM_USERDIR (by default
# ~/.fvwm/) and add what follows:

# You should give some Root bindings to the desktop (it will take it anyway,
# but some times the FVWM bindings will win if you do not add the following):

Mouse 1 R A 
Mouse 2 R A
Mouse 3 R A

# Note: the Mouse 1 and 3 unbinding are really needed with kdesktop.
# with mouse 2 you can disable the kdesktop binding in kcontrol and
# do not modify your configuration for the mouse 2 button.

# Now we (re)define our mouse bindings by adding the M (Alt) modifier
# (edit the actions to fit your configuration, "ok" for fvwm-themes)

Mouse 1 R M Menu MenuFvwmRoot
Mouse 2 R M WindowList
Mouse 3 R M Menu MenuFvwmWindowOps

Mouse 2 R MC	Module FvwmPager -transient FvwmPager-Single * *
Mouse 2	R MS	Module FvwmPager -transient FvwmPager-Desker 0 3

# For Stroke user:

# I do not test the pure stroke bindings, however the StrokeFunc which
# is more powerful work fine:

#Mouse 3 R M StrokeFunc FeedBack DrawMotion StrokeWidth 2

# However, you should add M as modifier to your stroke binding
# (fvwm-themes users should edit themes/default/settings/stroke/enable,
# if the fvwm-themes version =< 0.4.2)
# 

### END of my .fnh-desktop-start file

# ------ My .fnh-desktop-stop file

# Then, in .fnh-desktop-stop you can  redefine your original Mouse Root
# bindings (useful if you want to delete the Desktop application during
# a  session). This file is read if the Desktop application is deleted
# or if FvwmNetHints is stoped with the SendToModule FvwmNetHints Quit 
# command and a Desktop application was detected by FvwmNetHints.

#for fvwm-themes-user:

Mouse 1 R A Menu MenuFvwmRoot
Mouse 2 R A WindowList
Mouse 3 R M Menu MenuFvwmWindowOps
# or
#Mouse 3 R A StrokeFunc FeedBack DrawMotion StrokeWidth 2
# if you are a stroke user

Mouse 2 R C	Module FvwmPager -transient FvwmPager-Single * *
Mouse 2	R SC	Module FvwmPager -transient FvwmPager-Desker 0 3

### END of my .fnh-desktop-stop file

# ------ fvwm-themes workaround:

# A fvwm-themes user should put this in bindings-extra file:

SendToModule FvwmNetHints ReadStartDesktopFile

# So that the .fnh-desktop-start bindings be reloaded during a theme
# switching.


# ----------------
# 4. Key  Bindings
# ----------------

# some compliant application completely grab (capture) some key sequences
# (I think that this completely violate the ICCCM draft and I see nothing in
# the EWMH spec. about this).
#
# kdesktop grab the bindings associated to KsysGard (Ctrl Esc by default),
# Command execution (Atl F2 by default), the windowlist menu (Alt F5 by default)
# kicker grab the binding associate to the main menu (Alt F1 by default).
#
# No FVWM key bindings should match one of the above bindings!
#
# first solution: modify the KDE key bindings to do so.
#
# second solution: modify the FVWM bindings to do so.
#
# fvwm-themes solutions:
# 1 - Enable the restricted modifier (add Shift) option to the default bindings
#     component
# 2 - Use the first solution, e.g., by adding a shift to the previous default 
#     KDE bindings


# -------------------------------------------
# 5. Maximizing with the FvwmNetHints Command
# -------------------------------------------

# basically you may want to replace the FVWM Maximize command by the
# FvwmNetHints Maximize command (see FvwmNetHints man page: the COMMANDS
# section and the UseWorkingAreaMaximizing and UseDynamicMaximizing 
# configuration options).
# So that you configuration can be use with or without FvwmNetHints
# the above replacement should be done in the .fnh-start file and 
# the .fnh-stop file can be used to restablish the fvwm2 commands


# My .fnh-start file:
# -------------------

# for fvwm-themes:

# redefinition of the maximize functions: you need fvwm-themes version
# >= 0.4.3

DestroyFunc FuncFvwmMaximize
AddToFunc   FuncFvwmMaximize
+ M Nop
+ H Nop
+ C SendToModule FvwmNetHints Maximize
+ D Menu MenuFvwmWindowMaximize

DestroyFunc FuncFvwmMaximizeVertically
AddToFunc   FuncFvwmMaximizeVertically
+ H SendToModule FvwmNetHints Maximize 0 100
+ M SendToModule FvwmNetHints Maximize 0 100
+ C SendToModule FvwmNetHints Maximize 0 100

DestroyFunc FuncFvwmMaximizeHorizontally
AddToFunc   FuncFvwmMaximizeHorizontally
+ H SendToModule FvwmNetHints Maximize 100 0
+ M SendToModule FvwmNetHints Maximize 100 0
+ C SendToModule FvwmNetHints Maximize 100 0

DestroyFunc FuncFvwmSimpleMaximize
AddToFunc   FuncFvwmSimpleMaximize
+ I SendToModule FvwmNetHints Maximize $0

DestroyFunc FuncFvwmSimpleMaximizeVertically
AddToFunc   FuncFvwmSimpleMaximizeVertically
+ I SendToModule FvwmNetHints Maximize $0 0 100

DestroyFunc FuncFvwmSimpleMaximizeHorizontally
AddToFunc   FuncFvwmSimpleMaximizeHorizontally
+ I SendToModule FvwmNetHints Maximize $0 100 0

DestroyFunc FuncFvwmSimplePartialMaximizeVertically
AddToFunc   FuncFvwmSimplePartialMaximizeVertically
+ I SendToModule FvwmNetHints Maximize $0 0 95

# ------ A special menu for the Ping protocol:

# Ping protocol is not yet fully tested and usefull ...

# ------ window-ops menu (really optional):

# This defines all window operations
DestroyMenu MenuFvwmWindowOps
AddToMenu   MenuFvwmWindowOps "Window Operations" Title
+ "&Move%menu/window-move.xpm%"                 Move
+ "&Resize%menu/window-resize.xpm%"             Resize
+ "(De)&Iconify%menu/window-iconify.xpm%"       Iconify
# here!
+ "(Un)Ma&ximize%menu/window-maximize.xpm%"     FuncFvwmSimpleMaximize
+ "(Un)Shade%menu/window-shade.xpm%"            WindowShade
+ "(Un)Stick%menu/window-stick.xpm%"            Stick
+ "R&aise%menu/window-raise.xpm%"               Raise
+ "&Lower%menu/window-lower.xpm%"               Lower
+ "" Nop
+ "&Delete%menu/window-delete.xpm%"             Delete
+ "&Close%menu/window-close.xpm%"               Close
+ "Destroy%menu/window-destroy.xpm%"            Destroy
+ "" Nop
+ "Move to Page%menu/window-move.xpm%"          Popup MenuFvwmWindowMove
+ "Group Operations%menu/windows.xpm%"          Popup MenuFvwmWindowGroupOps
+ "Window Style%menu/window.xpm%"               Popup MenuFvwmWindowStyle
+ "Maximize Window%menu/window-maximize.xpm%"   Popup MenuFvwmWindowMaximize
+ "Refresh Window%menu/refresh.xpm%"         	Popup MenuFvwmWindowRefresh
+ "Rearrange All%menu/refresh.xpm%"          	Popup MenuFvwmRearrangeWindows
+ "Window Utility%menu/utility.xpm%"            Popup MenuFvwmWindowUtility
+ "" Nop
+ "Identify%menu/window-identify.xpm%"          Module FvwmIdent
+ "Switch to...%menu/windows.xpm%"              WindowList

# A trimmed down version of MenuFvwmWindowOps, good for binding to decorations
DestroyMenu MenuFvwmWindowOps2
AddToMenu   MenuFvwmWindowOps2
+ "Restore	Alt-F6%menu/window.xpm%"           FuncFvwmRestore
+ "&Move	Alt-F7%menu/window-move.xpm%"      Move
+ "&Resize	Alt-F8%menu/window-resize.xpm%"    Resize
+ "&Iconify	Alt-F9%menu/window-iconify.xpm%"   Iconify
# here
+ "Ma&ximize	Alt-F10%menu/window-maximize.xpm%" FuncFvwmSimpleMaximize
+ "R&aise	Alt-F5%menu/window-raise.xpm%"     RaiseLower
+ "" Nop
+ "&Close	Alt-F4%menu/window-close.xpm%"     Close
+ "" Nop
+ "Identify	Alt-F11%menu/window-identify.xpm%" Module FvwmIdent
+ "More&...	Alt-F3%menu/window.xpm%"           Menu MenuFvwmWindowOps This 0 0

# Someone may prefer the version without menu icons, like in mwm
DestroyMenu MenuFvwmWindowOps3
AddToMenu   MenuFvwmWindowOps3
+ "Restore	Alt-F6"  FuncFvwmRestore
+ "&Move	Alt-F7"  Move
+ "&Resize	Alt-F8"  Resize
+ "&Iconify	Alt-F9"  Iconify
# here
+ "Ma&ximize	Alt-F10" FuncFvwmSimpleMaximize
+ "R&aise	Alt-F5"  RaiseLower
+ "" Nop
+ "&Close	Alt-F4"  Close
+ "" Nop
+ "Identify	Alt-F11" Module FvwmIdent
+ "More&...	Alt-F3"  Menu MenuFvwmWindowOps This 0 0

### END of my .fnh-start file


# My .fnh-stop file:
# ------------------

DestroyFunc FuncFvwmMaximize
AddToFunc   FuncFvwmMaximize
+ M Nop
+ H Nop
+ C Maximize
+ D Menu MenuFvwmWindowMaximize

DestroyFunc FuncFvwmMaximizeVertically
AddToFunc   FuncFvwmMaximizeVertically
+ H Maximize 0 100
+ M Maximize 0 100
+ C Maximize 0 100

DestroyFunc FuncFvwmMaximizeHorizontally
AddToFunc   FuncFvwmMaximizeHorizontally
+ H Maximize 100 0
+ M Maximize 100 0
+ C Maximize 100 0

DestroyFunc FuncFvwmSimpleMaximize
AddToFunc   FuncFvwmSimpleMaximize
+ I Maximize $0

DestroyFunc FuncFvwmSimpleMaximizeVertically
AddToFunc   FuncFvwmSimpleMaximizeVertically
+ I Maximize $0 0 100

DestroyFunc FuncFvwmSimpleMaximizeHorizontally
AddToFunc   FuncFvwmSimpleMaximizeHorizontally
+ I Maximize $0 100 0

DestroyFunc FuncFvwmSimplePartialMaximizeVertically
AddToFunc   FuncFvwmSimplePartialMaximizeVertically
+ I Maximize $0 0 95

# Destroy the Ping menu

# the window-ops menu does not need to be destroyed ...

### END of my .fnh-desktop-stop file


# fvwm-themes themes switching work around:
# -----------------------------------------

# You need to add the following some where. It seems that
# extra-functions is ok

SendToModule FvwmNetHints ReadStartFile



# --------------------------------
# 7. Leaving FVWM under ksmserver
# --------------------------------

# If you use ksmserver to start FVWM (or any ICCCM compliant session manager)
# You should use the Session functions: QuitSession, SaveSession, SaveQuitSession
# Note that the Restart command seems to do not work with ksmserver you should
# use "Restart fvwm2".

# Here a typical quit menu (fvwm-themes user can put this in menu-extra):

DestroyMenu MenuFvwmQuit
AddToMenu   MenuFvwmQuit "Really Quit Session?" Title
+ "&Restart%menu/restart.xpm%"          Restart fvwm2
+  "" Nop
+ "Re&fresh Screen%menu/refresh.xpm%"   Refresh
+ "Re&capture Screen%menu/refresh.xpm%" Recapture
+ "" Nop
+ "&Yes, Quit Session%menu/choice-yes.xpm%"		QuitSession
+ "Yes, Quit and &Save Session%menu/choice-yes.xpm%"	SaveQuitSession
+ "Quit FVWM &Only%menu/quit.xpm%"      		Quit
+ "&Save Session Only%menu/windows.xpm%"             	SaveSession
+  "" Nop
+ "&No, Don't Quit%menu/choice-no.xpm%" Nop


FVWM SourceForge FVWM