Make Your X11 Look Like The Text Console ---------------------------------------- I don't especially like the graphical user interface. Why ? Because I don't like the situation with lots of windows scatteredd on the desktop, one covering another, when it's virtually impossible to find the needed one. Many solutions have been proposed, from multiple desktops in Fvwm/VUE/CDE and to the always visible list of windows in MS Windows 95 and the X window managers modelled after it. And I think that they all are still missing something. But then what do I like ? I really like the PC Unix console. What's good about it ? First, I have multiple independent logical screens. And this is absolutely not worse that the so much praised multi-window capabiltities of the graphics environment. Second, each logical screen has the size of whole display. And, third, I can easily switch to any of these screens at random using my keyboard. I don't have to press + tremendous number of times trying to guess, which of the same-looking icons do I need. And I don't have to select the wanted application with the mouse (that is slow, and the less I use the mouse the less pain in the wrist I get). Or, in case of VUE/CDE environments I have not only to select the desktop with mouse, but also set the keyboard focus on the proper window after that. Fvwm screen pages are good, but in the default configuration the pages can be accessed only sequentially, by pressing +, and it forgets the keyboard focus just like VUE/CDE. So, after all, I have decided, what I want from the graphical environment, be like the PC Unix console: - Have multiple desktops with independent keyboard focus. - One window (ideally) per desktop. - The desktops must be able to be switched from keyboard at random. Fortunately, the Fvwm has the support for multiple desktops, although in the standard distribution they are configured somewhat weird (in my opinion). But it can be rather easily reconfigured. Here I describe how to do such a reconfiguration. We start with copying /usr/X11R6/lib/X11/fvwm/system.fvwmrc to $HOME/.fvwmrc. Then this file needs a number of changes. Step one. Disable this annoying focus-follows-mouse policy and switch to the dearly beloved click-to-focus policy. To do that uncomment some lines and comment out other ones, change: AutoRaise 500 to #AutoRaise 500 and #ClickToFocus to ClickToFocus to get the desired result. I also like to change # RandomPlacement to RandomPlacement and thus enable the auto-placement of new windows. Step two. Increase the number of the virtual desktops. Because we have 12 function keys on the keyboard that can be used to switch between the desktops, it seems logical to use a number somewhat related to that magical number of 12. The most straightforward idea seems to just have 12 desktops. But I'm not sure yet whether that many desktops are really neccessary, so I started with 6 desktops. That was done by changing the startup parameters of the module Pager, in the description of the popup "Module-Popup" from Module "Pager" FvwmPager 0 3 to Module "Pager" FvwmPager 0 5 I have left the default structure of a desktop as 4 pages untouched. So far so good. But now we have come to a problem: what modifiers to use with the functional keys to switch the windows ? I'm really accustomed to the old convention, that, I guess goes from SCO Xenix: use +Fn. And I like it. But the window manager is already using +Fn for its own purposes. What to do ? But let's notice also that the classic Fvwm also uses many other combinations of and with other keys, such as the arrow keys. But there exist applications, such as Netscape or Doom, that also really want to use these combinations, and the classic fvwm conflicts with them. So let's just resolve this conflict and move the window manager functions to some other modifier key. Here comes the step 3, modifications of the keyboard setup. Fortunately, X11 gives us plenty of [yet] free modifiers. Let's use the modifier number 5 for our purpose. Now we need to allocate some physical key. There are two options. Fisrt, there are two Alt keys on the keyboard, so they may be separated, using the left one for applications and desktop switching, and the right one for the window manager. But, thanks to Bill Gates, many keyboards nowadays have 3 additional Windows keys, that are commonly unused under Unix and are just a nuisance. So we got the second option: make use of these keys. Personally I prefer the second one. Here go the recipes to configure the keyboard maps for both of the cases. First, the case with splitting the keys. To do it on-line (you may want to add this command to your X start up script) just execute: xmodmap -e "remove mod1 = Alt_R" xmodmap -e "add mod5 = Alt_R" Now the case with using the otherwise unused Windows keys. It is a bit more difficult but, I think, worth it. First we will give some keysym names and codes to these keys. I prefer to see these names registered in the XKeysymDB file but it's not absolutely neccessary. Editing XKeysymDB will need the root user privileges (may be there is some other way that does not need them but I don't know it yet). The changes are as following: open the file /usr/X11R6/lib/X11/XKeysymDB (if you don't have it, create it) and add the lines: ! ! Define some keysyms for Windows keys ! Win_L :20000001 Win_R :20000002 WinMenu :20000003 Here the left Windows key is defined as Win_L (we may read it as "window manager, left"), the right one as Win_L, and the Menu key as Win_Menu. The keysym codes were taken arbitrarily, just to not conflict with anything else in this file. Now we can add them to the X keyboard map. I'm not sure, which Win key is better to be used to control the window manager, I have used WinMenu. If the symbolic names are defined in XKeysymDB, it can be done as: xmodmap -e "keycode 115 = Win_L" xmodmap -e "keycode 116 = Win_R" xmodmap -e "keycode 117 = WinMenu" xmodmap -e "clear mod5" xmodmap -e "add mod5 = WinMenu" If they are not, the digits can be used as well: xmodmap -e "keycode 115 = 0x20000001" xmodmap -e "keycode 116 = 0x20000002" xmodmap -e "keycode 117 = 0x20000003" xmodmap -e "clear mod5" xmodmap -e "add mod5 = 0x20000003" Step four. Redefine the control characters of fvwm to use Mod5 instead of Alt or Control. This is dome by changing the lines in the fvwm configuration file: Key Left A C Scroll -100 0 Key Right A C Scroll +100 +0 Key Up A C Scroll +0 -100 Key Down A C Scroll +0 +100 to Key Left A 5 Scroll -100 0 Key Right A 5 Scroll +100 +0 Key Up A 5 Scroll +0 -100 Key Down A 5 Scroll +0 +100 and Key F1 A M Popup "Utilities" Key F1 A M Popup "Utilities" Key F2 A M Popup "Window Ops" Key F3 A M Module "WindowList" FvwmWinList Key F4 A M Iconify Key F5 A M Move Key F6 A M Resize Key F7 A M CirculateUp Key F8 A M CirculateDown to Key F1 A 5 Popup "Utilities" Key F2 A 5 Popup "Window Ops" Key F3 A 5 Module "WindowList" FvwmWinList Key F4 A 5 Iconify Key F5 A 5 Move Key F6 A 5 Resize Key F7 A 5 CirculateUp Key F8 A 5 CirculateDown Step five. Make +Fn switch between the desktops. Because we have defined only 6 desktops, but there are 12 functional keys, the remaining functional keys may be used to move to the lower pages of the desktops. Before defining the keys some utility functions must be defined: Function "Goto00" Desk "I" 0 0 GotoPage "I" 0 0 EndFunction Function "Goto10" Desk "I" 0 1 GotoPage "I" 0 0 EndFunction Function "Goto20" Desk "I" 0 2 GotoPage "I" 0 0 EndFunction Function "Goto30" Desk "I" 0 3 GotoPage "I" 0 0 EndFunction Function "Goto40" Desk "I" 0 4 GotoPage "I" 0 0 EndFunction Function "Goto50" Desk "I" 0 5 GotoPage "I" 0 0 EndFunction Function "Goto01" Desk "I" 0 0 GotoPage "I" 0 1 EndFunction Function "Goto11" Desk "I" 0 1 GotoPage "I" 0 1 EndFunction Function "Goto21" Desk "I" 0 2 GotoPage "I" 0 1 EndFunction Function "Goto31" Desk "I" 0 3 GotoPage "I" 0 1 EndFunction Function "Goto41" Desk "I" 0 4 GotoPage "I" 0 1 EndFunction Function "Goto51" Desk "I" 0 5 GotoPage "I" 0 1 EndFunction And, finally, the definitions of the keys themselves: Key F1 A M Function "Goto00" Key F2 A M Function "Goto10" Key F3 A M Function "Goto20" Key F4 A M Function "Goto30" Key F5 A M Function "Goto40" Key F6 A M Function "Goto50" Key F7 A M Function "Goto01" Key F8 A M Function "Goto11" Key F9 A M Function "Goto21" Key F10 A M Function "Goto31" Key F11 A M Function "Goto41" Key F12 A M Function "Goto51" Now everything should be working, just some more cosmetic changes. Because in this model the desktops are anonymous and not strongly dedicated to any application, I prefers to give some neutral names to them. So, the change of *FvwmPagerLabel 0 Misc *FvwmPagerLabel 1 Maker *FvwmPagerLabel 2 Mail *FvwmPagerLabel 3 Matlab to *FvwmPagerLabel 0 One *FvwmPagerLabel 1 Two *FvwmPagerLabel 2 Three *FvwmPagerLabel 3 Four *FvwmPagerLabel 4 Five *FvwmPagerLabel 5 Six does that. Now the task is done, and the X desktops may be used just like the console. I really, really like it this way. But there are also some troubles. First, Fvwm was not designed with this model of interaction in mind, and sometimes and actually rather often it gets in troubles with managing the keyboard focus. In this case iconizing and deiconizing the troubled window helps. Second, I would like to get the new toplevel windows automatically started on a free desktop. This does not seem to be possible without changes to the internals of Fvwm. And third, the Fvwm menus are too rigid. I think that making them dynamically loadable, like Windows or CDE actions, must help a lot in making free Unices more user-friendly. But this also needs changes to the Fvwm internals, and these changes are a completely differentt story.