Many linux users are working textually most of the time and are therefore annoyed when they have to use the mouse.The usual desktop environments like Gnome or KDE can only partly be controlled with the keyboard. And in fact, the model of free floating, overlapping windows doesn't lend itself well to keyboard control. I will now present some alternative window managers that use non-overlapping windows, can completely be controlled with the keyboard and that are, for the most part, extremely configurable.
When you're working primarily with the keyboard, using the mouse and especially frequently switching between the two input methods can be annoying. What to do about it?
One strategy would be to completely drop GUI applications and X11 altogether and only work on the console. For most common tasks there are equivalent text oriented programs you can use, i. e.
On the other hand, the console only allows for a very limited multimedia experience:
So it seems we cannot completely get by without X, which leads us to the question: how can you work efficiently with windows only with the keyboard? It seems that the model of free floating, overlapping windows can not work well here.
As a matter of fact, you don't strictly need a window manager to use X11, and this was how it was in the early days.
A window manager
For demonstration purposes, I'm starting X now with the session called "XClient script", which call this script that I saved as ~/.xession:
# set keyboard layout to US and make "CAPS" an additional Control key setxkbmap 'en_US' -option ctrl:nocaps # set the desktop background qiv --root -m -o '#ffffff' /home/anselm/projects/talks/tiling-wm/ratpoison.png # a little script to display all key presses on screen key-status & # start a terminal urxvt # once the terminal finishes, wait in an infinite loop while true; do sleep 60 done
Normale window manager let the user do the work of efficiently placing windows. But what we're looking for is a window manager that we can tell with a few commands where we really want our windows to be.
There are some window managers for X11 that try to always make use of the whole screen. I will now present you some of these.
Modern desktop environments are quite heavyweight, but it's not just useless baggage that we're now throwing away:
Ratpoison is a window manager in the spirit of GNU screen - and it's executable is even smaller than screen is!
Simple commands can be issued at a prompt (C-t :) or via the command line (ratpoison -c).
C-t : getenv PATH ratpoison -c "echo This message will show in the echo area" ratpoison -c "prompt Please enter some text here: "
PRO
CON
When you're only using applications that work best in fullscreen and don't have to many windows to manage, ratpoison is a decent solution.
Stumpwm is the successor to ratpoison by the same author.
The feel of stumpwm is very similar to ratpoison, but it's more "hackable" since it is written in Common Lisp. But this also means that you need much more memory for the lisp runtime/compiler.
M-x slime-connect
(in-package :stumpwm) ;; prompt the user for an interactive command. The first arg is an ;; optional initial contents. (defcommand colon1 (&optional (initial "")) (:rest) (let ((cmd (read-one-line (current-screen) ": " initial))) (when cmd (eval-command cmd t)))) ;; Browse somewhere (define-key *root-map* (kbd "b") "colon1 exec x-www-browser http://www.")
The ion window manager is under development since 2000, the current version is ion3. Ion uses workspaces, frames (which are created explicitly by splitting) and tabs. Windows that are set to fullscreen are handled much like a workspace. This also makes the numbering of the workspaces unstable. Ion is configured and scriptable in Lua.
Please note that splits are always explicit.
Unfortunately there are some problems with ion's license, and for that reason ion is no longer available in the repositories of Arch Linux and the FreeBSD ports.
The extensive Lua API looks like a lot of fun. There's no support for a system tray but for WindowMaker dock apps, so you can use "stalonetray -w" to get a usable tray.
To do this, press Alt-F3 and enter
dopath("mod_dock")Alt-D will then toggle the dock's visibility.
stalonetray -w & nm-applet &
Larswm support multiple screens and virtual desktops. On every desktop there are two "subdesktops", the floating and the tiling subdesktop. The tiling subdesktop has to columns or "tracks".
Only a few applications are put into tiling, you have to configure these explicitly (whitelisting). But it's also possible to put an existing window into tiling with Alt-Shift-SPACE.
!!!!!!!!!!!!! ! .larswmrc ! !!!!!!!!!!!!! ! These are the windows I want tiled ! larswm.dotileclass.0: XTerm~xterm larswm.dotileclass.1: navigator:browser~Mozilla larswm.dotileclass.2: Mozilla-bin larswm.dotileclass.3: URxvt~urxvt larswm.dotileclass.4: Emacs~emacs ! Some tool windows ! larswm.toolclass.0: XLoad~xload larswm.toolclass.1: XBiff~xbiff larswm.toolclass.2: XClock~xclock ! Windows that should always stay above other windows ! larswm.floatclass.0: XCalc~xcalc larswm.floatclass.1: Gaim larswm.floatclass.2: larsmenu~larsmenu ! Windows that should be visible on all virtual desktops ! larswm.stickyclass.0: larsmenu~larsmenu ! Assign all new web browser windows to the WWW desktop ! larswm.dtclass.0: navigator:browser~Mozilla larswm.dtnum.0: 1 larswm.dtclass.1: Mozilla-bin larswm.dtnum.1: 1 ! Use a wider left track on the WWW desktop ! larswm.?.1.left_track_width: 80 ! Do not resize windows on the WWW desktop ! larswm.?.1.tile_resize: False ! Automatically shift focused window to the left track on WWW desktop ! larswm.?.1.skip_focus: False ! larswm Menu - Middle Mousebutton ! larswm.button2.application: larsmenu -popup '* LARSWM *:exit' 'R E S T A R T:larsremote restart' 'E X I T:larsremote exit' '* Exit Menu *:exit' ! [...]
The method for moving and resizing windows is a bit odd, you don't click on the window but on the status bar to manipulate the currently active window with these shortcuts:
Using the status bar makes sense: look up "Fitt's Law".
Configuration of and interaction with wmii is done via the 9p file system (ported from Plan9) or the `wmiir' tool, if 9p is not available. Every programming language can be used for configuration, you get full control over the event loop. This script is called a "wmiirc", in the standard distribution it is a shell script, but there are also scripts in ruby and emacs lisp.
Dwm is wmii's little brother. Its window model is similar to larswm's and it's also got a builtin status bar. Dwm is configured by editing a C header file and recompiling. While this is secure and efficient, it doesn't make sense to use prebuilt binary packages of dwm - these cannot be configured anymore. The text to display in the status bar is read from the root window's name. Dwm is very small, the executable is only 28k and the source code is less than 2000 LOC. Here's a listing of a directory with a freshly compiled dwm:
-rw-r--r-- 1 anselm anselm 5468 2009-03-21 14:59 config.def.h -rw-r--r-- 1 anselm anselm 5468 2009-03-21 14:59 config.h -rw-r--r-- 1 anselm anselm 650 2009-03-21 14:59 config.mk -rwxr-xr-x 1 anselm anselm 27748 2009-03-21 14:59 dwm -rw-r--r-- 1 anselm anselm 4663 2009-03-21 14:59 dwm.1 -rw-r--r-- 1 anselm anselm 41576 2009-03-21 14:59 dwm.c -rw-r--r-- 1 anselm anselm 373 2008-07-17 17:07 dwm.png -rw-r--r-- 1 anselm anselm 1593 2009-03-21 14:59 LICENSE -rw-r--r-- 1 anselm anselm 1462 2008-07-17 17:07 Makefile -rw-r--r-- 1 anselm anselm 1259 2009-03-21 14:59 README
Because dwm is so small and cleanly implemented it served as a foundation and inspiration for several other window managers. Some notable forks are awesome, echinus and scrotwm. It also inspired the following projects:
XMonad is a clone of dwm, written in Haskell. In the spirit of dwm the configuration file is also written in Haskell. Recompiling and restarting XMonad is happening in the background and can be done without disturbing the current window arrangement. The existing Ubuntu package is user-configurable, the resulting executable is placed in the user's home directory. For this to work XMonad needs a Haskell development environment which includes the compiler and the necessary libraries. XMonad supports Xinerama and EWMH.
It has no built-in status bar, you can use one of these stand-alone programs:
Here's an example from my .xsession with configuration for dzen2:
xsetroot -solid black [ -r ~/.$(hostname -s).png ] && qiv -x ~/.$(hostname -s).png setxkbmap 'en_US,de' -variant ',nodeadkeys' -option ctrl:nocaps -option grp:ctrls_toggle export PATH=/var/lib/gems/1.8/bin:${PATH}:${HOME}/.local/bin mocp_info() { if ps -C mocp > /dev/null && mocp -i | grep -q 'State: PLAY'; then title=$(mocp -i | grep '^Title: ') echo ${title#*: } \| fi } load() { while read f s t r; do echo $f $s $t done < /proc/loadavg } disk() { df -h / | { \ read rest read mount size used avail rest echo $avail/$size } } cpu_temp() { local t=$(cat /sys/class/hwmon/hwmon0/device/temp2_input) echo $(expr $t / 1000)"°C" } xscreensaver -no-splash & while true; do echo '^fg(#222222)^bg(#eeeeee)' $(mocp_info) $(cpu_temp) \| $(disk) \| $(load) \| $(date '+%Y-%m-%d %a | %R') '^fg()^bg()' sleep 5 done | dzen2 -fn fixed -x 600 -w 1080 -ta r -fg '#ffffff' -bg '#006699' -e '' & xmonad | dzen2 -fn fixed -w 600 -ta l -fg '#ffffff' -bg '#006699' -e ''
XMonad has many extension modules in XmonadContrib, they are divided in
PRO
CON
Show interaction with Gnome (EWMH)
Awesome started out as a fork of dwm. The keyboard bindings and general usage are similar, but it's not minimalistic anymore:
Because it depends on so many libraries the memory footprint is comparatively huge. This does not make so much of a difference if you need the libraries anyway for the applications you run.
Useful extensions for Firefox:
You can also use Conkeror, Vimperator, or emacs-w3m.
You also have to ask yourself if you really want to miss out on all the UI improvements that Gnome and Ubuntu are bringing you. If you need an easily accessible desktop you will more likely prefer a standard gnome session. But you can choose how far away from the gnome desktop you want to be: