Another potential problem is that the default settings of fvwm make it act differently from most other window managers. People who have used other window managers may find fvwm difficult to use because it doesn't act like they expect it to act.
I installed fvwm on Debian Lenny and played with it a bit, and I found that I didn't like the default fvwm settings. So I searched the Net to find out how other people had configured fvwm, and I picked up a lot of stuff from those config files. Then I read the fvwm FAQ and picked up a thing or two from there. I also visited the fvwm forums and picked up several things from there. As a result, I was able to write my own fvwm configuration that made fvwm act pretty much like most other window managers.
Now I want to share that fvwm configuration with others. I'm happy with my current fvwm configuration and I hope it might serve as a useful starting point for others who want to write their own fvwm configuration.
The fvwm configuration file is located in ~/.fvwm/config. It could also be called (according to the old convention) ~/.fvwm/.fvwm2rc. Both file names should work. OK, let's see what my ~/.fvwm/config looks like.
Code: Select all
## define the screen area that windows can use
## syntax: 'EwmhBaseStruts left right top bottom' in pixels
EwmhBaseStruts 0 0 0 0
## set desktops
DesktopSize 1x1
DesktopName 0 Desk 1
DesktopName 1 Desk 2
DesktopName 2 Desk 3
EdgeScroll 0 0
## ignore NumLock
IgnoreModifiers L25
Fvwm has multiple virtual desktops that can be divided into many pages and each desktop has the same number of pages. By default, fvwm has nine pages on each desktop and the number of desktops is, according to the man page, limited to "approximately 4 billion total". The "DesktopSize" command can be used to define the number and arrangement of pages of the virtual desktops. In my configuration I set each desktop to have only one page. I also set the names for the first three virtual desktops: "Desk 1", "Desk 2", and "Desk 3".
The "EdgeScroll" defines how easily moving the mouse cursor to the edge of the screen can change the view from one desktop or page to another. In my configuration you can't change desktops by simply moving the mouse cursor.
Enabling NumLock can interfere with the fvwm keybindings; the "IgnoreModifiers" setting offers a workaround.
Code: Select all
## set desktop background colour
AddToFunc StartFunction
+ I Exec xsetroot -solid "#4E5767"
## don't show icons for minimized/iconified windows
Style "*" NoIcon
## mouse cursor styles
CursorStyle ROOT left_ptr
CursorStyle TITLE left_ptr
CursorStyle DEFAULT left_ptr
CursorStyle SYS left_ptr
CursorStyle MENU left_ptr
Code: Select all
## window styles
Style * !Title
Style * BorderWidth 2, HandleWidth 2
Style * MWMFunctions, MWMDecor, HintOverride, DecorateTransient, \
NoPPosition
Style * FPGrabFocus, FPGrabFocusTransient, FPReleaseFocus, \
ClickToFocus
Style * SmartPlacement, WindowShadeSteps 20, ResizeOpaque
Code: Select all
## additional focus policy configuration,
## automatically give focus to new windows
DestroyModuleConfig AW-event: *
*AW-event: Cmd Function
*AW-event: add_window FuncNewWindow
DestroyFunc FuncNewWindow
AddToFunc FuncNewWindow
+ I ThisWindow (AcceptsFocus) FlipFocus NoWarp
AddToFunc StartFunction
+ I Module FvwmEvent AW-event
## more adjustment to focus policy,
## re-focus the last focused window when switching pages
DestroyFunc CurrentPageFocusFunc
AddToFunc CurrentPageFocusFunc
+ "I" Next (CurrentPage, State 2) Focus
+ "I" None (CurrentPage, Focused) Prev (CurrentPage, !Iconified, \
!Sticky) Focus
DestroyFunc MarkWindowAsActiveFunc
AddToFunc MarkWindowAsActiveFunc
+ "I" Current (!Iconified) All (CurrentPage, !Focused) State 2 False
+ "I" Current (!Iconified) State 2 True
DestroyModuleConfig FvwmEvent: *
*FvwmEvent: Cmd Function
*FvwmEvent: new_page CurrentPageFocusFunc
*FvwmEvent: new_desk CurrentPageFocusFunc
*FvwmEvent: destroy_window CurrentPageFocusFunc
*FvwmEvent: focus_change MarkWindowAsActiveFunc
AddToFunc StartFunction
+ I Module FvwmEvent
Code: Select all
# Recall that mouse formats look like this:
#
# +------------+
# | || || || |
# | |
# +------------+
# 1 2 3
# Binding Functions
#
# "I" stands for Immediate
# "M" stands for Motion
# "C" stands for Click
# "H" stands for Hold
# "D" stands for Double Click
# -------------------------------------------------------------
# Contexts:
# 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
# -------------------------------------------------------------
Code: Select all
## mouse bindings
Mouse 1 R A Menu Mainmenu Nop
Mouse 2 R A WindowList
Mouse 3 F A Menu MenuFvwmWindowOps Nop
Mouse 3 S A Menu MenuFvwmWindowOps Nop
Mouse 1 W M Pick move
## key bindings
Key Escape A S Popup Mainmenu Root c c
Key Tab A M WindowList Root c c NoNumInDeskTitle, \
CurrentAtEnd, IconifiedAtEnd
Key Escape A CS WindowList Root c c NoNumInDeskTitle, \
IconifiedAtEnd
Key Escape A C Popup MenuFvwmWindowOps Root c c
Key Q A C Close
Key N A M Maximize 100 100
Key B A M Maximize 0 100
Key G A M Maximize 100 0
Key H A M Iconify
Key M A M WindowShade Toggle
Key Right A SM PointerWindow Move w+1 w+0 Warp
Key Left A SM PointerWindow Move w-1 w+0 Warp
Key Up A SM PointerWindow Move w+0 w-1 Warp
Key Down A SM PointerWindow Move w+0 w+1 Warp
Key Right A CM PointerWindow Resize br w+1 w+0
Key Left A CM PointerWindow Resize br w-1 w+0
Key Up A CM PointerWindow Resize br w+0 w-1
Key Down A CM PointerWindow Resize br w+0 w+2
Key F1 A 4 GotoDesk 0 0
Key F2 A 4 GotoDesk 0 1
Key F3 A 4 GotoDesk 0 2
Key Up A 4 GotoDesk -1 0 2
Key Down A 4 GotoDesk 1 0 2
Key F1 A S Exec urxvt
Key F2 A S Exec konqueror
Key F3 A S Exec icedove
Key F4 A S Exec kwrite
Key F5 A S Exec oowriter
Key F6 A S Exec lyx
Key F7 A S Exec gqview
Key F8 A S Exec gimp
Key F9 A S Exec kaffeine
Key F10 A S Exec xfe -m
Key F11 A S Exec iceweasel
Key C A CS Exec osmo -cal
Key R A CS Exec grun
Key L A CS Exec xtrlock
Clicking with the left mouse button on the root window (any part of the desktop that is not covered by application windows) brings up the application menu. (I would actually rather use the right button for this but using the left button overrides the default fvwm menu, which I don't much care for.) Clicking the middle mouse button on the root window will show the list of windows that are currently opened. Clicking the right mouse button while the mouse cursor is on some application window's border will show that window's "window operations" menu (that allows you to maximize/minimize/close that window or move it to another desktop).
You can move an application window if you press the Alt key while left-clicking a window. Then you can move the mouse cursor where you want to place the window and another left-click (this time without pressing Alt) will leave the window there.
You also get the main application menu if you press Shift and Escape keys at the same time. Then you can navigate the menu with the arrow keys. (Pressing Escape again will exit the menu.)
There are two key bindings to view the list of currently open application windows: Pressing Alt and Tab pops up the WindowList that allows you to switch the focus from one open window to another quickly. Pressing Control, Shift and Escape also shows the same WindowList menu that you can browse with the arrow keys, and you can hit Enter when you've decided which window you want to activate -- or you can press Escape to cancel the window switching. (This is a nice way to view what windows are currently open.) The title of the WindowList shows the current virtual desktop.
Pressing Control and Escape shows the "window operations" menu for the currently active window.
You can close the currently active window by pressing Control and the Q key at the same time. Maximize/unmaximize the active window by pressing Alt and N. Maximize the window vertically with Alt and B. Maximize horizontally with Alt and G. Minimize/hide a window with Alt and H. (You need to use the WindowList menu to bring it back again.) Press Alt and M to shade/unshade the active window.
Pressing at the same time both Shift and Alt and one of the arrow keys moves the currently active window. Pressing the Right or Left arrow key while you also press both Control and Alt should make the currently active window to either grow or shrink from its right side; pressing the Up or Down arrow key while you also press Control and Alt should either shrink or grow the currently active window from its bottom side.
My keyboard has a "MS Windows" key that has "Start" written on it and it's decorated with the MS Windows logo flag. I use this key to switch desktops. Pressing the Win key and F1 changes the view to the first desktop; Win key and F2 to the second desk; and Win key and F3 to the third desk. Pressing the Win key and Up or Down arrow key is an alternative way to switch desktops via key bindings. Also, pressing Shift and F1-F11 starts some applications that I use often.
Code: Select all
## menu styles
Colorset 00 fg white, bg #69768B
Colorset 01 fg #FFFFC4, bg #697871
Colorset 02 fg #C0C0C0, bg #8D97AF
MenuStyle * Hilight3DThin, Animation, PopupOffset 0 100
MenuStyle * Font "xft:Liberation Sans:style=Regular:pixelsize=16"
MenuStyle * TitleFont "xft:Liberation Sans:style=Bold:pixelsize=16"
MenuStyle * MenuColorset 00, ActiveColorset 01, HilightBack
MenuStyle * BorderWidth 1, TitleUnderlines1, SeparatorsLong
MenuStyle * TrianglesSolid, ItemFormat "%.2|%.5i%.5l%.5i%2.3>%2|"
Code: Select all
Read /etc/X11/fvwm/menudefs.hook
## main menu
DestroyMenu "Mainmenu"
AddToMenu "Mainmenu" "Main Menu" Title
+ "XTerm" Exec exec xterm
+ "Links 2" Exec exec links2 -g
+ "Krusader" Exec exec krusader
+ "Crack Attack!" Exec exec crack-attack
+ "" Nop
+ "Debian Menu" Popup /Debian
+ "" Nop
+ "Identify" Pick Module FvwmIdent
+ "" Nop
+ "Restart Fvwm" Restart
+ "Quit Fvwm" Quit
+ "" Nop
+ "Reboot" Exec exec sudo /sbin/reboot
+ "Halt" Exec exec sudo /sbin/halt
## window operations menu
DestroyMenu MenuFvwmWindowOps
AddToMenu MenuFvwmWindowOps
+ "Move To Desk" Popup MenuDeskList
+ "" Nop
+ "Shade/Unshade" Pick WindowShade Toggle
+ "Iconify" Pick Iconify
+ "Maximize" Pick Maximize
+ "" Nop
+ "Raise/Lower" Pick RaiseLower
+ "Stick/Unstick" Pick Stick
+ "" Nop
+ "Identify" Pick Module FvwmIdent
+ "" Nop
+ "Close" Pick Close
+ "Destroy" Pick Destroy
## move to desk menu
DestroyMenu MenuDeskList
AddToMenu MenuDeskList
+ " Desk 1" Pick MoveToDesk 0 0
+ " Desk 2" Pick MoveToDesk 0 1
+ " Desk 3" Pick MoveToDesk 0 2
Notice that I've enabled the nopasswd execution of /sbin/reboot and /sbin/halt for my normal user in /etc/sudoers (via the "visudo" command), so I can reboot or halt the computer from fvwm's main menu. The above configurations are the actual menus that I currently use -- you might want to edit them to suit your personal needs and preferences.
Code: Select all
## start some applications maximized
DestroyModuleConfig FE-StartMaximized: *
*FE-StartMaximized: Cmd Function
*FE-StartMaximized: add_window FuncStartMaximized
AddToFunc StartFunction
+ I Module FvwmEvent FE-StartMaximized
DestroyFunc FuncStartMaximized
AddToFunc FuncStartMaximized
+ I ThisWindow ("URxvt") Maximize
+ I ThisWindow ("XTerm") Maximize
+ I ThisWindow ("Konqueror") Maximize
+ I ThisWindow ("Links") Maximize
+ I ThisWindow ("Pysol") Maximize
+ I ThisWindow ("GQview") Maximize
+ I ThisWindow ("Lyx") Maximize
## styles for some applications
Style "conky" !Handles, Sticky, WindowListSkip, CirculateSkip
Style "Clock" !Handles, Sticky, CirculateSkip, BorderWidth 0
Code: Select all
rclock -update 2 -nodate -bg '#4E5767' -fg white -geometry 150x150+750+65 &
* * * * * *
Next, I want to add some bloat to my otherwise relatively light-weight fvwm setup.
I configure a panel using the in-built "FvwmButtons" utility. I set it to show a pager (the in-built FvwmPager) plus some dockapps. Then I set a key binding that raises or lowers the panel whenever I press the Win key and D simultaneously. This way I can easily view the panel and then hide it again while I'm using some applications that cover the whole screen area.
Code: Select all
## configure a panel that shows pager and dockapps
DestroyModuleConfig FvwmPager: *
*FvwmPager: Colorset * 02
*FvwmPager: HilightColorset * 01
*FvwmPager: Rows 3
*FvwmPager: Columns 1
*FvwmPager: MiniIcons
*FvwmPagerFont "xft:Liberation Sans:style=Bold:pixelsize=12"
Style "MyDock" !Handles, Sticky, WindowListSkip
DestroyModuleConfig MyDock: *
*MyDock: Colorset * 02
*MyDock: ButtonGeometry 64x64-0+0
*MyDock: Columns 1
*MyDock: Back #808080
*MyDock: Frame 1
*MyDock: (1x3, Swallow "FvwmPager" 'FvwmPager 0 2')
*MyDock: (Swallow (NoClose, UseOld) "wmCalClock" 'Exec wmCalClock -24')
*MyDock: (Swallow (NoClose, UseOld) "wmbiff" 'Exec wmbiff')
*MyDock: (Swallow (NoClose, UseOld) "wmweather" 'Exec wmweather -s EFTP -m')
*MyDock: (Swallow (NoClose, UseOld) "mixer_app" 'Exec Mixer.app')
*MyDock: (Swallow (NoClose, UseOld) "wmmount" 'Exec `wmmount -- -s`')
AddToFunc StartFunction
+ I Module FvwmButtons MyDock
## key binding to raise and lower the MyDock panel
DestroyFunc MyDockFunc
AddToFunc MyDockFunc
+ I Next (MyDock, Layer 6) Layer
+ I TestRc (NoMatch) Next (MyDock) Layer 0 6
Key D A 4 MyDockFunc
Here's what my fvwm setup looks like in action:
If you need help in configuring fvwm, you should go straight to the FVWM Forums.
For some RTFM, see first the FVWM FAQ. The FVWM Beginners Guide is another helpful resource for configuring fvwm. The man pages that come with fvwm offer very detailed information about the available fvwm configuration options but they're also very long and very technical.
Your experiences and opinions of fvwm are welcome in this thread. Fvwm configuration tips are also most welcome.
Edit 2008-04-15:
Made fvwm to set the desktop background colour by calling xsetroot directly instead of starting the FvwmBacker module. This saves a small amount of RAM. Also cleaned up the Mainmenu syntax a bit.
Edit 2008-04-16:
Added bold font to menu titles. I also decided that I want the WindowList title to show what the current desktop is, so WindowList can function as a primitive desktop pager if one doesn't want to load the panel. I figured that I need to change the "one desk, three pages" model that I used in my original fvwm config to "three desks, each having only one page" model. This required rewriting several bits of my original fvwm config (DesktopSize, key bindings, "move to page" menu, FvwmPager settings...). I also updated the screenshot because FvwmPager now shows labels for the three available desktops.
Edit 2008-04-29:
Added key bindings to move and resize application windows. Also made fvwm to read the global "menu.hooks" file, so the Debian menu gets updated automatically.
Edit 2008-04-30:
Changed the key binding to move application windows (from Alt+arrow_key to Shift+Alt+arrow_key) because popular Internet browsers, like iceweasel and konqueror, use Alt+left_arrow_key to switch to the previously visited page, and the window manager specific bindings override the application specific bindings.
Edit 2008-05-01:
Made some minor corrections at Thomas Adam's request.