Skip Navigation
Site HomeSearch

On-Line Reference:
RedHat Linux Unleashed

Did this help?
... or
Donate at PayPal®...

 
Tux the Pengin

OK, here's a freebie: A simulation of the old text-based Star Trek game we used to play on HP 2100's using a Teletype ASR-33 as a console: StarTrek Game

Switching to the Fvwm/Fvwm2 Window Manager

Applies to RedHat 8 & 9 (This is a follow-up to Part 1, "How to change RedHat5.x default to WindowMaker")

Watching a movie recently, I glimpsed a computer monitor with UNIX "Motif" on the screen and that set me reminiscing about earlier days of X on Linux when the default window manager (WM) was "mwm", which had a Motif-like look to it. Having just converted to WindowMaker on both my Linux desktops (the current KDE and GNOME had grown too slow and bloated for my older machines), I decided to visit X Winman. After looking around and viewing screenshots and config files, I decided to use the more easily configurable Fvwm. I visited www.fvwm.org, to see if it was still alive, looked and felt the same, and is RedHat 9 compatible. Answer: yup, yup, and yup!

Here's how I did it.

While at www.fvwm.org/download/, I chose the stable version 2.4.16 tarball(1,475kb). (12/2004 -- They also now have several RPMs available at fvwm-themes.sourceforge.net/rpm/ -- installation is a little different; see below.)

(2005-09-26 Update: The newer versions don't work on RH9 -- only 2.4.16 appears to be happy.)

I slipped Brian Savage's "Soul Temptation" into my CD player, moved into my downloads directory and unpacked the tarball. I decided to see what a default configuration would give me (I read the README to see what the defaults were, and decided to put fvwm into /etc/X11R6 instead of the default /usr/local):

$ su root
Password:
# tar -zxf fvwm*.gz
# cd fvwm-2.4.16/
# ./configure --prefix=/usr/X11R6
# make
# make install

With that configure option, Fvwm installs the executable in /usr/X11R6/bin/fvwm2, and a link as /usr/X11R6/bin/fvwm --> fvwm2, and most of the rest of the files in /etc/X11R6/lib .

Note: If you installed the RPM instead, the fvwm binary may be installed in /usr/bin/fvwm so you have to make the link yourself:

# ln -s /usr/bin/fvwm /usr/X11R6/fvwm2

What starts the window manager?

Under RedHat 8 and 9, the graphical login is controlled by /etc/X11/prefdm. Prefdm makes a choice of desktop manager based on the contents of /etc/sysconfig/desktop, which can be "GNOME", "KDE", "XDM" or empty. RedHat, by default, uses GNOME, which causes prefdm to use "gdm", a binary. That looked like a dead-end, so I followed the older init trail through the /etc/X11/xinit files, such as Xclients and xinitrc. No changes there worked; I either failed to get an X session, or ended up with Gnome. I finally went back to /etc/X11/gdm and discovered it ends up calling "xdm". Under /etc/X11/xdm is a file called Xsession, which controls the login selection of window manager through a program called "/usr/share/apps/switchdesk". Based on your selection of a window manager in the login "Session" menu, gdm picks a file in its Sessions directory, which contains a call to /etc/X11/xdm/Xsession. Xsession calls switchdesk with an argument pointing to one of the files in the /usr/share/apps/switchdesk directory. Each "Xclients.(something)" file in that directory also matches one of the choices in the "Session" menu of the graphical login screen, determined by the contents of the /etc/X11/gdm/Sessions directory. To add fvwm as one of the choices, I created a "/etc/X11/gdm/Sessions/Fvwm" and "/usr/share/apps/switchdesk/Xclients.fvwm" files, by copying and editing similar ones in those locations:

[/etc/X11/gdm/Sessions/Fvwm]:
#!/bin/bash
exec /etc/X11/xdm/Xsession fvwm

[/usr/share/apps/switchdesk/Xclients.fvwm]:
#!/bin/bash
exec /etc/X11R6/bin/fvwm

I did all that in a Gterm window in WindowMaker and then just exited WindowMaker using WindowMaker's root-menu "Exit" item. That got me back to the graphical login for X, at which point I clicked on "Session" and clicked the new "Fvwm" choice, and answered,"No" when asked if I wanted to make "Fvwm" my default - I figured if something went wrong, I could then go back to WindowMaker by default.

Disable Gnome?

If you want to run the later versions (2.4+) of Fvwm on top of Gnome to make use of Gnome's extended desktop features, you are ready to skip to "Initial setup", below.

If, like me, you want to run bare Fvwm for speed and simplicity, you can short-circuit the startup of a gnome-session by creating an .xinitrc file in your home directory:

$ echo "exec /usr/X11R6/bin/fvwm2" > .xinitrc

Now, tell Prefdm you want only XWD, not the default GNOME desktop, by editing the /etc/sysconfig/desktop file:

[as root]
# rm -rf /etc/sysconfig/desktop
# echo "DESKTOP=XWD" > /etc/sysconfig/desktop

Initial setup

And now, heeeeeres... um, a cerulean screen, TOTALLY devoid of features!

Don't panic. You have not bombed, it's just that fvwm does not install a configuration file by default. Click the left mouse button to get a menu and choose Setup. You will get a larger dialog with some checkbox options, one of which is "Create a starting .Fvwm2rc file. Click "Copy Config File(s)" (there is no apparent GUI response to this) and then "Restart fvwm". The file /usr/local/share/fvwm/ConfigFvwmSetup is copied into your home directory as "~/.fvwm/.fvwm2rc".

Now you have a little more content on a lavender-colored screen. In the lower right is a collection of items including a window list, a mail checker(XBiff), an analog clock(XClock), a cpu load monitor graph(XLoad), and the desktop switcher. You actually at this point have several (10 to be precise) virtual desktops, each with 4 workspaces. Initially you are in desketop 0, and if you move the cursor to the right edge, it will slide into the right-top workspace.

Clicking the desktop evokes the "Root Menu" from which you can launch a terminal and from there you can run the editor of your choice (I recommend vi or nedit, or xed) to make confguration changes to your ~/.fvwm/.fvwm2rc file.

CUSTOMIZING (Creating a personal "look")

:: Add a background image.

I don‚?ā¨∆?ĄĘt care for bare backgrounds except on slow machines or servers, so the first thing I did was add a picture to the desktop ("root window" in X parlance):

$ xv -quit -rmode 5 /backgrounds/images/leafdrops.jpg &

Xv is a graphic utility you can get at http://www.trilon.com/xv/xv.html, that has numerous features not the least of which is the ability to view images. It will also allow you to take screenshots, although it takes a few tries to get just the shot you want. The RedHat RPM'd version there works fine with RH9. I prefer using "import" commandline utility built into Linux, which can be setup to capture after a delay, so you can capture menus in action. I put that command in a "Utilites" menu item for easy access.

:: Automating

You can put any of your favorite customization commands like the one above, into an initialization entry inside your ~/.fvwm/.fvwm2rc file like this:

[portion of ~/.fvwm/.fvwm2rc]:
:
:
################ Initialization functions #################
:
AddToFunc InitFunction
+ I exec xsetbg /usr/share/backgrounds/images/leafdrops.jpg
+ I exec sudo rt -g 60x40+25+125 /var/log/messages,gold -shade &

(you can comment out ("#") the line with "xsetroot..." that sets the background to a color)

Those lines put my image on the root-window and place a dynamic transparent tail of the messages file superimposed on it (see "root-tail" - requires you have "sudo" privileges to run /etc/X11R6/bin commands). Notice I used the standard X feature "xsetbg" to place the background. The image should be scaled to fit your actual screen resolution before hand, for which you can use The Gimp. There is an "iconified" Galeon browser running, a "nedit" editor window containing my .fvwm2rc file, and a shell running in xterm (the steelblue window).

:: Window Behavior

I like windows to raise when I click anywhere in them, not just in the title bar, so I added this to my .fvwm2rc in the area under "default styles":

Style *      MouseFocusClickRaises

Because I also use a Mac OS X system daily, I like the window buttons on the left end of the titlebar. There can be 10 buttons numbered in order left to right -

1 3 5 7 9 0 8 6 4 2

with odd-numbered ones on the left of the window title, and even-numbered on the right. Each button has a "look" or icon type specified in "ButtonStyle" lines in .fvwm2rc (see below).

[original]

# for the titlebar buttons
Mouse 0 1    A     Menu MenuFvwmWindowOps2 Close
Mouse 0 2    A     Maximize 0 80
Mouse 0 4    A     Iconify

[new]

# for the titlebar buttons
Mouse 0 1    A     Close
Mouse 0 3    A     Iconify
Mouse 0 5    A     Maximize 80 90    # H V
Mouse 0 2    A     Menu MenuFvwmWindowOps2

Button 2 was the square button first on the right side, and its function was to maximize the window vertically to 80 percent of the window height. Now that function is on button 5 (third from the left, the "+"-sign) and maximizes to 80 percent of window width, 90 percent of the height. The iconify function button is now button 3, 2nd from the left ("-" symbol). Button 1 ("X"), was the window ops menu, now closes the window, and I moved the window-ops function to button 2 (rightmost). I drew the symbols using Fvwm's vector function to approximate the function of my Mac OS X window buttons. Here are the button definition lines in .fvwm2rc :

# Button Style Changes
ButtonStyle Reset
# Horiz bars for the window ops menu (rightmost)
ButtonStyle 2 12 10x23@0 90x23@0 90x28@0 10x28@1 10x47@1 90x47@0 
90x52@0 10x52@1 10x70@2 90x70@0 90x76@0 10x76@1 # Standard X for the close button (leftmost) ButtonStyle 1 17 20x20@1 30x20@1 50x40@1 70x20@1 80x20@1 80x30@0
60x50@0 80x70@1 80x80@0 70x80@0 50x60@0 30x80@0
20x80@0 20x70@0 40x50@1 20x30@0 20x20@1 # Horiz bar means iconify ButtonStyle 3 Default 1 # large plus symbol means maximize ButtonStyle 5 13 60x20@0 60x40@0 80x40@1 80x60@0 60x60@0 60x80@0
40x80@0 40x60@1 20x60@0 20x40@1 40x40@1 40x20@1 60x20@1

(Lines look wrapped here - continuous in the actual file) Those lines give this appearance to the titlebar:
Fvwm titlebar

Here is another set that gives a resemblance to the CDE interface-style buttons:

# C D E  L O O K #########################################
# Horiz bar (left side)
# Longer thin horiz line
ButtonStyle 1 Vector 5 15x45@0 85x45@1 85x55@0 15x55@0 15x45@1
# Large square (right side)
ButtonStyle 2 Default 2
# Small square (inside right)
ButtonStyle 4 Default 5

# C D E  Title bar buttons
Mouse 0 1       A       Menu MenuFvwmWindowOps2 Close
Mouse 0 2       A       Maximize 100 100
Mouse 0 4       A       Iconify

Which, along with setting the edge width to 4 pixels instead of 7, and removing the gradient in the TitleStyle specification yields a very clean bar. The right button max/minimizes, and the inner right iconifies:
Fvwm titlebar

In another later section of the .fwm2rc file (FuncFvwmMoveOrRaise), I changed the function of a double click on the titlebar to "windowshade" the window instead of lowering it in the stacking order:

[original]
DestroyFunc FuncFvwmMoveOrRaise
AddToFunc FuncFvwmMoveOrRaise
+ I Raise
+ M Move
+ D Lower
[new]
DestroyFunc FuncFvwmMoveOrRaise
AddToFunc FuncFvwmMoveOrRaise
+ I Raise
+ M Move
+ D WindowShade

:: Smaller Button Panel

Fvwm defaults to putting a collection of mini-apps in a box in the lower-right corner of the screen. It eats up a lot of room on smaller screens like that of my 12" laptop, so I hunted for days until discovering that it is NOT an FvwmWharf, but is a "buttonbox". The default config file (that defines its look and construction) is in /usr/local/share/fvwm/2.4.16/ConfigFvwmButtons and is invoked by a "read" command in the very bottom of your ~/.fvwm/.fvwm2rc file. To prevent it from ever coming up in the first place, just comment out the "read ConfigFvwmButtons" line. To customize the buttonbox, copy ConfigFvwmButtons to ConfigFvwmButtons-orig, then modify ConfigFvwmButtons to suit your needs. I just commented out the lines for "xbiff" and "xload", and set the overall box height from 100 px down to 50 px so it takes up less room. Further customization included playing with other numbers in the file to close up wasted space.

That is all I am going to say about fvwm, in typical fashion I will leave further automation of desktop features and other fvwm configuration/customization to you. There are some great ideas for theming various X window managers in user-posted config files and screenshots at http://www.plig.org/xwinman/.

To maintain minimalist looks but add powerful functionality, you should also use xterm, or the better-scrolling Wterm, and also check out NEdit , my favorite editor, and XWC, a strong-featured file manager that is a (blazing fast -- compared to the sluggish Nautilus!) Windows Explorer clone.

Print plain