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
AddToFunc   BuildWallPaperMenu
+ I Exec rm $[fvwm_icon]/wallpaper/*.png
+ I PipeRead 'for i in $[fvwm_img]/wallpaper/*.png; \
  do convert -scale 64 $i \
  "$[fvwm_icon]/wallpaper/`basename $i`"; done && echo Nop'
+ I Exec rm $[fvwm_home]/WallpaperMenu
+ I Exec echo "DestroyMenu FvwmWallpaperMenu" > \
+ I Exec echo "AddToMenu FvwmWallpaperMenu \"Wallpapers\" Title" >> \
+ I PipeRead 'for i in $[fvwm_img]/wallpaper/*.png; \
  do echo "AddToMenu FvwmWallpaperMenu \
  \"`basename $i`%wallpaper/`basename $i`%\" \
  FvwmChangeBackground \"`basename $i`\"" \
  >> $[fvwm_home]/WallpaperMenu; done && echo Nop'
+ I Read $[fvwm_home]/WallpaperMenu

DestroyFunc FvwmChangeBackground
AddToFunc   FvwmChangeBackground
+ I Exec fvwm-root --retain-pixmap $[fvwm_img]/wallpaper/$0
+ I Exec echo "fvwm-root --retain-pixmap \
  $[fvwm_img]/wallpaper/$0" > $[fvwm_home]/cfg/background.cfg

DestroyFunc InitWallpaper
AddToFunc   InitWallpaper
+ I Exec source $[fvwm_home]/cfg/background.cfg

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

  1. Advanced Functions
  2. Advanced Menu
  3. Advanced FvwmButtons

Overview/Conclusion index Advanced Functions