Of course I have a backup!

Random blobs of wisdom about software development

Current window manager: i3

Tuesday, October 25, 2016

List of window managers I have tried so far: metacity (gnome), fluxbox, xmonad, awesomewm, and the latest one, is now i3. I think fluxbox stuck for the longest time, around 5 years, while i3 is the second with about 1.5 years.

Beginning with floating managers

When I first installed linux, I started with Ubuntu (actually, there was a Hungarian distro called UHU, a really long time ago, that I could not get to install, and gave up) and it came with Gnome 2, or maybe 3, but it was definitely not Unity. The window manager in that version was Metacity, which is a really straightforward, featureless WM, kinda the same that you had in Windows before Aero.

I didn't actually have a problem with Metacity, until I saw a coworker use fluxbox, and I was really amazed by the window matching functionality. Basically, you can write matchers, based on some criterias (window title or window class being the most frequent), and then define some properties on the windows (like send window to workspace X, resize to X*Y, and so on). His frequently used programs all had these rules set up, so when he started an applcation like his chat program, it always started on workspace 4, maximized, the contacts, and the chat window of Pidgin was neatly next to each other in two columns, on workspace 2.

These are just small things that you never actually bother with, why would you set up your windows to be some exact size, if you knew that when you close it, they will just revert to defaults anyways? However, with window matching, you can set up persistent rules that stick, which is a really nice quality of life improvement. Fluxbox even has the option of "whatever properties this window has, remember it", so you don't even have to type in measurements manually into some config file.

I also really liked the plain, retro 80s look, it is very similar to what you would find in some TV series in a hacking scene. There is no bloat, no start menu, no quick launch bar, no icons, no docks. You get your desktop background, a workspace indicator, list of windows, a tray, and a clock. You can also get a menu, if you right click on your desktop, with some basic functionality, like restart, and shutdown.

I actually didn't miss any of these, apart from some kind of launcher. Previously I used the start button in the lower left to launch applications, but without that, I needed something else, and found Gnome-do for that task, which turned out to be faster than using menus.

Tiling managers

There are two kinds of window managers, tiling and stacking. Fluxbox, metacity, and I think anything you find in a modern a DE (also Windows) is going to be stacking. This means that windows are positioned in 3d space, they take up width, height, have a z-index, they can also overlap, and they can be moved around. A tiling manager works in 2d, windows cannot overlap, and they always take up all the available space, and you can change how the space is divided up (eg. horizontally, vertically, mixed, awesomewm even has a fibonacci spiral style). The upside is that you always see everything, since no windows can overlap, the downside is that you need a large screen (or to be more specific, large screen estate).

So after discovering Fluxbox I started wondering what other window managers exist. I dabbled a bit with awesomewm, and xmonad, but they didn't really stick. I don't really remember why, but using haskell for configuration certainly didn't make the switch easier. Even though I really liked the idea of tiling, I switched back to Fluxbox.

i3 features

I was quite happy with returning to Fluxbox, but after a while I stumbled upon a google tech talk about i3, and I really liked it. After using it for a few hours, I fell totally in love with it. Some of the features that I use the most:

  • Tiling
  • Awesome tray bar
  • Non-stick workspaces
  • Window matching
  • Easy custom DSL for everything, configuration, styling, and window matching
  • Multiple window tiling modes
  • Context-aware hotkeys
  • Floating/scratch/fullscreen windows

The tray bar in i3 is really nice, take a look at the bottom part of the first image. They are basically a bunch of shell scripts that just output something stdout (the icons are fontawesome glyphs). I recommend using i3blocks for it. Non-stick workspaces means that if you have no windows on a workspace, it will not be shown on the indicator, you can tell at a glance what workspaces you are using, which makes finding windows much easier.

The tiling modes are: vertical, horizontal, vertical tabbed, horizontal tabbed. The horizontal/vertical tabbing just means that you have 1 window, that contains your open applications as tabs, and the tabs are laid out vertically (top-to-botom) or vertically (left-to-right), this comes into play when switching windows with hotkeys, see later.

Context aware hotkeys are something like, that you can press a button to activate a "mode", which changes what some other buttons do, for 1 keypress. Eg. when I press F12, I can press S for shutdown, P for poweroff, L for lock, or S for Suspend. After pressing one of these keys (or ESC) they return to normal.

Floating windows are what you are used to from windows. It's a way of doing some "hybrid" tiling+stacking together. When you mark a window as floating, it will be removed from the tiling, and it will be on top of the other windows, and can be moved around, like a regular window. This makes a lot of sense for stuff like dialog boxes, which look really ugly when they stretch out due to tiling.

Scratch windows are one of the features I use the most, it's a fancy way of hiding windows. When you press the scratch button, the currently active window becomes floating, and hidden. When you press the recall button, the window will be shown. Imagine you are writing some script, and you need to constantly run it, or run some tests after you modify code. You open a window, and edit your code in, and you open another one, where you will run your tests. You make the second one a scratch window, so it gets hidden. Now you have your editor fullscreen (since that's the only window on the workspace), and when you want to test things, you can press eg. Super+Space, to have your CLI window pop up in the middle, run tests, observe what happens, then press Super+Enter to hide it. Repeat until done. It works really well for all kinds of iterative evaluation loops where you have to write code, then verify that it runs correctly.

Fullscreen windows is just that. You can mark a window fullscreen by pressing a key, and it will be maximized, over all the other windows. When you press the button again, it will return to its original size and position. Really handy when you have to focus on some partical thing.

Another really nice thing that comes with floating managers, is that it makes keyboard navigation extremely easy. You can have keys defined for directional stuff like "focus window to the right", "move window to the left", and so on. This only makes sense in tiling, since if you have stacking, you can't always tell when is "to the right", if the windows overlap. I find that I use the mouse very rarely, keyboard navigation is just so much more effective, than cycling through everything with alt-tab.

I can really recommend everyone who wants to look into tiling managers to start with i3. The docs are really good (the user guide has a really good picture with the default bindings), the configuration is really to understand, and even though I mentioned a lot of features, it doesn't do that much, that it would be overwhelming to configure. Just start out with the default config, and add what you like as you go along.

This was written by Norbert Kéri, posted on Tuesday, October 25, 2016, at 16:10

Tagged as:

Post a comment

Providing your email is optional, it is never published or shared, it is only used for auto approval purposes. If you already have at least 1 approved comment(s) tied to your email, you don't have to wait for moderation, otherwise the author must approve your comment.

Please solve this totally random captcha