How to save your Linux screen space
30th Jan 2011 | 12:00
Tiling window managers can boost productivity
Save screen space: Tiling window managers
You probably already know that a tiling window manager is one of the alternatives often provided by distributions alongside the standard Gnome or KDE desktops.
Instead of floating windows, with their ability to move anywhere, and stacked applications that overlap one another, a tiling window manager locks applications to the display, splitting as necessary to run applications side by side. When you run enough applications together, your desktop can start to look like a tiled bathroom, which is presumably why they're called tiling window managers.
But tiling managers can offer some genuine advantages over their more flexible rivals. A single application should run full-screen by default, for example, removing many of the distractions that can make a simple job last four times as long, and any applications you want to run at the same time are always visible.
There won't be any overlapping windows, unless you explicitly want them, and you don't have the distraction of playing with window borders.
If you're running a lower-resolution display, you'll make more effective use of your screen real estate by not having dead space. If you've got a high-resolution display, then you'll always be able to see the entire contents of the applications you're running, which is ideal if you're making notes or need a web browser open while you enter text into a document.
But making the transition from a regular window manager to the restrictions of a tiling window manager isn't easy. It can require a reprogramming of both your muscle memory and the way you think about your desktop.
We'll tackle both of these problems in this article, taking you deeper into the world of window managers and into the world of tiles.
KDE's hidden gem
It might be surprising, but a good place to start is with a desktop you're already used to, and the best choice is KDE. Starting with version 4.4, KDE took some tentative steps towards supporting tiling by enabling windows to dock next to one another, side-by-side.
Version 4.5 saw the idea through to its conclusion, adding a fully featured tiling mode that can turn your floaty KDE desktop into a strict matrix of windows.
These developments were presumably to help with the production of KDE's netbook interface, where applications will typically run as full-screen, and you need to make best possible use of the display. But it means that KDE 4.5 can now be turned into a useful tiling window manager.
As with most things in KDE, the option to enable tiling is hidden within several layers of configuration panels.
You can get to the option either from the title bar of an application or by opening the System Settings application, selecting Workspace Behaviour, switching to the Window Behaviour page and choosing Advanced. There's a large tick-box here that will turn off floating windows and enable window locking.
There are a few other options that can be used to fine-tune your experience. In the default layout of Spiral, for example, each new window will split the full-screen view clockwise. The first application will occupy the entire screen, while the second will appear on the right half.
Further applications will halve the lower quarter of the right half, and so on, until your display looks like a spiral of windows. The alternative is the two-column layout, as configured by choosing Columns, but we had problems getting consistent results with it.
Now that tiling is enabled, you can get a good idea of what a dedicated tiling window manager would feel like. You need to get used to a web browser filling the entire screen, for example, which can be a little disconcerting if the page you're viewing appears as a wide column. The biggest difference is with windows you usually leave floating, such as notifications, a Twitter client or instant messenger.
By default, KDE's window manager will force these to run full-screen, leaving you with a lot of blank space. The solution is to change how they appear from the floating window menu, which gives you some control on the amount of space they take up.
If you're looking for real control, you'll need to switch from KDE to a window manager designed to hand the power to you.
Save screen space: Ratpoison
Tiling window managers are all about speed, and the quickest way to tell your computer what you want it to do is from the keyboard, since it's where your fingers are already resting. This is the primary motivation behind Ratpoison, a popular tiling window manager that hopes to convince you that your mouse is dead.
However, keyboard shortcuts need you to put in some effort before you actually start saving time using them, rather than running through the documentation. And most users will agree, Ratpoison has a steep learning curve.
You even need to prove you're up to the task before you can enter the environment – at least you do if you're running Ubuntu with the GDM login manager.
After installing the Ratpoison package, you'll need to either run the window manager manually or create a 'ratpoison.desktop' file in the ''/usr/share/xsessions' directory by copying the Xterm example and changing the executable path to '/usr/bin/ratpoison' and the 'X-Ubuntu-Gettext-Domain' to 'ratpoison-session'.
After that, you'll be able to see the new option in the login window manager menu.
But you won't see anything. Ratpoison is probably the most zen-like desktop for Linux, and doesn't clutter the screen with anything that suggests it's running. You might notice a brief message telling you how to get started, but if you happen to be checking your watch at that moment, Ratpoison will look exactly like a crashed desktop – a completely empty X server.
To get from this point to usability requires keyboard shortcuts, and the bit of information you've just missed is how to see a list of the keyboard commands.
The most used shortcut in Ratpoison is Ctrl+T. This places the desktop into a mode ready to accept further keyboard commands. You could add the '?' key, for instance, to reveal the help file listing all the other keyboard shortcuts you can use, but here's our pick of the most useful ones.
Following Ctrl+T with 'C' will open a terminal, and from there you can launch any other applications you need. You can also replace 'C' with '!' to run a single command line.
Applications will run in full-screen mode, and they won't have any window border, meaning you can't move them with your mouse. Instead, you can use the 'N' (next) and 'P' (previous) shortcuts to switch between your running applications, although you'll also find this switches between tabs in Firefox too.
You can see which windows are open with 'W', and they'll be listed in what Ratpoison calls its status bar, which defaults to the top-right of the screen. Switch between windows and tabs by using the number that appears in the list.
All this keyboard speed might seem like an advantage, but there's currently very little tiling. At the moment, each application is running full-screen. This can be remedied with another shortcut, 'S', which will split the display horizontally, or Shift+S vertically.
The application behind the current one will then fill the space, and you can continue splitting the display in this way until you've got as many viewable applications within each section as you need. You can then switch between each section using the cursor keys, and you can resize the selected frame using 'R' followed by some judicious use of the cursor keys to expand and contract the application borders.
All the other frames will scale automatically to accommodate your changes, and and when you want to remove a frame completely from the display, use the 'Q' shortcut.
Finally, if you really want to customise how Ratpoison handles applications, you'll need to edit the configuration file, which can be found hidden in your home directory as '.ratpoisonrc'. If not, you'll need to create it.
The manual includes some excellent information on what you can accomplish here and, depending on your package installation, you should find good examples of what's possible in the installation directory. You can, for instance, create several virtual desktops for your applications, or try using what Ratpoison calls Hooks to add simple scripted behaviour to your keyboard shortcuts.
You can add shortcuts for running specific commands, and even dump and restore specific application layouts, which is useful if you want one configuration for web browsing and another for programming. But if it's customisation you're after, there's only so far Ratpoison will go. You'll need to look for an even more advanced option.
Save screen space: Awesome
We're now ready to delve into a window manager that's going to require a little more configuration to be useful, and one of the most configurable is the modestly named Awesome.
It describes itself as the next-generation framework window manager, and openly admits it targets itself at "power users, developers and any people dealing with everyday computing tasks and who want to have fine-grained control of their graphical environment".
Awesome is the epitome of what tiling window managers are all about.
It's not difficult to install. Your chosen distribution should already have packages, and you just need to let it install these, log out of your current desktop, and log in again choosing Awesome as your new window manager.
At this point, there's a chance you might see nothing at all. This depends upon whether your distribution has decided to bundle a default and sensible configuration file with its packages, or whether it expects you to set up a productive environment from scratch.
If not, you'll need to hunt for the file called '/etc/xdg/awesome/rc.lua', which is used by default on Debian-based systems, and it's this you'll need to edit if you don't like the default configuration.
Windows sans frontières
The best way to describe the desktop you see using this specific configuration is austere. It looks more like the last generation of computer desktops than something designed for the next generation, but you'll find that applications launch blindingly quickly, and that Awesome's best feature – its window tiling – is already in full swing.
Just open the menu from the small, inconspicuous icon in the top-left corner of the screen. You'll find that this hides the standard list of applications installed on your system, as well as more direct links to a terminal client and an Awesome menu for quick access to documentation and the configuration file.
When you first launch an application, you should notice that it won't have the window border because Awesome doesn't want you to go dragging windows about. Instead, it takes a very strict approach to where each window is positioned, and how new applications appear on the screen.
To do this properly, it has to stop you dragging them around yourself, which is why there's no window border. But this also adds a slight level of inconsistency, because certain applications, such as Google's Chrome browser, have their own borders, and you will be able to drag these around.
Speed == Efficiency
The best thing about Awesome is that it's quick, and this means you can switch between various tile configurations instantly.
There's even an on-screen button to make this easier, and you can find it in the top-right corner of the display. Clicking on this will cycle through the various layout modes on offer, and the icons are designed to illustrate what each mode does to your windows.
The first is a blank icon with a small blob on the bottom left, and this is the closest Awesome gets to being a floating window manager.
It means there's no layout, and you can move application windows as you need to. The next mode splits the main display into various sub-sections – two on the left half and six on the right – themselves split into two columns.
It's a layout that's perfect for a system administrator who needs plenty of terminals open showing log files, and perhaps a couple of sessions for doing some real work.
Many of the following modes are a variation on this layout, rotating the splits around each edge of the screen. But there are a couple that differ significantly, including the same spiral layout KDE offers, a single-application full-screen mode and a mode that seems to add windows randomly.
The best way to find one that works for you is to experiment with each one and see how you get on.
These tricks can also be accomplished by using key combinations. As we've alluded to before, getting the most out of a tiling window manager is all about learning the shortcuts that make things happen quickly.
Switching between tiling schemes can be accomplished by pressing the left Windows key on your keyboard and the Space key, and there are dozens of other combinations that can make using Awesome a much more pleasant experience than hunting through the launch menu might suggest.
You can resize individual windows by holding the Windows key and either H or Shift+H, and you can run applications from the command line with Windows+R.
You might also have also noticed that Awesome seems to have a considerable number of virtual desktops, as indicated by the horizontal list of numbers next to the launch menu. Clicking on these will switch desktops in the usual way, or you can use the Windows key plus a number to do the same thing from the keyboard.
But the interesting thing about Awesome is that these aren't called virtual desktops at all. They're called Tags, and they're one of its key features. The main idea is that you can send applications to a specific tag, for which you've created the most useful layout and configuration for that kind of application.
But to get this to work, you need to delve into the configuration file.
Configure or die
You'll quickly find that all paths within Awesome lead to the configuration file. Over time and use, it's likely you'll either get frustrated with the way a feature works, or with the unnecessary tiling modes, or will want to change keyboard shortcuts or add new ones. All of these things, and more, can be changed by editing a text file, and it's this that makes Awesome so useful.
The power within the configuration file comes from its use of the Lua scripting language. Every property within the file is defined using Lua and, as a result, you can create dynamic and adaptable solutions that wouldn't be possible with any desktop using a static configuration file.
To illustrate the lengths to which this can be taken, there's even an example configuration file that embeds a complete Space Invaders clone. However, before you attempt anything on quite that level, it's worth getting to grips with the basics.
To get started, move the global configuration file for Awesome into a '.config/awesome' directory within your home folder. Debian users will find the original file at '/etc/xdg/awesome/rc.lua', and moving this to a user's own configuration folder will ensure any changes you make to your own configuration won't be applied to anyone else's desktop.
You can then make changes with any text editor, although something with Lua highlighting, such as Gedit or Kate, works best. The configuration file is well documented, though you can make many small changes without resorting to the manual.
At the beginning of the file, for example, you'll find a section that lists the various layouts we scrolled through earlier, and you can easily remove any of them from your desktop by either deleting the offending line, or by commenting it out with a double minus symbol at the beginning of the line (--).
First published in Linux Format Issue 140
Liked this? Then check out 10 of the best Linux window managers
Sign up for TechRadar's free Weird Week in Tech newsletter
Get the oddest tech stories of the week, plus the most popular news and reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register