Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Linux Magazine

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents
Up to --> Linux Tutorial

· The X Windowing System
· Configuring the X-Windows Server
· The Basics of X
· Resources
· Colors
· Displaying Clients
· Fonts
· The Window Manager
· Remote Access

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 86 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

Linux Tutorial - The X Windowing System - The Window Manager
  Fonts ---- Remote Access  

The Window Manager

Because the window manager is an important aspect of X, I need to cover it in more detail. As I mentioned earlier, in most versions of Linux, you will find a couple of window managers. The fvwm seems to be the most common, although I do see twm quite often.

The following sections describe the basic default behavior of windows, icons, the icon box, input focus, and window stacking. The appearance and behavior of the window manager can be altered by changing the configuration of specific resources.

One way to control your windows is though accelerator keys (also called hotkeys). By default, several accelerator keys perform various functions. Its quite possible that on your system these bindings have been commenting out of your .fvwmrc file. I'll get to how to change entries in a moment.

These functions (probably) can be reached through the window menu as well. It all depends on what is configured in your .fvwmrc file. Any windows managed by fvwm will have these keys, which are explicitly defined and can be changed by modifying the appropriate resource (which I'll get to in a moment). These keys are

Alt+F1Run popup "Utilities"
Alt+F2Run popup "Window Ops"
Alt+F3Run FvwmWinList Module
Alt+F4Iconify the window
Alt+F5Move the window
Alt+F6Resize the window
Alt+F7Circulate window up
Alt+F8Circulate window down
Alt+F9Iconify the window

The window manager is also responsible for managing icons. As I mentioned earlier, icons are small graphic representations of clients. Iconifying (turning into an icon) a client is a good way to reduce the space taken by clients that are currently not being used. Although the pager enables you to move clients from one virtual screen to another, icons are a good way of being able to instantly access a particular client. This is done with an "icon box." The icon box that you will find on your system is called FvwmIconBox and, in most cases, you will have to configure the system to start it. (I'll discuss this shortly.)

A nice thing about the icon box is that it represents all running clients, not just those that have been iconified. This makes finding the client you want easy, because by double-clicking its icon in the icon box, it immediately is made the active window and is brought to the front.

If you have a lot of icons, using the icon box is a good way to manage them. The author of the FvwmIconBox describes it as a "clutter-reduction program." The icon box is simply another client that manages the icon images. The icon box can be moved and resized, even iconified. If there are more icons in the icon box that can be shown in the box, scroll bars will appear.

One strong point of both window managers is the ability to configure them to our tastes. Up to now we have basically been talking about the appearance of fvwm. What is really fun is to modify its behavior. One way to accomplish this is through the resource description file, which contains descriptions of resources that are easily defined in the resource files. The descriptions of resources include such things as the behavior when buttons are pressed and the individual entries in each menu.

The default resource description file is /etc/X11/fvwm/system.fvwmrc or /etc/X11/fvwm/system.twmrc. Here again, unless you want to institute systemwide changes, I recommend that you copy the appropriate file into the users home directory. This copy then has the name $HOME/.fvwmrc or $HOME/.twmrc. Here is where your default menus and default bindings are defined. When you click the root window, the root menu pops up, as defined in the .fvwmrc or .twmrc file, which is very easy to modify to your personal tastes and preferences.

Three types of resources can be described here: buttons, keys, and menus. It is said that window manager functions are bound to button or key-press events. The relationship between the button or key press is called a binding.

Because the resource description file is an ASCII text file, it is easy to edit to make the changes you want. The format of each type of resource is slightly different, but in each case, the fields are separated by white spaces. Any text from an unquoted pound sign (#) to the end of the line is considered a comment. Therefore, if any description must be contained the #, it must be quoted. Single characters can be "quoted" by escaping them (using the back-slash). Any line containing a ! (exclamation mark) as the first character is also treated as a comment.

When an event occurs (button or key is pressed or menu item is selected), a particular window manager function is called. In general, we can say that the functions have the following syntax:

function function_arguments

You can call dozens of functions that relate to everything from resizing the particular window or icon to shuffling the order, moving, and all the other functions we talked about. All of these are detailed in the fvwm man-page, so I don't feel the need to cover them all. However, I will discuss some of the more common functions as I describe the syntax of the resource descriptions.

The first thing we'll talk about is the idea of a popup menu. This is not like the menus in most programs where you see a list of options at the top of the screen and when you click the list, a menu suddenly appears. These are called pull-down menus because you pull them down from the menu list. Popup menus seem to popup out of nowhere. With other window managers, pop-ups are referred to as menus.

You will probably see on your system that when you click an open area of your desktop with the left mouse button, a menu called "Program Menu" will pop up. This menu is defined in your .fvwmrc file. Each popup menu is defined with the following syntax:

Popup "Popup Name" functions to call EndPopup

In the case of our "Program Menu," the pop-ups name is actually "Applications," so look for the line

Popup "Applications"

When you find it, you will see all the same entries that would appear when you click the desktop. When you click one entry in the list, that particular program or module will start. (A module is a program used by the window manager and cannot be started in any other way.)

You'll see that some of the entries have an arrow on the right side. When you click the arrow, it brings up another popup that is defined somewhere else in the .fvwmrc file. These pop-ups could then have entries that go to other pop-ups. Although I have tested this to five levels deep, I have never really had a need to go beyond three levels of popup menus.

To start a particular program or module from within the menu, use the Exec function. The syntax for the Exec definition is

Exec name exec <arguments>

An example would be

Exec "k3b" exec k3b &

The name in each line is the symbol that will appear in the menu pane for that entry, here, "K3B." Labels containing spaces or tabs must be enclosed within double quotes, as in our example. To start another popup, the syntax would be

Popup "Menu Entry" Popup_Name

Here the "Menu Entry" is just what appears in the menu. The Popup_Name is what it actually will be called.

The title function within a popup is what appears at the top of the menu when it's started. For example, our applications popup was called "Applications" and that is how the system referred to it. However, when we started it, the words "Program Menu" appeared at the top. This is the title of the menu and has no other function.

If the function called is the no-operation function (Nop), the function is invalid and/or is the equivalent of adding a separator in other window manager. If you use just two double quotes (" ") as the name, you will see a line between entries. However, you could include a line of something like an equal sign (=) to give your menu a different effect.

The accelerator keys syntax is

Key <keyname> <context> <modifiers> <function>

Here <keyname> is the name of a key like F1 for the F1 function key or Tab for the Tab key. The <context> is when this key press should be valid. Unlike mouse actions, a key press should be valid in all cases, so you can use an A. The <modifiers> is used for an addition key that should be pressed as well, such as "C" for the Ctrl key, "A" for the Alt key, "M" for the Meta key, and "S" for the Shift key. As I mentioned earlier, your accelerator keys may have been commented out, so look for the section starting "Keyboard Accelerators."

One example looks like this:

Key F1 A M Popup "Utilities"

Note that in contrast to key presses, key bindings to window manager functions are just for the key presses. Key releases have no meaning in this context. Also, the modifiers are exclusive, which means that no other modifier key can be pressed. Because I specified just Meta+F1 and not SHIFT+Meta+F1, pressing SHIFT+Meta+F1 would have no effect (unless I had defined it to something already). If you want, you could use something like "SM" to indicate pressing both the Shift and Meta keys.

Each button binding has the following syntax:

Mouse button context modifier function

The button field defines what button to which this function should apply (1, 2, 3). The context is when the particular function should be in effect. Valid contexts are:

AA -Any context except for the title bar
RRoot window
WApplication window
TWindow title bar
SWindow side, top, or bottom
FWindow frame (corners)
IIcon window

You can define certain characteristics of the windows. You can define certain characteristics, such as the foreground and background color, geometry, etc., when the client is started or by defining that particular resource, using the Style command within .fvwmrc. In many cases, resources define the same characteristics. See the fvwm man-page for details.

The syntax of the Style command is

Style <windowname> <options>

The <windowname> can be something other than the windows name, for example, a class or resource string. The <options> are a common separated list of values. Some options require arguments like Icon, which requires the name of the icon that you want to use when the window is iconified.

 Previous Page
  Back to Top
Table of Contents
Next Page 
Remote Access


Test Your Knowledge

User Comments:

You can only add comments if you are logged in.

Copyright 2002-2009 by James Mohr. Licensed under modified GNU Free Documentation License (Portions of this material originally published by Prentice Hall, Pearson Education, Inc). See here for details. All rights reserved.

There are several different ways to navigate the tutorial.



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
The Linux Tutorial can use your help.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.15 Seconds