A command-line interface for X

85

Author: Paul Boren

Desktop environments such as KDE and GNOME make things easier for computer users, but as desktop environments become more and more integrated, some users may feel stuck with a graphical interface that was designed for someone else. Having to use the mouse over and over for the same thing can get old real fast. Keyboard shortcuts help to pick up the pace in some applications, but neither KDE nor GNOME really lends itself to keyboard navigation. Luckily, for those who want to combine the efficiency of the command line with all the resolution of the X Window System, there’s a window manager called ratpoison.

The ratpoison window manager has a keyboard-driven interface similar to GNU Screen. It’s policy is to show the window, the whole window, and nothing but the window. There are no borders or title bars, as windows are sized to fit the display.

Getting it installed

Since ratpoison does not have any large library dependencies, it should be fairly straightforward to install. Download and extract the compressed archive. Installation is the standard configure, make, and su to make install. If the make command can’t find readline header files on your system, use the disable-history option that’s documented in the configure help.

After installation, you can type which ratpoison at the command prompt to find the path to the application. From a virtual terminal, type startx followed by the full path to ratpoison to see it in action. For systems that have a graphical login, the default display may be active, so you may have to type something like startx /path/to/ratpoison -- :1 to get going.

Those more familiar with point and click can take comfort in the startup message ratpoison displays in the upper right corner: “Welcome to ratpoison! Hit `C-t ?’ for help.” Holding the control button down while pressing t is the ratpoison Command key. (After you press it the pointer turns into a square.) This keystroke precedes ratpoison commands, thereby insulating them from keystrokes handled by applications. Now type ? to get help.

The help screen lists all of the ratpoison key bindings. Each key binding is followed by the full command name. The command can be entered at the colon prompt. For example, pressing C-t : and typing help root also shows help. Toward the bottom of the list are some duplicate commands; for instance, to display the version of ratpoison, C-t v will work just like a C-t C-v combination. These extra bindings prevent error messages from becoming a nuisance when you’re typing in a hurry.

Window and frame management

It can take some time to become accustomed to ratpoison’s interface. You can view how ratpoison is managing windows by pressing C-t w. The Program Bar at the top of the screen shows a number to the left of each window’s title. You can enter that number after typing C-t to bring up the associated window. Although you could hit C-t 0, C-t 1, C-t 2, and so on to cycle through the windows sequentially, there are other options. To see the next window, you can choose between C-t n, C-t Enter, and C-t < space >. Return to the previous window by pressing C-t p. You can delete the current window by typing C-t k or hide the windows by typing C-t -. When an application is running in more than one window things can get confusing. Enter C-t i to show information for a single window.

What about viewing more than one window at a time? Well, windows can be divided up among frames. Press C-t s to split the display into two frames, one above the other. When there are more windows than frames, some of them will be hidden. You can still use C-t Enter to cycle between windows and press C-t Tab to switch the focus of the current frame. Typing C-t S splits a frame into two frames, placed side by side. Of course, the more frames there are, the more windows you can see at the same time. Press C-t f to see the number of each frame. Immediately typing the associated number switches the current frame accordingly. Simply typing C-t F shows the current frame. A C-t R combo will remove a frame, while C-t Q removes all but the current frame.

Less is more

Shawn Betts, ratpoison’s primary developer, and his colleagues did not design ratpoison to be compliant with any desktop framework. Nevertheless, most applications work fine under ratpoison whether they require the mouse or not, but for additional flexibility, ratpoison offers a tmpwm command to open another window manager. It’s particularly useful when it comes to handling multi-window applications such as the GIMP.

For more information, browse through the project’s excellent documentation. To make ratpoison your default window manager, put exec ratpoison on the last line of your .xinitrc file for a while and find out how it works.

It’s nice to discover another way to deal with windows. For X users who lean toward the keyboard, ratpoison provides a useful command-line interface.

Paul Boren is a civil engineer currently living in Atlanta. He enjoys talking to other Atlanta Linux Enthusiasts and using Open Source software.