Basic fvwm Configuration
A geometry entry for an application might look something like this:
If this looks a bit cryptic, don't worry, it's actually pretty simple. Converting this statement into plain English yields:
“The application window is 420 pixels wide by 320 pixels high, with its left border 5 pixels from the display's left edge and its top border 20 pixels from the display's top edge.”
Pretty simple, eh? There are actually only a couple of rules to keep in mind when specifying a window's geometry. First, dimensions are generally in terms of pixels, although there are times, notably with xterms and some text editors, in which the width and height dimensions will be in terms of characters. You'll notice in the example .xinitrc file above that the width and height dimensions for the xterm were given as 80x24, or 80 characters wide by 24 columns high. If you bear in mind that your entire display screen is probably 640x480 or 800x600 or 1024x768 pixels, depending on your resolution, you can get a feel for how much of the screen is taken up by an application window that is, say, 400x300 pixels.
The second set of numbers specify the horizontal (x-offset) and vertical (y-offset) distances from the edge of the display screen. Again, this is pretty straightforward: think of the screen in terms of graphing paper in which the upper left hand corner is 0,0 and the values increase as you move from left to right and from top to bottom.
If your screen were 640x480 pixels, your top left corner would be considered 0,0; the bottom left corner would be 0,480 (remember that the vertical position increases as you move from top to bottom); the top right corner would be 640,0; and the bottom right corner would be 640,480. The other thing to keep in mind is that horizontal and vertical positions are generally (but not always, as we'll see in a minute) specified in terms of the left and top sides of the application window.
For example, suppose that you wanted to put an xterm window in the upper left hand side of the screen. You decide that you want it 10 pixels from the left hand side of the display and 50 pixels from the top. You also want the window to be 400 pixels wide by 320 pixels high. Simple enough. You'd use the following geometry option to accomplish this:
Notice the general form this takes:
Using a plus + sign before the pixel value indicates the position of the window with respect to its left hand or top edges. However, using a minus - sign specifies the opposite meaning: the horizontal position is the distance in pixels between the application window's right hand side and the right side of the display, and the vertical position is the distance in pixels between the application window's bottom edge and the bottom edge of the display.
If this seems a bit confusing try playing with it a bit. Start up fvwm and in an xterm enter the following commands:
xterm -g +5+5 & xterm -g -5-5 & xterm -g -5+5 & xterm -g +5-5 &
Try these out and see where the xterm gets put. Note that you can generally abbreviate -geometry to a simple -g.
We've wandered a bit from our discussion about launching programs at startup. In practical terms, figuring out the correct geometry for all of the applications you want to have started is pretty easy. The first step is to get pencil and paper ready because you'll want to jot some notes.
Customizing the start-up desktop usually begins by starting all of the applications that you want present when fvwm begins. Try out various command line options to get the look and feel that you want. Reading a program's manual page often helps you determine what options are available at run time. Once you get an application running, you can generally resize it by clicking the mouse on one of the “L” shaped window corners and dragging it to a larger or smaller size. Clicking and dragging on the titlebar or side borders lets you position the window.
Once you have everything started, positioned, and sized the way you want it, jot down each application and the command line options, if any, that you used. To get each window's geometry, we'll use a great little program called xwininfo.
Start it from an xterm by entering:
at the command prompt. Notice that you don't use an ampersand for this command. Your mouse cursor will change to a cross-hair and the following instructions will be displayed:
xwininfo: Please select the window about which you would like information by clicking the mouse in that window.
Clicking on an application window produces the output like the following:
xwininfo: Window id: 0x2c00007 "ez ~/fvwm_LJ.ez*" Absolute upper-left X: 92 Absolute upper-left Y: 28 Relative upper-left X: 0 Relative upper-left Y: 0 Width: 528 Height: 724 Depth: 8 Visual Class: PseudoColor Border width: 0 Class: InputOutput Colormap: 0x21 (installed) Bit Gravity State: ForgetGravity Window Gravity State: NorthWestGravity Backing Store State: WhenMapped Save Under State: no Map State: IsViewable Override Redirect State: no Corners: +92+28 -532+28 -532-148 +92-148 -geometry 528x724+85+0
In this instance, I clicked on the EZ editor's window, which produced a veritable cornucopia of information. Specifically, the geometry setting that you were looking for is in the last line. Do this for all the applications that you want started, and your work is pretty much done. Find the section in .fvwmrc that defines the InitFunction, add or modify the entries so as to start the applications that you want—don't forget to put that ampersand at the end of each Exec line!—and you should be all set. Once you've gotten things the way you want them, don't forget to make a backup of your newly modified .fvwmrc file.
One more thing before we leave the subject of launching programs at start up. fvwm comes with a number of modules, which are separate programs which must be spawned by fvwm—you can't start these from a command line. There are a number of modules which can generally be found in the /usr/lib/X11/fvwm directory. A couple of the more common modules to launch at start up include FvwmBanner, which places a decorative banner across the root window; FvwmPager, which serves as a virtual desktop manager when you have multiple desktops going; and the GoodStuff button bar. The entry in InitFunction to start an fvwm module is a bit different than a regular application in that it is simpler:
Module "I" GoodStuff Module "I" fvwmPager 0 3
You'll notice that there's no Exec or Wait statement needed. Simply use the reserved word Module, followed by "I" and then the name of the module to launch with any options.
That wasn't too bad, was it? This should give you the basics that let you customize your startup desktop. Next month, I'll cover launching programs once fvwm has started—and more!
John Fisk (firstname.lastname@example.org) After three years as a General Surgery resident and Research Fellow at the Vanderbilt University Medical Center, he decided to “hang up the stethoscope” and pursue a career in Medical Information Management. He's currently a full-time student at the Middle Tennessee State University and hopes to complete a graduate degree in Computer Science before entering a Medical Informatics Fellowship. In his dwindling free time he and his wife Faith enjoy hiking and camping in Tennessee's beautiful Great Smoky Mountains. An avid Linux fan since his first Slackware 2.0.0 installation a year and a half ago.
Webinar: 8 Signs You’re Beyond Cron
On Demand NOW
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.View Now!
|Non-Linux FOSS: All the Bitcoin, None of the Bloat||May 26, 2015|
|Dr Hjkl on the Command Line||May 21, 2015|
|Initializing and Managing Services in Linux: Past, Present and Future||May 20, 2015|
|Goodbye, Pi. Hello, C.H.I.P.||May 18, 2015|
|Using Hiera with Puppet||May 14, 2015|
|Urgent Kernel Patch for Ubuntu||May 12, 2015|
- Initializing and Managing Services in Linux: Past, Present and Future
- Non-Linux FOSS: All the Bitcoin, None of the Bloat
- Dr Hjkl on the Command Line
- Using Hiera with Puppet
- Goodbye, Pi. Hello, C.H.I.P.
- Gartner Dubs DivvyCloud Cool Cloud Management Vendor
- Mumblehard--Let's End Its Five-Year Reign
- It's Easier to Ask Forgiveness...
- Infinite BusyBox with systemd
- Urgent Kernel Patch for Ubuntu