FVWM Beginners Guide
时间:2006-10-31 来源:gavinneo
FVWM Beginners Guide
by Jaimos F SkriletzIndex
- Introduction
- Global Settings
- Functions
- Bindings
- Window Decor
- Menu
-
Modules
- FvwmTaskBar
- FvwmPager
- FvwmButtons
- Overview/Conclusion
- Appendix
-
Advanced Topics
- Advanced Functions
- Advanced Menu
- Advanced FvwmButtons
- Other Resources
- GNU Free Documentation License
-
Advanced Topics
Copyright (c) 2004 Jaimos F Skriletz
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
FVWM Beginners Guide
FVWM or the Feeble Virtual Window Manager is an extremely versatile desktop/window manager for the X Window System. The name is a bit misleading, but originally FVWM was a fork of the original TWM window manager and made as a feeble replacement. Here is a nice chart to give you a glimps of the FVWM family tree. FVMW has since grown from its humble beginnings and is now one of the most configurable window mangers out there. Think of anything that you would want a desktop/window manager to do, and FVWM will probably be able to achieve that and more. Since the name 'Feeble' no longer applies to this window manager, many attempts at changing the name, or even creating urban legends about how the original meaning of the 'F' was lost have circulated around. Most commonly it's just referred the F? Virtual Window Manager, or FVWM for short.
Though FVWM is extremely versatile and programmable, many shy away from it due to the lack of GUI configuration tools for it. Though there have been some attempts at making such tools, fvwm-themes for example, the amount of options involved cannot be easily summed up into a GUI, so the best way to configure fvwm is to write a personalized config file. This guide is to help you get familiar with how the syntax for configuring FVWM is used. The first part of the guide will lead you step by step in creating a simple config file. I have set the info to go into the config file aside so one could simply copy and paste as they work though the guide. My attention is to have you work though this guide copying and pasting some parts, but also taking some steps in modifying what I have put there so you can get use to the syntax and add your own flavor to the config. After you are done creating the basic config in this guide, I then have an appendix full of more advanced topics and configurations that you can play with to implement into your desktop. By the end of this guide its my hope that you are familiar with FVWM and can then create your own config to turn it into your window manager.
The guide tries to explain most of the options I present, but all of this information is clearly explained in the FVWM MAN PAGES. The man page is quite long, but once one has key words, it should be easy to search for how that is used in the configuration. Some of the configurations I present I will skim or skip over and expect you to use the man page to fill any any details I miss. Again just in case you didn't hear me the FVWM MAN PAGES are a valuable resource.
This guide is written for the configuration syntax of the unstable release, current at this time is fvwm-2.5.10. I have not tested the configuration on the stable release, 2.4.18, so I am unsure on how well it will work. My suggestion is to use the 2.5.10 version. Though its dubbed unstable, the basic functionality is stable and I have yet to notice any grave bugs from its operation. I also use bits of the Translucency patch in this config (though I only present it as an alternative). If your interested in using the translucency patch to add a more realistic transparency effect to your menus, instructions on how to install it can be found here.
All of FVWM is configured by a single config file which is normally located at $HOME/.fvwm2rc or $HOME/.fvwm/.fvwm2rc. Though by the use of the 'Read' command, one could split the config file up into smaller config files. For this guide we will just put everything into one config file. For sake of argument lets put everything in the $HOME/.fvwm directory, so for the first step create the $HOME/.fvwm directory and create an empty .fvwm2rc file. If you run fvwm, Don't be surprised if you think the default setup is quite ugly, cause many will agree with you, but that is a good place to start.
The images I use in this guide can all be downloaded here. If you want to work though this guide and use my images, download that file, then untar it in your $HOME directory. It will create a .fvwm folder with all the icons and decors I use in this guide. There is also a copy of the fvwm2rc that can be generated by copying and pasting though the first part of this guide.
Next open the file $HOME/.fvwm/.fvwm2rc file in your favorite text editor. This file is parsed by FVWM when it starts up (or is restarted) and fvwm uses the info in here to set up the look and feel of your desktop. To comment out a line a '#' is used. Lets put some comments at the top of the file as a starter. For example you could put the following at the top of your fresh fvwm2rc file.
########### |
The first thing to setup is the global settings, such as environment variables, and the basic set up of the desktop. An environment variable is like one used in a shell, you can store values in it that you can then use them in various places though out your fvwm2rc file, and then if you preferences change its not that hard to change the variable (instead of each instance in the file). I use environment variables mainly to tell fvwm where to look for various items used in the config.
Note though that over-using environment variables leads to a lot of "pollution" within FVWM's evironment space, especially if they're only being used to hold settings which might only ever change once a year. You can see this thread on the fvwm forums for more detailed information.
For example you could set up some environment variables as follows:
##### |
You can also use environment variables to set up default programs that you prefer to use, for example;
SetEnv fvwm_webbrowser /usr/bin/firefox |
Next set up the ImagePath. This is similar to the shell environment variable $PATH, which sets up where FVWM will look for images (icons) you ask it to display (for example as quick launch buttons or menu icons). A typical image path would look something like this.
##### |
I put all my icons I use in my $[fvwm_icon] directory. The reason I write it down twice is the second time when I follow it with the ';.png' says that it will be able to use either .xpm files (the default) or .png files for the icons interchangeably. One could easily add more directories to the ImagePath if there were for instance some global images for all users at '/usr/local/share/images' and then personal images locate in $HOME/images that would be used in fvwm.
Next lets set up the Virtual Desktops. FVWM allows you to have as many Virtual Desktops as you would want to set up, and also allows each Virtual Desktop to have multiple Pages. For instance lets assume that you would want to have 3 Virtual Desktops each with 9 pages in a 3x3 grid, you could set it up as follows.
##### |
The DesktopSize sets up the number of pages on each Virtual Desktop, for example 3x3 sets up a 3x3 grid that make each desktop have a set of Pages that look like
|
|
|
|
|
|
|
|
|
I then set up 3 Virtual Desktops, namely Main, Work and Games (numbered 0, 1, 2). The EdgeScroll parameter sets up what percentage of the screen scrolls when you move your mouse to the edge of the screen. 'EdgeScroll 100 100' says if I move my mouse to the edge of the screen that 100% (or the whole) page will scroll over to the next one. EdgeResistance sets up how much 'resistance' or time is needed before the scroll happens. And EdgeThickness sets up how many pixels thick the border around the 'root' window where the the EdgeScroll effect will take place is. If you don't like this behavior, you can either set 'EdgeThickness 0' or 'EdgeScroll 0 0'.
Next lets set up the default Mouse and Focus behavior. An example of this is
##### |
ClickTime is the time in milliseconds between pushing the mouse button and releasing it that FVWM will consider that a 'click'. If that time is exceeded FVWM will consider that a 'hold'. MoveThreshold is the number of pixels the mouse must move before FVWM will consider that action a 'move'. Note, all this stuff will set up the feel of your window manager and is important when making functions.
Styles are used throughout FVWM to set up various Styles of how you want things to act, look, behave, etc. Styles will be used a lot, but for start, lets just look at this style line. In Style statements, *'s are wild cards, so 'Style *' says apply this style to every window. This is followed by a list of styles separated by commas that you wish to use, for example the first Style I have used is SloppyFocus which means that the window in focus is the one with the mouse over it (excluding special windows like the root window). The second Style in that line is MouseFocusClickRaises which says that if I click on a focused window it will raise to the top. Other styles could be 'ClickToFocus', 'ClickToFocusPassesClick', 'ClickToFocusPassesClickOff', 'ClickToFocusRaises' and 'ClickToFocusRaisesOff'. All of which are explained in more detail in the man page.
Besides Styles there are some special key words to set up how the default desktop environment behaves. An example of a few of these are;
EwmhBaseStruts 62 162 0 48 |
This first line EwmhBaseStruts sets up the 'usable' screen area. How this works is by stating 'EwmhBaseStructs left right top bottom'. The numbers are how many pixels bordering each edge of the screen are used as a padding for maximizing windows and window placement. This setup leaves a bit of space along the right, left and bottom of the screen for the FvwmTaskBar, FvwmPager and FvwmButtons. If you would like the window to ignore this setting you can use the EWMHMaximizeIgoreWorkingArea Style option. The next line tells FVWM to ignore certain modifiers, in this case it ignores the 'Num Lock' modifier and helps in lots of situations.
Some other styles I use in my fvwm2rc file are as follows, I'm not gonna explain them here, but just let you see that there are various other options you can add to your config to further control how the the FVWM Desktop functions.
##### |
Next I setup various program specific Styles. How the Style command works is 'Style [string] [styles]'. FVWM then compares [string] (including wild cards '*') to the Name, Class and/or Resource of a window. To figure out what the Name, Class and Resource of an application is you could use the FvwmIdent Module. This example sets up program specific styles. I mainly set up the MiniIcon and Icon that is associated with the program, though any Style option can be applied to the program.
##### |
Functions can be called by FVWM though various parts of the config, I will just mention some basic syntax here and then give you some basic functions. For more complicated functions check out the Advanced Topics section.
To start lets take a look at the skeleton of how a function is written. I have it written in a comment block to so you can paste it in your config to be reminded how functions work.
##### |
So the first thing you do is destroy the function with DestroyFunc, this will clear the function of anything that may already be applied to it. Then you AddToFunc the list of actions you want it to perform when its called, and as you see above these actions can happen depending on different actions of the mouse. Now when you call a function in FVWM you can send it various parameters. For example you could call the above function as 'FuncName "$0" "$1" "$2" "$3" "$4"' where $0-$4 are options that are passed to the function and can be used in determining the outcome of the function. Now consider the following list of basic functions.
##### |
The first function FvwmDeleteOrDestroy, will do nothing, NOP, if the mouse is either 'held' or 'moved'. On a single click it will 'Delete' the active window and on a double click it will 'Destroy' the active window. The second function, FvwmIconifyOrShade, will Iconify the window on a single click and shade the window on a double click. The function FvwmMaximized can be sent two values which are then used to determine how the window is maximized. For instance you could call that function 'FvwmMaximize 100 100' and it will maximize the window to fill 100% of your screen both horizontally and vertically, while 'FvwmMaximize 100 0' will maximize the window horizontally but keep its same size vertically. The function FvwmMoveOrIconify will move the current window when the mouse is 'moved' and 'Iconify' on a 'double click'. The FvwmWindowShade function will either shade, 'FvwmWindowShade True', or unshaded, 'FvwmWindowShade False', the current window. If no option is sent to FvwmWindowShade it will shade an unshaded window and unshade a shaded window.
Next I like to write a function to launch all my programs so I can just call the function. These are simple functions, but they keep things a little bit more organized for me. Examples of such functions are;
##### |
The first functions should be self explanatory, and as for the last one, what it does is take a man page as an argument and launches that man page, for example you could call the function as 'FvwmViewManPage fvwm' and it will pop up the man page for fvwm. You should also note the syntax of the last few lines above. At the end of the second to last line there is a '\', that extends that line onto the next one, so FVWM will treat the last two as one line in the config file.
Lets take a look at three special functions, 'StartFunction', 'InitFunction' and 'RestartFunction'. The StartFunction is run each time FVWM is started, while the InitFunction is run after the StartFunction when FVWM is first initialized and the RestartFunction runs after the StartFunction when FVWM is restarted. Examples of such functions are
##### |
Upon startup fvwm loads the three modules; FvwmButtons, FvwmPager and FvwmTaskBar. When FVWM is first start it starts xscreensaver, sets the background and runs xmms and an aterm. When FVWM Restarts it does nothing (except run the StartFunction)
Functions can be quite detailed and add a lot of usability to your Desktop. Functions can be called with any number of parameters ($0, $1, $2, $3, etc.) and can have any combinations of actions based off of the different mouse events. Functions can use any name that isn't reserved by FVWM for some action, such as Nop, Delete, Destroy, Restart, Exec, etc.
Some other examples of slightly more complex functions are;
##### |
The first set of functions will take screenshots of either the whole desktop or just a single window using the import tool from imagemagick. To take a screenshot of a single window you call the first function with 'Pick (CirculateHit) FvwmWindowScreenshot'. This will give you a pointer and let you 'Pick' what window you want to take the screenshot off. The second function will take a screenshot of your desktop after a '$0' second delay. This is nice cause it will give you time to open up a menu before the screenshot is taken. For example 'FvwmDesktopScreenshot 5' will wait five seconds then take a screen shot. The second set of functions is just an old X toy, it will launch an invasion of different colored 'Roaches' that will scurry across your screen and hide under your windows. You can either call an Invasion of these roaches or Exterminate them all. You will need 'xroach' installed to run these functions
successfully.
There are two types of bindings, you can either bind actions to the mouse or to the keyboard. To understand how these work, lets first look how a typical screen with one Window and two Iconified Windows is set up. In the figure below notice how the screen is divided up into the following parts: R - the root window, I - Icon, F - frame corners, S - frame sides, T - title bar, W - application window and 0-9 - buttons. Note that A will stand for anywhere, i.e. it doesn't matter where the mouse is located.

Bindings are set up as follows, you can either bind a key to an action by 'Key X Context Modifier Action' or bind the mouse to an action 'Mouse X Context Modifier Action'. Context is where the mouse is currently located (as shown above) and the Modifier is any combination of the following; (A)ny, (C)ontrol, (S)hift, (M)eta, (N)othing, or 1-5, representing the X Modifiers mod1-mod5 (man xmodmap). Examples of bindings are as follows:
##### |
The bindings from order of top to bottom perform the following actions;
- Opens the root menu when alt-f1 is pressed anywhere.
- Opens the WindowList which lists the running applications when alt-tab is pushed, and then switches to the application you selected when the alt key is released.
- Launches an aterm when the left command key (windows key) his hit.
- Opens the root menu when the left mouse button is clicked in the root window.
- Opens the window ops menu when the right mouse button is clicked in the root window.
- Deletes or Destroys the window when button number 1 is clicked or double clicked.
- Iconifies or Shades the window when button number 3 is clicked or double clicked.
- Maximizes the window to fit the full screen when the first mouse button is clicked on button number 5.
- Maximizes the window vertically when the second mouse button is clicked on button number 5.
- Maximizes the window horizontally when the third mouse button is clicked on button number 5.
- Moves the window with alt+click when the mouse moves and Iconifies the window a double click.
- Binds the FvwmMoveOrIconify function to work on 'Icons' so they can be moved and UnIconified.
- Shades the active window when you roll up on the mouse wheel twice, since the function requires a double click.
- UnShades the active window when you roll down on the mouse wheel twice.
The window decor defines how the windows look. FVWM can set up window decorations by using a color scheme or pixmaps. For the first example lets look at a simple window decor with no pixmaps. For starters define some colorsets to set up the basic colors your window decorations will use. Colorsets can be used to define the colors for all parts of FVWM. The following sets up three simple colorsets.
##### |
This set up three colorsets, numbered 3, 4 and 5, which have both a foreground (fg) and background (bg) color. Colors can be either given in hex format or can be referenced by name using the the X definitions located in /etc/X11/rgb.txt. Other colors you can set with a colorset is the hilight (hi) and shade (sh). Colorsets can be any long integer, but try to keep the numbers as low as possible as fvwm uses memory for each colorset under the one your using. For more info on colorsets read the FvwmThemes man page.
The decor can be broken up into three parts, the TitleStyle, the ButtonStyle and the BorderStyle. The following sets up a simple decor.
##### |
This decor sets up three buttons, numbers 1, 3 and 5 (the positions is the same as in the window bindings section) using vectors. Note that before a button can be added to a Decor it must first be bound to some action via some binding. Each part is followed by a '-- Flat' to make the buttons and title bar not appear to be pushed out (or in) from the window. Vectors are just simple line drawings. Each vector is set up on a 100x100 grid and can have any number of points all connected by lines. The syntax is 'Vector [number of points] [[point1] [point2] ...]'. The points are defined by 'XxY@Z' where Z is any number 0-4 representing the color to be used for the line. 0 - Shadow(sh), 1 - Hilight(hi), 2 - Background(bg), 3 - Foreground(fg), 4 - Invisible.
Here is an example of a more elaborate Decor using pixmaps for the buttons and title bar.
##### |
Now that you got the decor defined we need to tell the windows to use it and also tell them what colorset to use. This is done as follows:
##### |
These string of Styles tell every window to use the Decor MyDecor, along with setting up the font, BorderWidth, (Hilight)Colorset and (Hilight)BorderColorset the windows use. I like all my windows to look the same but one could make different Colorsets and Decors to set up styles for particular applications.
Menus are lists you can pop up from a binding or hook it to a start menu on a TaskBar. Menus can be used to list programs or even be created dynamically so you can list the contents of a directory, a recent applications menu, etc. The first thing to set up with the menu is the colorsets that the menu will use. Most menus will use two colorsets, one for the main menu and one for the active item. A simple start for two colorsets could be;
##### |
With fvwm 2.5.10 you can make RootTransparent colorsets for menus. These colorsets will use the background as the pixmap for the menu so they appear to be transparent but will not show any windows located under the menu. Example of such colorsets are:
Colorset 7 RootTransparent, fg Black, bg average, sh Black, \ |
This is a RootTransparent colorset, where Tint and bgTint are the colors to tint the menu with followed by the percentage of tint, 0 would mean no tint and all transparent while 100 would be a solid color.
With the Translucency patch you can make the windows behave closer to true transparency. If you have installed that patch correctly, you can create a translucent colorset. To use the option you add 'Translucent [color] [percent]' to the colorset, like the following example:
Colorset 7 fg Black, Translucent White 75, \ |
After the colorsets are setup, then its time to define some MenuStyles to tell FVWM how the menus behave. MenuStyles are similar to Style commands and can be used with wild cards '*' to set up the style so all your menus look the same or can be used to make different menus use different MenuStyles. An example of a collection of global MenuStyles is:
##### |
Refer to the man page for what each option does, but they are mostly self explanatory and are used to control how the PopUp and PopDown of menus behave, the colorsets used, the font and the formating of the menu items and titles. If you want different menus to look and act differentially you can replace '*' with the menu name your interested. For example you could use 'MenuStyle FvwmMenu* [styles]' and 'MenuStyle MyMenu* [styles]' to have two separate looking menus, menus with names starting with FvwmMenu and names starting with MyMenu.
Now that we have set up how the menus look and act, its time to build some menus. Building menus is quite similar to building functions, you first should destroy the previous menu and then add items to the menu in the order you want them to appear. A basic root menu could look like this
##### |
The basic menu item format is '+ "[item name]%[icon]%" [action]'. It doesn't matter if the icon comes before or after the name, for example '+ "%[icon]%[item name]" [action]' will have the same effect. To control if the icons are on the left or right side of the menu item, you'll want to mess with the MenuStyles. This creates a simple 'Root Menu' which is opened when you click on the root window (check out the bindings page). This menu has 5 items in it, the first opens a sub-menu called 'FvwmProgramsMenu'. The second runs the function FvwmATerm when clicked which then launches an aterm. The third item will open the FvwmConsole module. This is a terminal that will allow you to type in FVWM syntax commands to be applied imeditally. the '+ "" Nop' will create a separator. The laste few itmes will open another menu called 'FvwmManPagesMenu', restart and quit fvwm.
Now we called two sub-menus, so lets add them to our config, one will be a small list of programs that you can expand on and the other will be a nice menu that includes all the man pages for fvwm.
##### |
The next menu is a list of window operations so you can perform various actions on windows and take screenshots. In the bindings page I set up a binding that will open this window when you left click on the root window. The last item calls the module FvwmIdent which will pop up a window telling you the various characteristics of that window, such as name, class, resource and other useful stuff.
##### |
The FvwmModules are bits of software launched from within FVWM using the 'Module' command to add more functionality and versatility to the Desktop. There are a hand full of different modules out there, but the main ones I'm gonna focus on in this part of the guide is the FvwmTaskBar, FvwmPager and FvwmButtons. To launch a module you first need to configure it and then launch it using the Module Command. These modules will all use colorsets as an option, so I will first generate two colorsets to be used though out the module section. The three main modules, FvwmTaskBar, FvwmPager and FvwmButtons can all use RootTransparent colorsets, so if you like transparency feel free to make these colorsets RootTransparent like for the menu. To my knowledge the Translucency patch only affects menus and Translucent colorsets cannot be used.
##### |
To see how the basic syntax for module configuration works, lets take a look at the FvwmIdent Module. This module is used to identify a window and gives us info about it that can be useful in configuring fvwm. As with most things in FVWM the first thing that should be done is to destroy any previous config. After that send some options to the module as follows:
##### |
The config for this module is quite simple, I just tell FvwmIdent what font and colorset to use. To launch the module, just add 'Module FvwmIdent' to an action (such as I have in the window ops menu).
FvwmTaskBar is a task-bar that is quite similar to the one in Windows. There is a start menu button you can bind any menu to, a place for quick launch buttons, a list of running tasks and finally have a clock at the far end.
To start with lets set up some Styles for FvwmTaskBar. We want to set up the task-bar so it has no window decorations and also so it won't include itself in the list of running tasks. I also make the task-bar 'Sticky' so it will be shown on all your Virtual desktops and make its size and position fixed. You can achieve this as follows:
##### |
Next you need to set up the various options for the FvwmTaskBar Module. That is achieved as follows:
DestroyModuleConfig FvwmTaskBar: * |
The first line destroys the default config and allows you to start you config from scratch. The following lines set up various options, all of which are explained in the FvwmTaskBar man page. The main ones are to set up the colorset that the TaskBar uses, along with the font. I also tell the TaskBar to UseSkipList, so any windows that have the Style 'WindowSkipList' won't be shown on the TaskBar. I also set up an action, so if your right click on a button it will open the WindowOps menu so you can perform actions on the window you click on. I also set up one button that will launch an aterm by clicking on it.
Now once you have the module configured, you need only launch it. The module is launched by running 'Module FvwmTaskBar', but this is already done in the StartFunction, so it shouldn't need to be put in the config.
FvwmPager is used to show the layout of your Virtual Desktop. It will show all the Pages and Desktops you have set up, and the windows opened in each.
As with the FvwmTaskBar, the first thing to do is set up the Styles and Colorsets you want to use for your pager. I am just gonna use the same colorset as was used for the TaskBar.
##### |
Refer to the man page for full explanation of all the options available. To launch the FvwmPager, you run it as 'Module FvwmPager [start desk] [finish desk]'. In the StartFunction I have this one set up to show all three desktops on one pager so I run it as 'Module FvwmPager 0 2'. If no options are sent, FvwmPager will only show the current Desktop.
FvwmButtons are probably one of the most versatile module for FVWM. As taviso says:
##### |
With that being said, the intro here will only cover the basics of how to set up FvwmButtons. As mentioned, you can create as many instances of FvwmButtons as you would like to do about anything you would want on your desktop. I will create a simple set of Buttons called MyButtons to get you familiar with the syntax. In the advanced topics section I will give examples of more complex FvwmButtons to give you a better feel for how they work.
The basic layout of FvwmButtons is a rectangle (though as taviso mentioned you can configure them to be any shape). You set the geometry of the FvwmButtons by giving its size (width X height) and then can break that into a grid by expressing the number of rows and columns it has. This is important because then each button inside the FvwmButtons panel can span any number of rows and columns allowing you to make buttons of various sizes. Then inside each button you can set up Titles, Icons, Actions and even have it swallow other applications (more on this in the advanced topics appendix). The buttons are filled in from the top left to the bottom right as shown in the figure.

The example I provide for this guide is quite basic just to show you the basic syntax. This is a single column button with a title and then a few quick launch buttons to launch some applications.
#####
# MyButtons
###########
Style "MyButtons" NoTitle, !Handles, !Borders, Sticky, WindowListSkip, \
CirculateSkip, StaysOnBottom, FixedPosition, FixedSize, !Iconifiable
DestroyModuleConfig MyButtons: *
*MyButtons: Geometry 60x420+0+0
*MyButtons: Colorset 9
*MyButtons: Rows 38
*MyButtons: Columns 1
*MyButtons: Frame 0
*MyButtons: Font "Shadow=3:xft:Sans:Bold:pixelsize=14:minspace=True:antialias=True"
*MyButtons: (1x2, Frame 0, Title(Center) "FVWM")
*MyButtons: (1x5, Frame 0, Icon 48x48/terminal.png, \
Action(Mouse 1) "FvwmATerm", \
Action(Mouse 3) "FvwmXTerm")
*MyButtons: (1x5, Frame 0, Icon 48x48/xmms.png, \
Action(Mouse 1) "FvwmXmms")
*MyButtons: (1x5, Frame 0, Icon 48x48/vim.png, \
Action(Mouse 1) "FvwmGvim")
*MyButtons: (1x5, Frame 0, Icon 48x48/gimp.png, \
Action(Mouse 1) "FvwmGimp")
*MyButtons: (1x5, Frame 0, Icon 48x48/firefox.png, \
Action(Mosue 1) "FvwmFireFox")
*MyButtons: (1x5, Frame 0, Icon 48x48/irc.png, \
Action(Mouse 1) "FvwmIrssi")
*MyButtons: (1x5, Frame 0, Icon 48x48/tux.png, \
Action(Mouse 1) "FvwmXLock")
*MyButtons: (1x1, Frame 0)
Congratulations, you have just completed your first fvwm2rc file. Its my hope that you have gotten some basics about how FVWM is configured, and maybe a small glimpse of how much freedom you have. All of the stuff mentioned so far is what I would consider the basics for any FVWM desktop. As an over view recall that we looked at how to set up global settings such as 'Styles' to control the behavior of FVWM. We then saw how to create functions, set up bindings, build a Decor and a create Menus. Finally we got to see some of the Modules we could use to add onto FVWM.
The fvwm2rc file that this guide creates can be found here, so you can see it all in one page. Also if you you use this fvwm2rc file with the images I provided your desktop will look something like;

The rest of this guide will include some more bells and whistles you could add to your config along with the resources and references I have seen and used in my experience with FVWM.
Now that you have finished your first fvwm2rc config and have gotten a better feel about how the syntax works, lets dive into some more advanced topics to give your Desktop some more character. In the following pages I will give examples of some bells and whistles I like to use on my desktop and that you can integrate into yours if you like. A few of the things I use require that you use the tools from ImageMagick, which are actually quite nifty so I suggest installing that package if you haven't done so by now.
A really valuable tool for creating more complex functions is to take advantage of the shell (you can set what shell FVWM uses by setting 'ExecUseShell /bin/bash'). This is done via the PipeRead command. What PipeRead does is take the standard output from the shell (stdout) and uses it to configure FVWM. What this allows one to do is use the output from shell scripts (or even other scripts/programs that can be ran in the shell) to further customize FVWM. How this works is say for example you write a simple script that outputs some fvwm2rc syntax that you want to include in your fvwm2rc file, you then 'PipeRead "simple_script"' to include it in your config.
For our first example of some of the things we can do, lets create a function that will generate a WallPaperMenu from all of the .png files sitting in your wallpaper directory (designated by the environment variable $[fvwm_wallpaper]). Note that I use fvwm-root to set my wallpapers in X, and it uses either .xpm files or .png files, and since I prefer .png files, all my backgrounds are converted to .png. If you also like to use .jpg files, you'll need to modify this script. In the following I give you the three functions I use for my wallpaper menu (and setting the background).
DestroyFunc BuildWallPaperMenu |
When the function BuildWallPaperMenu is called, what it first does is remove any old icons that are floating around (from previous times its been run). It then makes an icon from each .png in your $[fvwm_wallpaper] directory using the convert command from ImageMagick. It then makes a menu in FVWM syntax and writes it to the file $[fvwm_home]/WallpaperMenu. It finally reads that newly created file, which creates a menu called FvwmWallpaperMenu and can be opened in FVWM. I prefer to write all this info to a WallpaperMenu so I can just create that menu at startup with adding a 'Read $[fvwm_home]/WallpaperMenu' to my StartFunction, or just writing that command directly in my fvwm2rc file in the menu section. If I add a new wallpaper to my $[fvwm_wallpaper] directory all I have to do is run this function again and it will generate a new FvwmWallpaperMenu. Also notice that I set up the menu so that when you click on a wallpaper it sets it with the FvwmChangeBackground function. I do this so I can then write what wallpaper I changed to in a config file. The reason for this is so when I run the InitWallpaper function from my InitFunction it will set it to the last wall paper I chose from the menu.
In my time with FVWM I have collected and modified many scripts to help customize my FVWM setup to behave the way I want it to. Throughout the advanced topics section I will present some more of these configurations (mostly functions and scripts) that I have come across and modified to my liking. I can't guarantee that these will work right out of the box, but my hope is they will give you some ideas and starting points to add more to your FVWM setup. I have split the topics up into three parts, enjoy.
Advanced Topics
- Advanced Functions
- Advanced Menu
-
Advanced FvwmButtons
Functions are one of my favorite things to use (as you noticed I write a function even for simple tasks). As is true with almost anything you want to program, being able to write good functions is the key. Almost all of the advanced sections are gonna include functions, so this part is just filled with miscellaneous functions.
These first two functions are taken from taviso's fvwm2rc file. They use the tools from ImageMagick to take screen shots of an open window and then use it for an Icon. The first function Thumbnail will use the screenshot of the current window and use that as the Icon for its Iconified state.
DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I SetEnv Icon-$[w.id] $[w.iconfile]
+ I ThisWindow (!Shaded Iconifiable !Iconic) PipeRead \
"xwd -silent -id $[w.id] | convert -scale $$(($[w.width]/5)) -frame 1x1 \
-mattecolor black -quality 0 xwd:- png:$[fvwm_tmp]/icon.tmp.$[w.id].png \
&& echo Nop"
+ I TestRc (Match) Test (f $[fvwm_icon]/$[w.iconfile], f $[fvwm_tmp]/icon.tmp.$[w.id].png) \
PipeRead "composite -geometry +2+4 \
$[fvwm_icon]/$[w.iconfile] $[fvwm_tmp]/icon.tmp.$[w.id].png \
$[fvwm_tmp]/icon.tmp.$[w.id].png && \
echo WindowStyle IconOverride, Icon $[fvwm_tmp]/icon.tmp.$[w.id].png || echo Nop"
+ I TestRc (NoMatch) WindowStyle IconOverride, Icon $[fvwm_tmp]/icon.tmp.$[w.id].png
+ I Iconify
DestroyFunc DeThumbnail
AddToFunc DeThumbnail
+ I PipeRead "echo WindowStyle Icon \\$\\[Icon-$[w.id]\\]"
+ I UnsetEnv Icon-$[w.id]
+ I Exec rm -f $[fvwm_tmp]/icon.tmp.$[w.id].pngThese functions can be used in place of 'Iconify'. The function Thumbnail will first take a screenshot of the current window and then write it to a temp file. The temp file is put in the dir $[fvwm_tmp], so you must have that enviorment variable set. The function then looks to see if you have have an Iconfile set for the window, 'Test (f $[fvwm_home]/icons/$[w.iconfile])'. This fill will only exist if you set it using a style command, for example 'Style "Firefox-bin" Icon 48x48/firefox.png' well set $[w.iconfile] to be 48x48/firefox.png (note that I set up so my icons are all in my $[fvwm_icon] dir). If this file exists then the function will 'composite' those two pics into one icon. Either way, it then sets the new Icon to be the screenshot image we just created and Iconifies the window. The DeThumbnail function cleans things up, it sets the icon back to its original state and then removes the temp icon it created so the next time the window is Tumbnailed it will behave the same as the first. There are two ways to make sure this function is run when an window is deiconified. One way is to also add an '+ I Iconify' to this function and bind it so its ran when you deicnoify a window. Or what I prefer is set up the module FvwmEvent to run this at the time the window is deiconified. This is nice cause then it doesn't matter how the icon is deiconified, this function will still run. To do this set up FvwmEvent as follows and then load the module at startup in your StartFunction.
#####
# FvwmEvent
###########
DestroyModuleConfig FvwmEvent: *
*FvwmEvent: deiconify DeThumbnailOne last note about these functions is that when you 'Restart' FVWM all the Icons are converted back to their original state and you have to deiconify then iconify the windows again to get things working. One way to work around is with adding '+ I All (Iconic) ReThumbnail' to your RestartFunction, where ReThumbnail is the following function.
DestroyFunc ReThumbnail
AddToFunc ReThumbnail
+ I Iconify
+ I ThumbnailIf everything is set up correctly then your Icons for your Iconified windows should look something like these two examples for firefox and gvim.
Another function that taviso wrote, he calls FvwmExpose. This function is like the WindowList function. What it does is uses ImageMagick to take a sreenshot of all the open windows and then put them into a menu using the screenshot as the icon. Here is a copy of his function.
#####
# FvwmExpose
###########
DestroyFunc FvwmExpose
AddToFunc FvwmExpose
+ I AddToMenu FvwmExposeMenu "e x p o s e" Title
+ I + DynamicPopDownAction DestroyMenu FvwmExposeMenu
+ I All (!Iconic !Shaded AcceptsFocus)\
PipeRead "echo Raise; \
xwd -silent -id $[w.id] | convert -scale $$(($[w.width]/10)) -quality 0 xwd:- \
png:$[fvwm_home]/tmp/icon.exp.$[w.id].png \
&& echo AddToMenu FvwmExposeMenu \
%$[fvwm_home]/tmp/icon.exp.$[w.id].png%\\\'\"$[w.name]\"\\\' WindowID $[w.id] WarpToWindow 50 50 \
&& echo AddToMenu FvwmExposeMenu \\\"\\\" Nop \
|| Nop"
+ I Popup FvwmExposeMenu
+ I Exec exec rm -f $[fvwm_home]/tmp/icon.exp.*Call this function from a binding, I use meta+middle mouse click, and it will popup the FvwmExposeMenu. Here is an example of what that menu will look like.
Menus are useful tools and can be generated dynamically in FVWM. The FvwmExpose function on the last page is an example of that. One of the nice thing about FVWM menus is being able to create them from scripts. This is nice because you could create a menu based off the wallpapers in a directory (example already shown), or you could create a menu that list all the contents of the directory (and its subdirectories). Some places to look for more information about this is to check out the fvwm-menu-directory and fvwm-menu-headlines scripts that come with FVWM (complete with man pages). Also look up MissingSubmenuFunction, DynamicPopupAction and DynamicPopdownAction in the FVWM man page.
Debian is my distro of choice. One nice tool that comes with debian is the 'menu' package which is used to generate menus. The FVWM debian package comes with a script that takes advantage of this to generate a menu of the installed apps on your debian box. I have taken this script and modified to my own liking and use it to generate a DebianMenu on my desktop. If you have debian and are interested in this you'll need to grab the following three files: fvwm_menu, fvwm_menu.h and fvwm_menu_data.h. Then you'll have to put these files in your $[fvwm_scrpt] directory. After that you'll also need to add the following function to your fvwm2rc.
#####
# DebianMenu
###########
DestroyFunc BuildDebianMenu
AddToFunc BuildDebianMenu
+ I Exec if [ -f "$[fvwm_home]/DebianMenu" ] then rm $[fvwm_home]/DebianMenu fi
+ I PipeRead 'update-menus --menumethod $[fvwm_scrpt]/fvwm_menu; \
cat $[fvwm_home]/DebianMenu'Though the use of the menu package this function creates a file called $HOME/.fvwm/DebianMenu. If you use another location as your $[fvwm_home] you'll have to modify the fvwm_menu script slightly. It then cats the file and uses it to create the DebianMenu. I have this set up so you have to run the function BuildDebianMenu anytime the menu needs to be updated, but the nice thing about it is all you have to do is 'Read $[fvwm_home]/DebianMenu' at startup to include this menu in your setup. To get to the menu, just add it to your FvwmRootMenu and 'Popup DebianMenu'.
For the next example, I have modified the script fvwm-menu-directory to use to create myself a MediaMenu to list my music. I suggest you first take a look at both the fvwm-menu-directory and fvwm-menu-headlines man page first. The following is an example for a modified version of fvwm-menu-directory. I have two main features I added to the script. The first one is for any directory it will look for a file called [directory_name].png and if it finds one it will use that image as the Icon for that directory in the menu (and in the title of the submenu generated by that directory), along with this feature I have set it up so you can ignore all .png files and not list them in the menu. The second feature I have added is the ability to only list parts of the directory, so the menu doesn't get too big. Before I explain how these work lets first look at the FuncFvwmMenuDirectory that is used to generate these functions and the 'MediaMenu' that spawns them.
DestroyFunc FuncFvwmMenuDirectory
AddToFunc FuncFvwmMenuDirectory
+ I PipeRead '$[fvwm_scrpt]/fvwm-menu-directory --title "%d" --dir "$0" \
--links --command-file "exec xmms \\"%f\\"" \
--command-title "exec xmms \\"%d\\"" \
--icon-title "$0.png" --icon-file "menu/notes.png" \
--exclude ".png"'
#####
# MediaMenu
###########
DestroyMenu MusicMenu
AddToMenu MusicMenu "Music" Title
AddToMenu MusicMenu MissingSubmenuFunction FuncFvwmMenuDirectory
+ "Artists A-B%menu/music.xpm%" Popup /home/music/albums/artists|[14AB]
+ "Artists C-G%menu/music.xpm%" Popup /home/music/albums/artists|[CDEFG]
+ "Artists H-K%menu/music.xpm%" Popup /home/music/albums/artists|[HIJK]
+ "Artists L-O%menu/music.xpm%" Popup /home/music/albums/artists|[LMNO]
+ "Artists P-S%menu/music.xpm%" Popup /home/music/albums/artists|[PQRS]
+ "Artists T-Z%menu/music.xpm%" Popup /home/music/albums/artists|[TUVWXYZ]
+ "Unsorted%menu/music.xpm%" Popup /home/music/albums/unsorted
+ "Assorted Music%menu/music.xpm%" Popup /home/music/assorted
+ "Collections%menu/music.xpm%" Popup /home/music/albums/collections
+ "Soundtracks%menu/music.xpm%" Popup /home/music/albums/soundtracksHow the MediaMenu works is it sets up FuncFvwmMenuDirectory as the MissingSubmenuFunction. What this does is if you try to Popup a submenu that doesn't exist, it will send the name of the submenu to the FuncFvwmMenuDirectory. That function then generates the submenu so it can be PopedUp. How my FuncFvwmMenuDirectory works is it takes a directory name followed by the list of the starting letters of the items to include. For example, 'Popup /home/music/albums/artists|[CDEFG]' will only list the files/directories in /home/music/albums/artists that start with C, D, E, F or G. Here is an example of what this will look like.
FvwmButtons is probably one of the most versatile modules that comes with FVWM. One can make about any type of 'Dock' or 'Panel' with it, plus they can all use Transparent colorsets. Taviso wrote a nice little intro to FvwmButtons that can be found here. The following is a collection of a few sample config to show you some of the neat stuff that one can do with FvwmButtons.
For the first example, I created a 'Dock' that has rounded corners, is transparent and contains an FvwmScript to create a simple clock.
#####
# DockButtons
###########
Style "DockButtons" !Title, !Handles, Sticky, WindowListSkip, \
CirculateSkip, BorderWidth 0, HandleWidth 0
Colorset 15 RootTransparent, fg rgb:00/00/00, bg average, \
Tint white 40, bgTint white 40, RootTransparent, \
Shape dock-mask.xpm
Colorset 16 RootTransparent, fg rgb:00/00/00, bg average, \
Tint white 40, bgTint white 40, RootTransparent
DestroyModuleConfig DockButtons: *
*DockButtons: Geometry 600x80
*DockButtons: Colorset 15
*DcokButtons: Rows 2
*DockButtons: Columns 30
*DockButtons: (1x2, Frame 0)
*DockButtons: (4x2, Frame 0, Icon 64x64/terminal.png, \
Action(Mouse 1) "FvwmATerm", Action(Mouse 3) "FvwmXTerm")
*DockButtons: (4x2, Frame 0, Icon 64x64/firefox.png, \
Action(Mouse 1) "FvwmFireFox")
*DockButtons: (4x2, Frame 0, Icon 64x64/xmms.png, \
Action(Mouse 1) "FvwmXmms")
*DockButtons: (4x2, Frame 0, Icon 64x64/gimp.png, \
Action(Mouse 1) "FvwmGimp")
*DockButtons: (4x2, Frame 0, Icon 64x64/editor.png, \
Action(Mouse 1) "FvwmGVim")
*DockButtons: (8x1, Frame 0, \
Swallow FvwmApplet-DigitalClock `FvwmScript $[fvwm_scrpt]/DigitalClock 16`)
*DockButtons: (2x1, Frame 0, Icon 32x32/cpumon.png)
*DockButtons: (2x1, Frame 0, Icon 32x32/memmon.png)
*DockButtons: (2x1, Frame 0, Icon 32x32/diskmon.png)
*DockButtons: (2x1, Frame 0, Icon 32x32/netmon.png)
*DockButtons: (1x2, Frame 0)To start out with I set up the default styles for my DockButtons and then create two colorsets they will use. The one part that is different than any of the other colorsets I've used is the 'Shape' option. What this does is takes the 'shape' of an .xpm image and uses it to shape the button. How this works is I create a transparent .xpm file (as shown below), using the transparent part of the pixmap to describe the Shape of the window (Buttons). To read more on this, check out the FvwmThemes man page, and look for 'Shape', 'TitleShape' and 'AspectShape'.
The file dock-mask.xpm opened in the gimp.
DockButtons with rounded cornersThe one thing you should notice in the DockButtons config is the 'DigitalClock' applet. How this works is it uses the module 'FvwmScript' which can be used to build graphical interfaces. All this simple DigitalClock script does is take the output from 'date "+%b %e, %R"', and prints it to a window. This script can take one argument which states what colorset to use. I then 'Swallow' the window into my DockButtons. This is a really nice feature because you can have FvwmButtons swallow many applications, including non dockable apps. In this case I swallow the output of the DigitalClock script, which is the date and time using the colorset sent to the script.
This next example is the FvwmButtons I use on my desktop. I have included the time, a few quick launch buttons for my favorite applications and then have swallowed the FvwmPager, xosview system monitors and an FvwmScript that takes the output from lm-sensors.
Style "UkkostaButtons" !Title, !Handles, Sticky, WindowListSkip, \
CirculateSkip, BorderWidth 0, HandleWidth 0
Colorset 15 fg rgb:00/00/00, bg #e6e7d7, Shape ukkostabuttons-mask.xpm
Colorset 16 fg rgb:00/00/00, bg #e6e7d7
DestroyModuleConfig UkkostaButtons: *
*UkkostaButtons: Geometry 110x580-20+20@1
*UkkostaButtons: Colorset 15
*UkkostaButtons: Pixmap $[fvwm_img]/buttons-bg.png
*UkkostaButtons: Rows 40
*UkkostaButtons: Columns 4
*UkkostaButtons: Frame 0
*UkkostaButtons: Font "Shadow=2:xft:Winks:Medium:pixelsize=24:minspace=False:antialias=True"
*UkkostaButtons: (4x2, Frame 0, \
Action(Mouse 1) 'All (Sticky Iconifiable) Iconify', \
Title(Center) "ukkosta")
*UkkostaButtons: (4x1, Frame 0, \
Swallow FvwmApplet-DigitalClock `FvwmScript $[fvwm_scrpt]/DigitalClock 16`)
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/firefox.png, \
Action(Mouse 1) "FvwmFireFox")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/terminal.png, \
Action(Mouse 1) "FvwmXTerm", \
Action(Mouse 2) "Exec exec pterm", \
Action(Mouse 3) "FvwmATerm")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/editor.png, \
Action(Mouse 1) "FvwmGVim", \
Action(Mouse 3) "FvwmXEmacs")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/chat.png, \
Action(Mouse 1) "FvwmTalkbox", \
Action(Mouse 2) "FvwmIrssi", \
Action(Mouse 3) "FvwmGaim")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/xmms.png, \
Action(Mouse 1) "FvwmXmms", \
Action(Mouse 2) "FvwmMixer")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/tux.png, \
Action(Mouse 1) "FvwmRox")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/gimp.png, \
Action(Mouse 1) "FvwmGimp", \
Action(Mouse 2) "FvwmXpaint", \
Action(Mouse 3) "FvwmXfig")
*UkkostaButtons: (2x4, Frame 0, \
Icon 48x48/x.png, \
Action(Mouse 1) "FvwmXlock", \
Action(Mouse 2) "Restart", \
Action(Mouse 3) "Quit")
*UkkostaButtons: (4x8, Frame 0, \
Swallow FvwmPager 'Module FvwmPager')
*UkkostaButtons: (1x2, Frame 0, \
Icon menu/cpumon.png, \
Action(Mouse 1) 'FvwmTop')
*UkkostaButtons: (3x2, Frame 0, \
Swallow(UseOld) "cpumon" `Exec exec xosview -title cpumon +cpu`)
*UkkostaButtons: (1x2, Frame 0, \
Icon menu/memmon.png)
*UkkostaButtons: (3x2, Frame 0, \
Swallow(UseOld) "memmon" `Exec exec xosview -title memmon +mem`)
*UkkostaButtons: (1x2, Frame 0, \
Icon menu/diskmon.png)
*UkkostaButtons: (3x2, Frame 0, \
Swallow(UseOld) "diskmon" `Exec exec xosview -title diskmon +disk`)
*UkkostaButtons: (1x2, Frame 0, \
Icon menu/netmon.png, \
Action(Mouse 1) "Exec exec xterm -title iptraf -e 'sudo /usr/sbin/iptraf -i all'")
*UkkostaButtons: (3x2, Frame 0, \
Swallow(UseOld) "netmon" `Exec exec xosview -title netmon +net`)
*UkkostaButtons: (4x4, Frame 0, \
Swallow FvwmApplet-Sensors `FvwmScript $[fvwm_scrpt]/Sensors 11`)
*UkkostaButtons: (4x1, Frame 0)These buttons have about everything I want to see on my desktop in there. On the top I have my computers name and the time, followed by a collection of 'quick launch' buttons. Next I swallow the FvwmPager so I can see what is opened on my desktop. After the pager are a collection of monitors using xosview. Xosview is a collection of system monitors that can display a graphical bar to show the current status. To set this up first I turn off all the monitors by default in .Xdefaults file. Then I swallow one for each monitor I want telling xosview what to display. For example my 'cpumon' is run by the line "Swallow(UseOld) "cpumon" `Exec exec xosview -title cpumon +cpu`". What this does is tell the FvwmButtons to swallow (and use the running app if it exists) an app by the name of cpumon. It then launches xosview, which it told to have the title of cpumon and to turn on the cpu monitor. With this I get four monitors, cpu, memory, disk and network. At the end of my buttons I swallow another FvwmScript by the name of 'Sensors', that takes the output from the sensors command (lm-sensors) and write it to the UkkostaButtons. Here is an image of what these buttons look like.
For the last example, I will share with you a collection of functions that got posted to the fvwm mailing list by Liusd that I have modified. These functions make a one button dock, that will 'Hover' the Icon above the dock when the mouse is moved over it. These functions work fairly well in 2.5.10 (though there is a little bit of choppiness in them). As a note since these functions were posted, a new patch to the CVS tree of FVWM has included HoverIcon and PressIcon support for FvwmButtons configuration. I like the visual look of this a little better than just changing the Icon on a mouse over or mouse click. Reason being is this will actually make a new transparent FvwmButton that can hover above the current button and isn't constrained to the original button's geometry. With that being said, lets look at the collection of functions.
#####
# FvwmDock Styles
###########
Style FvwmDock* Sticky, NoTitle, NoHandles, BorderWidth 0, WindowListSkip, \
CirculateSkip
Style FvwmDock-* StaysOnBottom, FixedPosition, FixedSize
Style FvwmDockA* StaysOnTop, FixedSize
################
#
# ButtonDock Functions. These collection of functions create
# single icon buttons that cause the button to hover above
# everything when the mouse is moved atop of it. To get these
# to work it should only take copying all the five functions
# CreateDock, EnterHandler, LeaveHandler, RestoreButton
# and CreateActiveButton. Then call the function 'CreateDock'
# for each button on the dock bar. The function works as follows:
#
# CreateDock '$0' '$1' '$2' '$3' '$4' '$5' '$6' '$7' '$8' '$9'
# $0 -> ButtonId
# $1 -> Geometry
# $2 -> Icon
# $3 -> LargeIcon
# $4 -> X offset (from upper left hand corner)
# $5 -> Y offset (from upper left hand corner)
# $6 -> action for Mouse 1
# $7 -> action for Mouse 2
# $8 -> action for Mouse 3
# $9 -> Size of LargeIcon
#
###################################
DestroyFunc CreateDock
AddToFunc CreateDock
+ I DestroyModuleConfig FvwmDock-$0: *
+ I *FvwmDock-$0: Geometry $1
+ I *FvwmDock-$0: Font none
+ I *FvwmDock-$0: Colorset 9
+ I *FvwmDock-$0: Frame 0
+ I *FvwmDock-$0: Padding 0 0
+ I *FvwmDock-$0: (Id D$0, Icon $2)
+ I Module FvwmButtons FvwmDock-$0
+ I AddToFunc StartFunction I Module FvwmAuto 100 -menter 'EnterHandler $0 "$2" $3 $4 $5 $6 $7 $8 $9' 'LeaveHandler $0 $2'
DestroyFunc EnterHandler
AddToFunc EnterHandler
+ I ThisWindow (FvwmDock-$0) ThisWindow (!FvwmDock-*) Deschedule 35
+ I ThisWindow (FvwmDock-$0) WindowId $[last_winid] (FvwmDockA$0) Deschedule 35
+ I ThisWindow (FvwmDockA$0) Deschedule 45
+ I ThisWindow (FvwmDock-$0) SendToModule FvwmDock-$0 ChangeButton D$0 Icon "shadow.png"
+ I ThisWindow (FvwmDock-$0) CreateActiveButton $0 '$1' $2 $3 $4 $5 $6 $7 $8
# Delay ms should be longer than delay in FvwmAuto
DestroyFunc LeaveHandler
AddToFunc LeaveHandler
+ I ThisWindow SetEnv last_winid $[w.id]
+ I ThisWindow (FvwmDockA$0) Schedule 110 35 RestoreButton $0 $1
+ I ThisWindow (FvwmDock-$0) Schedule 110 45 RestoreButton $0 $1
DestroyFunc RestoreButton
AddToFunc RestoreButton
+ I SendToModule FvwmDock-$0 ChangeButton D$0 Icon $1
+ I KillModule FvwmButtons FvwmDockA$0
DestroyFunc CreateActiveButton
AddToFunc CreateActiveButton
+ I DestroyModuleConfig FvwmDockA$0: *
+ I *FvwmDockA$0: Pixmap none
+ I *FvwmDockA$0: BoxSize fixed
+ I *FvwmDockA$0: Frame 0
+ I *FvwmDockA$0: Font none
+ I *FvwmDockA$0: Padding 0 0
+ I *FvwmDockA$0: Rows 1
+ I *FvwmDockA$0: Columns 1
+ I ThisWindow PipeRead `echo *FvwmDockA$0: Geometry $8+$(($[w.x]$3))+$(($[w.y]$4))`
+ I *FvwmDockA$0: (Icon $2, Action(Mouse 1) '$5', Action(Mouse 2) '$6', Action(Mouse 3) '$7')
+ I Module FvwmButtons FvwmDockA$0How these functions work is all you need to do is call the CreateDock function from your StartFunction (or fvwm2rc file) for each icon you want in your dock. As seen above the CreateDock function takes 10 arguments, that tell it what size, icons, and actions you want to bind to the button. For example say you wanted to create a two icon dock with one icon above the other. What you would do is call the CreateDock function twice for both docks, and then use the geometry option to stack the two icons right next to each other. For example I added the two lines to my StartFunction;
+ I CreateDock '10' '56x56-74+62@1' '48x48/firefox.png' '64x64/firefox.png' '-20' '-30' 'FvwmFireFox' 'Nop' 'Nop' '64x64'
+ I CreateDock '11' '56x56-74+116@1' '48x48/xmms.png' '64x64/xmms.png' '+20' '-30' 'FvwmXmms' 'Nop' 'FvwmMixer' '64x64'This creates two Docks, number 10 and number 11. Then when I move my mouse over one of the Docks, it will replace the current icon with shadow.png and then make a temporary Dock which has the large icon in it. The following three pictures should show how this effect works. Depending on your cpu this may be a little choppy, but all in all I still think it looks good.
One final note, is all the event handling to make all this effect happen is all setup to run via the StartFunction, so if you don't load these up by the time the StartFunction is run, you'll have to rerun the StartFunction to get it to work.
The following is a list of links that I have used or found in my days of using fvwm.
- fvwm.org
- fvwm-themes
- FVWM Wiki
- Thomas Adam's FVWM Intro
- Thomas Adam's FVWM Session Managment
- Thomas Adam's FVWM Stuff
- Calmar's FVWM Stuff
- Taviso's fvwm2rc
- Taviso's FvwmButtons Intro
- Ikaro's FVWM snapshots
- Liusd's FVWM Page
- FvwmTabs
- Mindsucks fvwm2rc
-