Chapter 9 The Window Manager-Window to Your Machine The Window Manager-Window to Your Machine Once the configuration of the X server is accomplished, the typical user im- mediately wants to implement a colorful desktop with windows, menus and many other features that a first-rate desktop needs. This chapter looks at window managers. The following topics are covered: * the window manager and its tasks * fvwm2-a classical window manager in Linux * KDE-the K Desktop Environment as an alternative * susewm-a very elegant way to modify your own configuration file * in practice-adapting all the various settings Even if you are eager to rush ahead, you still need some theory to begin with, so be patient! 9.1 Some Theory 9.1.1 General In contrast to the monolithic graphics desktops used in Windows and OS/2, the various functional layers used by UNIX and Linux are separated into independent sections. This, at first glance, makes the system more complex. On the other hand, it gains flexibility and the system is able to handle more complex tasks. The first layer above the hardware is the operating system, which handles "low-level" tasks like memory management, for example. On the next layer the X Server (X Window System) is located, which cor- responds to the "graphics device driver" used in other systems. The X server provides a network-wide abstract layer below the GUI itself. Thus, you are able to use these services via an entire network (including the Internet). In short: The X server actually does "nothing else" but: * communicate with the graphics card, * draw dots, lines, rectangles and text, and 229 9. The Window Manager-Window to Your Machine * distribute services over the net or on the local host. Even though most users run an X server locally (i.e. just on their own ma- chine), its integrated network capabilities, transparent for the user, are a huge advantage in using an X server. Thus a uniform interface has been created which does not put any limitations on the graphical design of the desktop. Only because of this is it possible for different graphical desktops to be developed, and yet have all programs displayed in the same way on all desktops. In a network environment it is also possible, for example, to have an application run on the machine in the office, but have all its screen output displayed on the PC at home. It does not matter here if just single applications, or the entire desktop are running on the remote computer. The hardware architecture, and the operating system also play no role here (as long as they support X11). Thus, for example, you no longer need to sit in the same room as the powerful, but noisy, workstation, but you can work on another, less powerful computer, from the comfort of the office, with the application running on the workstation remotely. Since Linux is a multi-user system, a number of different users can work on the same machine, via X terminals1. Now, to be able to display all the graphics stuff such as rectangles and things known as "windows", the services of a window manager are essential. Windows are important to clarify context; windows let you start applications in windows next to each other, and provide menus with which you can operate your system comfortably. The window manager is an additional layer between the X server, your appli- cation programs and the user.2 User Applications Windowmanager X-Server Hardware Figure 9.1: Layers of GUIs in Linux On Linux there is a wide variety of window managers, e. g.: whereby dis- tinction should be made between pure window managers and "Desktop Envi- 1 an X terminal is an small computer without a hard drive, which boots via the network 2 X application developers may access the server directly. 230 9.1. Some Theory ronments". Whilst window managers only manage the windows, a "Desktop Environment" manages a number of applications, all having the same look and feel. In SuSE Linux the following window managers, amongst others, are in- cluded: * fvwm and fvwm2 (the window manager) * fvwm95 (Windows 95 clone) * bowman (has the look and feel of NeXTSTEP) * ctwm * afterstep * olvwm (OpenLook virtual window manager) * cde ­ Common Desktop Environment (commercial) * kwm ­ window manager of the K Desktop Environment (KDE) For a long time the Fvwm was THE Linux window manager. On the basis of this, a number of different window managers were written, which are all configured in a similar way, although they all have their peculiarities. To this family belong the Fvwm in versions 1, 2 and 2.2, as well as afterstep, bowman, cdesim and fvwm95. You will also find the following desktop environments * KDE K Desktop Environments (standard in SuSE Linux) * GNOME ­ GNU Network Object Model Environment * CDE ­ Common Desktop Environment (commercial) Apart from these, there are many other window managers available, including Wm2, Mlvwm, Qvwm, Enlightenment, Twm, Icewm, Scwm . . . Which window manager you use depends mainly on personal preferences, the functions you need and the performance of your particular hardware. There are remarkable differences in memory use between window managers. You should only use a desktop such as KDE or GNOME if you have at least 32MB, 64 MB is preferable. But it is in the configurability and flexibility to accommodate new features and updates, where differences between window managers make themselves felt. In Figure 9.4 on the next page, Figure 9.5 on the following page and Figure 9.3 on the next page you see three examples of window decoration. Figure 9.2: No window decoration. X11 without a window manager There is nothing to stop you installing and trying out the various window man- agers simultaneously. Once you have decided on a certain window manager, you can adapt it, together with your desktop, to your personal needs. The 231 9. The Window Manager-Window to Your Machine Figure 9.3: Window decoration of kwm in the KDE Desktop Figure 9.4: Window decoration of Fvwm2 Figure 9.5: Window decoration of WindowMaker KDE Desktop is installed as the standard desktop, because this is currently the one which has been developed furthest. Most of the window managers mentioned locate their configuration files and related data in subdirectories of /usr/X11R6/lib/X11. Feel free to rum- mage around! Hint: most of the information in this chapter refers to fvwm2 or KDE. We recommend them both! 9.1.2 What Does a Window Manager Manage? Here is a short (and incomplete) list of what desktop properties you can change by using a window manager: * appearance of your windows ­ width and height, colors, 3D effects of the window frame ­ window controls, e. g., for moving and enlarging windows (the so- called window decoration), headings and fonts * overlapping of windows ­ raising of windows (e. g., AutoRaise). ­ pinning of windows * focusing of windows by: ­ clicking ­ entering with the mouse pointer * popup menus 232 9.1. Some Theory ­ look and feel of menus (colors, fonts) ­ behavior of menus and submenus * screen background * virtual desktop (multiple desktops/screens) * icon management * linking sounds to actions on your desktop Not all window managers provide a graphic and intuitive means of configura- tion to set up and administer the above-mentioned functions. KDE, GNOME, WindowMaker and Enlightenment do, however. Most window managers read one or more configuration files at startup. The behavior of the window managers may be set in these files. The syntax itself is more or less mnemonic. It's a pity that all of the window managers use a different format for saving their configuration files. You will need to read the appropriate manpages. Eventually, you will settle on your "favorite" window manager. You will learn its idiosyncrasies and configure it to suit your needs. 9.1.3 Starting Different Window Managers SuSE Linux has different ways of starting a window manager, depending on how you want to start your X Window System.3 Starting with xdm If you use xdm instead of kdm, you must set the environment variable WIN- DOWMANAGER as described below. Starting with startx If you don't have the X Window System started automatically after booting, you can, using the command startx, start a specific window manager from the console. This can be done simply by entering: newbie@earth: > startx fvwm95 to start the Fvwm95 directly. This works for most of the window managers included. You can extend this command to include, for example, settings of color depth, if you want to use the color-intensive AfterStep (afterstep). The command: newbie@earth: > startx afterstep -- -bpp 16 starts the X Window System in 16 bit color depth (65536 colors) with After- Step as the window manager. As the window manager name, the name of the executable window manager program is always used here. 3 The two main ways are either via xdm or a text console. 233 9. The Window Manager-Window to Your Machine The WINDOWMANAGER Variable Instead of having to specify the window manager each time you start, and if you always want to use the same manager from now on, you can enter the following line in the file /.bashrc in your HOME directory, or modify the existing line: export WINDOWMANAGER=fvwm95 in order, for exampleof the executable window manager program must be specified, possibly including the path of the file if the corresponding directory is not contained in your PATH environment variables. You can also insert the entry shown above into the file /etc/profile if you want, or need, to define your window manager settings system-wide. In doing this, though, you should ensure that each user in the system is able to overwrite this setting in his own /.bashrc file. If you start your X Window System via kdm (a feature of KDE), you must not set the environment variable WINDOWMANAGER. Instead, select your window manager from the kdm pulldown menu. See Section 9.2. Changing the Window Manager Whilst System is Running If you use susewm you are offered the option to change the window manager to one of a number of window managers, particularly those of the fvwm family. Please note here that any already opened windows, and thus the processes running in them, are not interrupted. For certain window managers such as ctwm, mwm, kwm (KDE) or CDE however, this is not possible for technical reasons (the programmers of the window managers did not plan for this fea- ture). You can nevertheless change between window managers as you please, using the SuSE tool DyDe. This also allows you to start and end various desktop elements of KDE and GNOME. If you want to use this, you must define suse as the window manager or select it in kdm. 9.2 KDE ­ the K Desktop Environment KDE is a graphical user interface that is standardized and easy to configure. Many applications use the KDE look and feel. KDE stands for "K Desktop Environment" and is a project founded in 1996. KDE comes with a window manager, kwm, a file manager, kfm, which plays a central role, and a system-wide help system, kdehelp. This help system supports HTML manpages as well as GNU info. Many applications are available for KDE, including mailers, news readers, games, system info tools and much more. Please be aware that KDE is still considered beta software (as you can see from the version). It is susceptible to occasional crashes, but luckily, not very often. KDE is totally URL and MIME-based. This, in particular, means that all details of path and links to files are passed on and processed using a standard 234 9.2. KDE ­ the K Desktop Environment form and transfer protocol (e. g., links to files, links to an HTML page, a file in your filesystem, a help page or an FTP site). It is also defined via "Mimetypes" which programs can read which files. Through this it is possible to look at these by mouse click, irrespective of the time and source of the data, and possibly to modify them. Thus it is possible to view different files and formats with the same viewer. Furthermore, KDE has many drag-and-drop features (e. g., copying a file from an FTP site to your local system). The KDE helpdesk, kdehelp, is a powerful application. All authors are obliged to provide their help pages as HTML pages. Besides the help sys- tem itself (this may be launched from each application itself via its `Help' button), it is capable of browsing even GNU info pages or UNIX manpages. Just a few further interesting features in a long list are that you can configure applications written in KDE, and KDE itself, uniformly, simply and conve- niently by menu, and store icons on the KDE desktop as links. This behavior of KDE is made possible by means of the QT widget set. Similar to Motif, QT is a set of graphics libraries that enable you to create GUIs on the X Window System. Please note that the licence conditions of QT differ from GPL (see /usr/doc/packages/qt/LICENSE). 9.2.1 Installation Overview Here, we give a short overview of the KDE installation-mainly path settings, location of files, configuration options and important key combinations. By default, KDE is written to /opt/kde. Every KDE application may be found in this subdirectory. Setting an environment variable KDEDIR in /etc/profile makes it easier to access KDE applications. The KDE binary path /opt/kde/bin is automatically added to your PATH variable when you install KDE. There are many subdirectories in /opt/kde. In Table 9.1, we discuss only the most important ones. /opt/kde/bin all KDE program binaries /opt/kde/share/config system-wide configuration files /opt/kde/share/applnk application links (menu) /opt/kde/share/apps files of KDE programs /opt/kde/share/doc the on-line help system /usr/doc/packages/kde additional information on KDE Table 9.1: KDE-important directories 9.2.2 kdm-a Graphical Login The KDM display manager, kdm, is a nice feature of the KDE system. This tool is a valuable enhancement to the Linux system, in which users can login 235 9. The Window Manager-Window to Your Machine Alt + F1 The K menu is opened. Alt + F2 A universal entry field is opened. Here you can enter URL's, local directories or programs/commands Alt + F3 This closes the window. Alt + Tab Here you can switch between the win- dows of the current desktop Ctrl + Esc A session overview is opened dis- playˇing all the windows of the desk- top Ctrl + F1 . . . F8 Switches between desktops 1 to 8. Table 9.2: KDE ­ Important key combinations Figure 9.6: The kdm display manager graphically (normally done with xdm). KDM's default configuration with SuSE Linux is shown in Figure 9.6. There are buttons to select the desired window manager (`Session Type') or the language (`Language'). An interesting feature (especially for standalone workstations) is the `Shutdown' button ­ to shutdown the machine. kdm may be adapted to your needs either via a configuration file in /opt/ kde/share/config/kdmrc or, since the Beta 3 version, from a config- uration dialog which may be launched from the KDE menu. SuSE Linux provides another enhancement-the configuration of the window managers themselves and the startup mechanism of kdm. Here, you should create two variables:4 * DISPLAYMANAGER 4 These variables are described on page 400. 236 9.2. KDE ­ the K Desktop Environment Assigns whether the user wants to log into a text console, runlevel 2, or via kdm or xdm, runlevel 3. For the text console, enter console or the empty string "". * KDM SHUTDOWN Assigns which user is permitted to shut down the machine from within kdm. Here you may enter either `root' (root), every user (all), nobody (none) or a user on the local machine (local). SuSEconfig writes these values to /opt/kde/share/config/kdmrc, which are then available at the next start of kdm (you may want to restart the server by entering Ctrl + Alt + - ). If you plan to make changes your- self, please make them in kdmrc.in as /opt/kde/share/config/ kdmrc is created from this file by SuSEconfig. If you want to get rid of this mechanism, just delete or remove /opt/ kde/share/config/kdmrc.in and SuSEconfig will no longer touch your kdmrc. 9.2.3 So What's So Special About KDE? Now that we are able to use kdm's graphical login, it is time to go into the specialities of KDE. For this, we will just describe the behavior of KDE after logging (or after entering startx). Shortly after the actual login, a couple of dialog boxes appear, announcing that certain files and directories are missing. This is not an error. KDE creates configuration directories in your home directory that are similar to its tree in /opt/kde. These, in particular, are: HOME/.kde and HOME/Desktop. The first is for configuration files and the latter for links. Thus, you may just press in the dialog boxes. They won't appear at the next KDE session. Thereafter, the kfm (K file manager) is launched. kfm is a basic component of the KDE system. As mentioned above, it is able to handle many different file formats. The behavior is totally transparent to the user: be it an archive from an FTP site (URL prefix: ftp:), a manpage (URL prefix man:), a GNU info page (URL prefix info:) or an HTML page from a WWW site (URL prefix http:). It is even possible to view images using an external tool. A typical KDE desktop is shown in Figure 9.7 on the following page. The user will become familiar with these features in minutes. Clicking on a symbol with the right mouse button opens the kdm config- uration tool for this application. Every setting of the application itself is written to a file with the .kdelnk extension. Changing settings is done via a property window as shown in Figure 9.8 page 239. This file is an ed- itable ASCII file. It is recommended that you look at these files located in HOME/Desktop (or in /opt/kde/share/applnk for the system-wide configuration files). The contents are standard to all KDE applications. So if you know how to write just one of them, you are set. The last program to be launched is KPanel, the menu bar. Here, you will find some objects for the virtual desktops. A special one is the "K" button. All available KDE applications are grouped together here (see kdelnk files!). 237 9. The Window Manager-Window to Your Machine Figure 9.7: The filemanager kfm You will also find the KDE system settings here in the KDE control center, and much more. But that's not all KPanel has to offer. You may copy application icons using drag-and-drop onto it and launch them directly from the panel. Moreover, KPanel may incorporate applications. These might be programs such as klipper (this allows you to have a number of buffers for cut and paste) or korn, which shows you how many are in a specific mail file. These applications are then run withing the KPanel and are thus ­ this is important ­ visible on all desktops. Another of KDE's programs, the kdisplay, is shown in Figure 9.9 page 240. Of course, we cannot list each and every KDE application in this manual. One of KDE's aims is to make the machine more usable and user-friendly. Please look around at the various applications that come with KDE yourself. Help is available with most of KDE's applications. You may reach kdehelp by clicking onto the background with the right mouse button. But keep in mind that some of the KDE packages are still considered alpha versions. This, in particular, means that they could unstable, might crash or other strange things may happen. This is usually no longer the case, however. Because of the complexity of KDE and its rapid pace of development, these packages are not yet included in our installation support. We try to provide you with as much KDE information as we can in our Support DataBase; see section 1.4.1 page 5. There are a couple of mailing lists available from the KDE WWW site (http://www.kde.org). Here, you will find informa- tion on many topics as well as the latest release of KDE and its applications. Finally we should point out that we have specially adapted KDE packages that may be downloaded from our FTP site, ftp://ftp.suse.com/ pub/SuSE-Linux/suse_update/KDE These packages can be installed conveniently using YaST. Please look at the README files located at this same URL. 238 9.3. The fvwm2 Window Manager Figure 9.8: The kdm property dialog 9.3 The fvwm2 Window Manager General Now we want to tell you more about Fvwm2 (fvwm2), a window manager that quickly became the window manager for Linux and XFree86. Fvwm25 is the successor to the old fvwm1. It needs much more memory than the older version but provides lots of new functionalities and configuration options. Besides the usual functions for managing windows and the look and feel of the buttons and desktop, it now provides background menus and modular ap- plications which can be loaded at runtime. These features provide interesting functions, such as a button bar. More information about functions, starting, and configuring fvwm2 and its modules is in the corresponding manual pages: * manpage for fvwm2 (man fvwm2) 5 In SuSE Linux, fvwm2 is in package fvwm, series xwm. The previous version, fvwm, is in package fvwm1, series xwm. 239 9. The Window Manager-Window to Your Machine Figure 9.9: Setting up your display with kdisplay * manpage for FvwmAudio (man FvwmAudio) * manpage for FvwmButtons (man FvwmButtons), etc. or in /usr/doc/packages/fvwm which is automatically installed when installing the fvwm package. Look at these documents first for any questions you may have. As the original packages of both fvwm and fvwm2 use the same source for their manpages, a special procedure is required to view them. You can read the manpages for fvwm2 as usual with the man command. The man- pages of fvwm (version 1) and fvwm95 have been relocated to different directories on SuSE Linux. To read a fvwm (version 1) manpage, use the command fvwmman. For example: fvwmman FvwmButtons To read a Fvwm95 manpage, use the command fvwm95man. For example: fvwm95man FvwmButtons Then you will get access to the manpage for FvwmButtons of the correspond- ing package. You can also view the manpages of the different window man- agers right from the `Work menu'. You can find these special manpages (if available) in the menu `Window Manager', submenu `manpages'. 240 9.4. Fvwm2 Settings If you don't want to start from scratch, you may generate a configuration "frame" with susewm and then tailor it to your needs. susewm is described in Section 9.5 page 246. Configuring fvwm2 fvwm2 is configured via two files: * A system-wide configuration file (.fvwm2rc in /usr/X11R6/lib/ X11/fvwm2) which should be available at any time * A user-specific file ( /.fvwm2rc in the home directory of the user) which is not really necessary (but recommended) The package susewm, described later, ensures the existence of a system-wide configuration file for fvwm2. fvwm2 reads these configuration files at startup.6 First, fvwm2 tries to read the user's configuration file. If this doesn't exist, it reads the system-wide file. All fvwm2 modules read this file too, but they use only the commands that apply to themselves. It is recommended that every user create their own configuration file, which they can change and adapt to their personal needs. After changing configuration files, the window manager has to be restarted for these changes to take effect. To restart fvwm, there is a menu entry supplied with the pre-installed SuSE Linux configuration in the `Work menu' called `Window Manager'. You could also restart the X server with startx from the command line. It is also possible to restart the window manager from within an xterm or a text console. Just enter: newbie@earth: > killall -10 fvwm2 To change the configuration interactively, fvwm provides FvwmConfig. This tool, however, offers only very limited configuration capabilities since mod- ifications cannot be saved. In addition, there are also the modules FvmSave and FvwmSaveDesk which can, in fact, save the actual state of the window manager. However, their files cannot be read automatically the next time the system starts. If you're interested, please read the manpages for these mod- ules. 9.4 Fvwm2 Settings General We now delve deeper into your personal Fvwm2 configuration file. If you din't yet have one, you can use susewm to create a window manager configu- ration file, as described in Section 9.5.1 page 247. Besides the file created by 6 In general, the window manager is started either from /usr/X11R6/lib/X11/xinit/ xinitrc or from the user's private configuration file /.xinitrc. The environment variable WINDOWMANAGER should be set to the full pathname of the corresponding window manager. 241 9. The Window Manager-Window to Your Machine susewm, you may also use the configuration file provided by the authors of fvwm2. This may be found in /usr/doc/packages/fvwm/system. fvwm2rc. Now start up your favorite editor and load the file /.fvwm2rc. We will have a look at some of the options. What Happens When fvwm2 Starts? Scroll through the text until you reach the following comment: ######################################################### # # # initialization function head # # common to all wms # # # ######################################################### File contents 9.4.1: InitFunction in /.fvwm2rc Beneath this is a list of programs which are run when fvwm2 is restarted. Here, the banner FvwmBanner is loaded, a couple of xterms and an xpmroot are launched. xpmroot puts images onto your root windows. For this purpose you can use any program that is capable of writing in the root window (such as xli, xv). Here is an example using xv: + "I" Exec xv -quit -root -owncmap -maxpect /pics/bild13.gif You would also place this background picture command among the sections which are executed with the restart of fvwm2, e. g., within Restart Function. This is located in: ######################################################### # # # restart function # # common to all wms # # # ######################################################### File contents 9.4.2: RestartFunction in /.fvwm2rc Often, the two sections, InitFunction and RestartFunction, look the same, since they both deal with starting the window manager. In RestartFunction, you do not normally include fvwm's banner. Newer versions of fvwm (Fvwm, Fvwm2, Fvwm95, Bowman and AfterStep in SuSE Linux 5.0 and later) have an additional ExitFunction besides InitFunction and RestartFunction. This function enables you to set programs that have to be started before the window manager is launched, or before you exit the window manager. In this way you can remove a back- ground picture before restarting ­ then the window manager sets a new one. 242 9.4. Fvwm2 Settings ######################################################### # # # colors and fonts # # # ######################################################### File contents 9.4.3: Color and font settings in /.fvwm2rc Colors and Fonts The settings for colors and fonts can be found in the file 9.4.3. Here, you can do whatever you like. Select the colors you like best. You can use any color installed. Which colors are installed depends mostly on your graphics card and the color depth. Press the right mouse button in the root menu and go to the item `System Tools'. Here, change to `Information'. Right at the end, you should see an icon, `XColors'. Start it and it will show you all the colors known to your system. All names of these colors can be found in /usr/X11R6/lib/X11/rgb.txt. A few of the commands in this section resemble the following one: WindowFont -misc-fixed-bold-r-normal-*-13-*-75-75-c-80-iso8859-1 This is the systematic description of a font in X11. Every font is classified in this style. It would lead far beyond the scope of this book to explain everything contained in this description. The fonts reside in /usr/X11R6/lib/X11/fonts/misc. In this direc- tory, there is the file fonts.alias which contains all font aliases for this font directory. To make life easier, here are a couple of the most well-known aliases. variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1 5x7 -misc-fixed-medium-r-normal--7-70-75-75-c-50-iso8859-1 It's much easier to remember these names. . . :-) Icons Icons are specified using the Style command: ## others # Style "xterm" Icon Terminal.xpm Style "xosview" NoTitle, Sticky Style "xosview" UsePPosition File contents 9.4.4: Icons for specific windows Here, you can assign icons to the corresponding applications. You only have to be sure that these icons are in the IconPath (which is set almost at the beginning of /.fvwm2rc). In principle, you can use any icon lo- cated in /usr/X11R6/include/X11/3dpixmaps/ as well. This is only one example. There are many more sources for pixmaps. All icons not in IconPath need to be specified with their absolute path name. 243 9. The Window Manager-Window to Your Machine Let's assume you want to assign a ghost icon to ghostview. Look in the directory mentioned above and you will see the icon ghostbusters.xpm. Just insert the following line: Style "ghostview" Icon ghostbusters.xpm That's it. You can give icons to almost all applications in the same way. Most applications already have default icons. Anyway, you have to know the name of the application,7 since an "xTerm" instead of "xterm" would simply not work. The name of a specific window can be identified from the `Work menu' by selecting `Window Manager', `Modules', `Ident' (Pro- gram name FvwmIdent) and then clicking on the relevant window. Cursor Even the shape and color of the mouse cursor can be set. Here, you have the tool xsetroot (which can be used to set the root window as well in a rather simple way). It is started with: newbie@earth: > xsetroot -cursor Here, bitmapfile stands for any bitmap file. The bitmaps are located in /usr/X11R6/include/X11/bitmaps/ by default. Select a suitable one or create your own, for example, with bitmap. Focus An extremely popular feature of the Fvwm window manager family is that you can influence the behavior of the windows by changing the active window while the system is running. You can change the focus and raising policy of the windows in the configuration file. With focus, we define the properties of the window manager which assigns the actual entries and mouse clicks to a certain window. Basically, there are 3 options: * You have to click on a window first before you can, for example, enter text from the keyboard to the process running in the window. This behavior is called Click to focus. It is a widely-used standard, also to be found in Windows and OS/2. * You point with the mouse cursor on a certain window and the window automatically becomes focused. This reaction is called Focus follows mouse. If the mouse pointer leaves the window, the focus also leaves the window, even if the cursor is located over the background or on another window. * A more advanced version is the Sloppy Focus behavior, which can be configured with Fvwm2 and Fvwm95. In this case, the focus shows the same behavior as Focus follows mouse, but with the exception that the focus stays with the focused window as long as you do not focus on another window. The focus even stays with the highlighted window if you move the mouse cursor over the background. 7 To be precise, the exact name. 244 9.4. Fvwm2 Settings With Fvwm2, you can set the focus behavior individually for every single window. Like many other settings, the configuration of the focus is made with a Style command: Style "*" ClickToFocus This adjusts the focus, setting ClickToFocus for all windows. The same may be done for the settings SloppyFocus and FocusFollowsMouse, the latter being the default of Fvwm2. 9.4.1 Autoraise Autoraising of windows is an interesting feature. Normally, the windows keep their position while the focus changes until you click onto the title bar. Autoraise raises the focused windows to the top of the stack. This only makes sense when used together with FocusFollowsMouse or SloppyFocus. There is no effect if you use SloppyFocus. To activate AutoRaising, either start the Fvwm module AutoRaising from the menu `Window Manager', `Modules', `AutoRaise On/Off', or, to install it permanently, insert an entry into Fvwm's configuration file, / .fvwm2rc, into the functions InitFunction and RestartFunction: Function InitFunction + "I" Module FvwmAuto 200 Function RestartFunction + "I" Module FvwmAuto 200 The value 200 sets the delay to 200 milliseconds, before a window is popped to the foreground. If you don't have a delay set, every touch of a window leads to a "movement" of windows which will result in permanent flicker. 245 9. The Window Manager-Window to Your Machine 9.5 Configuring the Window Manager Using susewm What is susewm? susewm simplifies configuration for the supported window manager (Fvwm, Fvwm2, Fvwm95, Bowman, AfterStep (afterstep), Ctwm, Mwm8, and kwm).9 Since fvwm, bowman, afterstep, fvwm2 and fvwm95 are mainly based on the same window manager, where fvwm2 is the descendant of fvwm, these five window managers are configured practically in the same way and supply almost identical features. On the other hand, there are considerable differences in configuring these window managers. To let the user have the benefit of all the common tasks of these window managers without having to maintain five different config- uration files, susewm combines their configuration using an abstract macro language. susewm can also configure the totally different window managers ctwm, mwm and kwm. However, this only covers the automatically generated menu entries (more in the sections below). Differences between these single window managers can be taken into consid- eration using window manager specific statements. One of the most refined features susewm offers is that it creates menus and supported modules, depending on what software packages are installed. There are no menu entries for packages which are not installed. If you select a menu item, you can be sure that the corresponding program is installed and can be launched. Here are some more features of susewm: * configuration of eight window managers: Fvwm, Fvwm2, Fvwm95, Bowman, afterstep, ctwm, mwm and kwm * a central library for all window managers-unified macros for different configuration files * additive configuration files for individual window managers, taking spe- cific features and peculiarities of these into consideration * loading of additional source files10 on your system via /etc/rc. config, for automatic configuration * ability to reference source files for a specific user in their $HOME direc- tory during automatic configuration * creation of user-specific configuration files that preserve almost any changes that have been made to older configuration files * unified commands for all eight window managers 8 MWM is part of the commercial Metrolink Motif or Metrolink Motif Runtime Libraries respectively. 9 The pseudo-window manager CDEsim (cdesim) should be excluded here. More informa- tion can be found in package cdesim, series xwm, in the directory /usr/doc/packages/ cdesim. 10 In general, source files are window manager configuration files. To use them with susewm, files in susewm format are preferred. 246 9.5. Configuring the Window Manager Using susewm * integrates widely used commercial applications, which are not part of SuSE Linux, into window manager menus * switches between supported window managers without having to change startup scripts such as /.xinitrc, as long as the window manager allows this 9.5.1 Adding Entries to the Menu If you want to add entries inside the SuSE menu, you must create some files as shown in File 9.5.1. Name=Printer Comment=Show all printers Exec=klp MiniIcon=printer.xpm Icon=printer.xpm Type=Application File contents 9.5.1: .lnk File of SuSEwm for menu entries Here the entries for Name[...] and Exec are especially important. All other entries are optional. If you enter Type=TEXT, each program will run in a terminal. For the entry to be created, you must run the file as follows: ..lnk; here, stands for the RPM package name in which the correspond- ing program is contained. If you have not installed the program through an RPM package you can, for example, enter . For you can enter any abbreviation, e.g. the name of the program to be carried out. You should also end the file name with .lnk. This file must now be moved to a directory under /etc/X11/susewm/AddEntrys. Depending on which directory you save this file in, the entry will be shown in the corresponding submenu. How to Use susewm susewm is used in two different circumstances: * You don't have a configuration file of your own yet but want to adapt your desktop accordingly. * You already have a configuration file, but software has been installed using YaST and the menus are no longer up to date. Here, the following is assumed to be installed: * Your Linux system and the X Window System XFree86 are installed, configured properly and running. * You use the fvwm2 window manager (which is the default with SuSE Linux), but perhaps have another supported window manager installed. * susewm is installed on your system with standard settings. * You are logged in as a normal user, for example as the sample user defined with the standard installation of YaST, but not as `root'. 247 9. The Window Manager-Window to Your Machine * You have set the language to English. The same conditions apply for German menus. This is how it is done. If you click on the root window (which actually is the "background") with your left mouse button, a menu appears. This is called the `Work menu'. Here, the most often used programs needed for your work are listed (this will depend on the individual user). The last entry on this menu (`Window Manager') contains a submenu with selections concerning functions and configurations of the window man- ager currently running. If you want to configure another window manager, just switch to it first, using the menu item `Other window managers'. From the `Window Manager' submenu, click on `Configuration'. In this submenu you will find several choices in each of four menu sections: * The choices of the first menu section are for reading the documentation on susewm. There you will find details not covered in this section. * The choices of the second menu section allow you to change the configu- ration file of your PC with an editor. * The choices of the third menu section help in creating a user-specific configuration file in the language you choose. The breakdown of the `Work menu' for fvwm2 can be seen in Figure 9.10. Figure 9.10: Menus for window manager configuration If you choose to build a configuration file (from the third menu section), a window with mksusewmrc appears (this program is a part of susewm). Just read the text and press the appropriate buttons when asked. 248 9.5. Configuring the Window Manager Using susewm That's it. Now you can change and edit your freshly created configuration file in your $HOME directory. susewm will take over almost everything to the new configuration file. If you want to change the settings of the desktops even slightly, you have to create a configuration file of your own first. How to do this has been explained above. Only then can you change the file. If you plan to write a completely different configuration file, don't use susewm. An Example A colored desktop is nice, but what's the use if the hardware (memory, proces- sor, hard disk) is not fast enough? It's not the purpose of a window manager to use up all the resources for animating icons and other baubles. Here is a hint about what to do if you think that your machine is too slow when you start up fvwm95 or fvwm2: most problems are due to the hundreds of icons that are loaded. There are three possibilities: * De-install the package 3dpixms and also package 3dpixm if you don't want to have the big icons either. * In the YaST menu `System administration', submenu `Change configuration file' set the variable SUSEWM XPM=no, which results in the same effect as mentioned above. If you have changed the variable directly in the file /etc/rc.config, please don't forget after doing so to start SuSEconfig. * Remove the icons from the configuration file. The first way is quite simple. Just start YaST and uninstall the packages men- tioned. YaST, in conjunction with susewm, will ensure that the system-wide window manager configuration file is modified. If you have a user-specific configuration file, you have to modify it explicitly, using an appropriate se- lection from the window manager menu as described in this section above. The second way needs no further explanation. The third way: let susewm create a configuration file for you as described above. Then remove all references to loading icons. AddToMenu thiswmpopup "Fvwm2" Title + "Other windowmanagers%small.warning_3d.xpm%" Popup otherwmpopup + "Configuration%small.checklist2_3d.xpm%" Popup susewmpopup + "" Nop + "Fvwm2 Restartt%small.restart_suse_3d.xpm%" Restart fvwm2 + "Exit Fvwm2 and%small.exit.xpm%" Function QuitSave # end popup thiswmpopup File contents 9.5.2: .fvwm2rc with icons for menu entries Now fvwm95 or fvwm2 should start even faster. And, as mentioned before, all personal changes you have applied to your configuration file should re- main, even if you invoke susewm a second time. 249 9. The Window Manager-Window to Your Machine AddToMenu thiswmpopup "Fvwm2" Title + "Other window manager" Popup otherwmpopup + "Configuration" Popup susewmpopup + "" Nop + "Fvwm2 Restart" Restart fvwm2 + "Exit Fvwm2 and X" Function QuitSave # end popup thiswmpopup File contents 9.5.3: .fvwm2rc without icons for menu entries 9.6 Customizing Your Configuration As promised above, we are now going to tailor the look and functions of your personal desktop-why buy something predefined if we can tailor it ourselves? First, some general information about configuring the desktop-there are two places where you can make adjustments: * the pre-settings for the applications of the X Window System * the window manager configuration file(s), as already mentioned in Sec- tion 9.4 page 241 X11 Application Defaults Global Settings Almost every application under X11 has its own default configuration. This configuration will be copied to /usr/X11R6/lib/X11/app-defaults11 at installation. Here files such as Xarchie can be found. As the name al- ready tells us, this must be the main configuration file for the application xarchie. Take a look at this file (e. g., with less Xarchie). Here, you will find the following lines: Xarchie.color*background: powder blue Don't worry about the sometimes cryptic names; you don't have to under- stand them right now. Every program under X11 is built out of "Widgets".12 Here, there is a main widget, which is the root window (it is called first). All other programs are child widgets of this parent widget (more or less). That means that every child widget has got exactly one parent widget and one or more child widgets. Each of these widgets can be addressed with a unique name. Windows and widgets should not be confused. A scrollbar, e. g., is a window of its own (a window which lacks any decoration). A widget can contain a scrollbar, a text field and other attributes. This leads to the conclusion that any window and its resources can be ad- dressed by a unique name. For our example, this means: 11 It is quite helpful to assign an alias to such an abstruse and long name. 12 Think of a "Widget" as a sort of "brick"; the word is made from "windows" and "gadget". 250 9.6. Customizing Your Configuration * The first word up to the first dot (Xarchie) is the name of the top-level widget of the xarchie program (it is the convention to write names of application defaults beginning with an uppercase letter). * After the dot, there is a `color'. This, of course, is the color. But which color? * Then there is a `.'. This dot could have been an asterisk (`*') as well. ­ A `.' means that this is a direct hierarchy. ­ A `*' is a wild card. It indicates that between those two windows one or more additional windows may be found. * The word "background" now shows us which color is going to be set. Here you can enter a defined color. User-Specific Settings So that every user may make specific settings, there is a /.Xresources file located in the HOME directory. The `.' at the beginning means that this is a hidden file. In this file, all user-specific settings are made. For example, you can now define that every window should have a yellow background, except the root window, which should be red. Returning to the example given above, this means that you can over- write system-wide settings (app-defaults files) with those in your / .Xresources file. So, if you set the following in your /.Xresources file: Xarchie.color*background: gold the application xarchie will be started with a gold background. You can change not only colors but almost any decoration or setting for your windows. A useful program in this context is editres ("editres" stands for EDitRESources). This little tool lets you see all the resources of a given program and allows you to change them at runtime (so you can see what you've done). Here are some examples of what you can set: Xarchie.color*background: powder blue Xarchie.color*SimpleMenu*background: wheat Xarchie.color*Command*background: wheat Xarchie.color*MenuButton*background: wheat Xarchie.color*Text*background: wheat Setting Start Parameters There is a third way to influence the application. You can give parameters to it at runtime. You can even enter these parameters in your window manager's configuration file if you start them from there. For example, you can explicitly launch a program with another font and background color (bg = background, fg = foreground): xterm -bg darkblue -fg white You get a blue xterm with white letters. 251 9. The Window Manager-Window to Your Machine How do the Configuration Possibilities "work"? Principally, the system-wide settings are set at the start of the X Window System. The settings themselves are administered by the X server in the X Resource Database, xrdb. If you want the changed settings to become effective system-wide, it is necessary to edit the resource files manually. The various settings for applications are handled in the following order during the build-up of an interim X server Resource Database, when the X server starts: Hierarchy of Configurations * First,all system-wide settings are read from /usr/X11R6/lib/X11/ app-defaults * If you have special settings in your /.Xresources file, these will overwrite the settings above. * If you start an application with certain parameters, these settings over- write the last one. They have the highest priority. In case these explicit changes have no influence on the behavior of the application, it often helps to vary capitalization of the respective widget name. 252