Window managers – Special – i3 (ENG)

This article has been originally published in Italian (here). Feedbacks on content and translation are appreciated. Contributions are welcome. The original article must be considered the reference in case of updates.

No “toolbar”. No “maximize” or “minimize”. No icons on the window title. Indeed, no icon at all. No “click here to show something“. Anything, actually, even a pop-up full of insults, please! No.

Deep in my mind there was a little trick I didn’t even know I had: key shortcut Windows + Enter to open a terminal. It works: now that’s a good start!

Welcome to i3, an extraordinary tiling window manager.

When I started the window managers post series I chose “stacking” WMs (read introduction post), that are the most commonly used ones: overlapping windows, manually placed and resized, focused window brought on top of all open ones (top of “windows stack“, that is), minimized or maximized windows to fill the whole screen.

A tiling WM such as i3 (home page) relies on few simple principles that just get rid of many features that stacking WM has. Before I go more in depth, one important question:

Why i3 instead of XYZ?

The answer is in a comparative table on the Arch Linux wiki (a great wiki, by the way): Comparison of Tiling Window Managers. Criteria I considered to make my choice were, first of all, an active development and then configuration file in plain text, like any good Penguin. In other WMs configuration files are themselves scripts in different programming languages; for some others, even more radical, modification of source code and recompiling is needed for any customization. Both cases are not feasible for me (and for many others, I reckon).

Its motto, strongly proved by practice, has also been part of the choice: “Do What I Mean. Good Docs. Clean Code. Sounds good?“. Finally, i3 claims to be an improvement to wmii: while wmii means “window manager improved improved“, i3 is “improved improved improved”. I had to to try it!

Let’s begin from its installation, on the usual “playground” of a minimal Ubuntu, 32 bit, 13.10 (Saucy Salamander):

minimal_saucy

Ubuntu Saucy Salamander (13.10) minimal – basic information

Hold your terminal: installing from official repos is not the best choice, as Michael (Stapelberg, i3 creator) points out. You’d better use his repo (preferring the stable releases one). Ubuntu’s repos are synched with the Debian ones every six months: with such an active development you will miss the continuous improvements of i3 for quite a long time. Actually, at the time of writing you would find v4.2.2 in Saucy / Debian stable repos, while starting from wheezy-backports you would find latest release v4.7.2.

Once you’ve added “sur5r” repo as suggested, it’s time for the long awaited:

i3wm_1

Here we go!

Nimble install, as one would expect.

i3wm_2

Yes, yes, go on!

At first run i3 has this appearance and only asks two questions: whether to create a user configuration file and which key to select as default modifier for keyboard short-cuts. Nothing else is needed, and yet you can foresee what it will be all about.

A nice empty, black desktop, a thin bar showing a handful of system information (i3bar), both insensitive to any kind of interaction.

And yet, i3 is light and fast as hell, exactly as it claims to be and getting familiar with it might not be as difficult as it might seem.

i3wm_6

Throw away the frills (so, what’s left?)

Beginning to use i3, let’s write down a quick list of what a tiling WM does to manage your desktop and what features, as a consequence, you will not have compared to a stacking WM. I am actually pointing out the basics of tiling WMs, although any addition of external components (even from full-fledged DEs) is allowed.

[0] Windows always fill the whole screen: if there is more than one, available space is progressively split, either horizontally or vertically. There will be no empty area on desktop: “have space, will use”.

i3wm_5

Horizontal split

[1] The first, although negligible, effect is that a wallpaper becomes useless: it will always be covered by windows. Of course you might want to set it with nitrogen or feh and use compton to get some nice transparencies, but then we are already in the filed of eye candy.

[2] There will never be a free portion of the desktop because windows cannot be minimized: of course they can be resized, but all the space you take away from one window is “distributed” to the other ones. Since windows are always visible, a toolbar holding application icons is useless, as well as the common key combination Alt-TAB.

[3] For the above reasons snap between windows is also not needed (it is, so to say, “automatic”).

[4] Buttons on window decoration (title) also have no reason to exist and, all in all, the title bar itself could be avoided, except to spot the active window. No buttons means a reduced usage of mouse in favour of key shortcuts.

[5] Windows can be made floating but they will always stay on top. As of current release (4.7.2) such windows cannot be made “sticky” (present on all desktops). [Edit 30/Sep/2015: Sticky windows are here at last!]

[6] Workspaces number is not fixed: a workspace is created automatically each time you move on it and it is deleted when it’s empty and you move away from it. If you have a multi-monitor setup (which seems quite frequent among users of tiling WMs), each monitor is treated as a different workspace.

i3wm_dualscreen

i3 – Dual screen

So, what apparently is a “lack” of features in a tiling WM compared to a stacking one, actually it is not: within this well-thought and reasonable environment some features have no use. That’s a peculiar word since here you’ll find only what is useful: to make the WM reactive, to speed up the workflow through key shortcuts, to concentrate on what you are doing rather than on the surrounding graphics. In addition, code stays clean and light, easy to understand (generally speaking, not in my case), improve and debug. There are, on the other hand, features like the window tabbing that few other WM/DEs can sport (KDE and Fluxbox, as far as I know).

A tiling WM “forces” user to take advantage of virtual desktops, a peculiar Linux feature, to arrange open windows instead of piling them up on a single desktop and raise / lower / move them around. Users have therefore to “tidy up” all running programs, divide them into separate activities, thus improving their workflow. In fact you’ll often find power users and professionals using a tiling WM, so that they are relieved from the duty of placing and arranging windows by themselves. Even in a more everyday use i3 or the likes might surprise you: just think of what you usually do with your pc and see how i3 can fit. You won’t necessarily find your way through, but it’s worth trying.

A nice overview of i3 is in a short video, in the “Screens” section of home page, in which the author shows the main keyboard shortcuts, tabbing modes, the basic definitions of container and tree structure of windows, what happens when a new window is opened or moved around.

Finally, a statement of the author gave me the best reason to choose this WM among the others: i3 aims to be easy for all kind of users, although it’s mainly intended for power users, differently from other WMs that deliberately exclude less experienced ones with such sentences “[…] This keeps its userbase small and elitist. No novices asking stupid questions“. YOU KNOW WHAT, GUYS?

     _     Well, f**k you,     _
    |_|   I have chosen i3!   |_|
    | |         /^^^\         | |
   _| |_      (| ^o^ |)      _| |_                   __________
 _| | | | _    (_---_)    _ | | | |_          __    |##########\
| | | | |' |    _| |_    | `| | | | |        [##]   |###########\
|          |  /_     _\  |          |     ______    |##|    \####\
 \        /  / /|   |\ \  \        /     |######|        ___/#####|
   \    /  / /  |___|  \ \  \    /       |######|       |########/
     \  \/ /    | _ |    \ \/  /            |###|       |########\
      \__/      || ||      \__/             |###|           \#####|
                () ()                     __|###|__   ______/####/
                || ||                    |#########| |##########/
               ooO Ooo ASCII art credits |#########| |#########/

OK, I really had to vent this!

Back to the point, I’ve installed i3 beside KDE (the opposite side of the world!) and I’ve soon made myself “at home”. I have to keep KDE to avoid “family issues” I am not going to discuss here.

For those who already take advantage of keyboard shortcuts the step toward i3 might be even shorter. In addition, I have brought to KDE some shortcuts: mouse actions are convenient but slow due to the pointer travel. In an environment where a two-key combination can perform any action you need, your mouse might feel a little lonely.

Configuration

Tuning i3 is quick and easy as yo might expect. There’s not so much to customize, all options help in two configuration files: ~/.i3/config and i3status.conf.

The first one is created at first start, choosing the default modifier key for shortcuts. The shortcuts (named bindsym in the file) are the “core” of i3 usage: proposed default settings are well-thought and easy to execute. User Guide is very thorough and clear, so I am not going on on the topic. I also expect that those who choose such an “uncommon” WM are not afraid of reading the relevant documentation.

In a nutshell what we find in the config file is:

  • key combinations to manage workspaces and windows and to start preferred applications:
    bindsym $mod+Shift+1 move container to workspace 1
    bindsym $mod+Return exec i3-sensible-terminal
  • definition of “decoration” colors:
    # class        border  backgr. text    indicator
     client.focused #859900 #859900 #fdf6e3 #2e9ef4
  • autostart programs:
    exec --no-startup-id feh --bg-center ~/wallpaper.jpg
  • definition of window rules (for example: Firefox windows without borders):
    for_window [class="Firefox"] border none
  • definition of status bar colors and position:
    bar {
    position top
    status_command i3status -c /path/to/conf_file
    colors {
    background #073642
    [...]
    }
    }

Statements syntax is extremely plain, due to continuous improvements to make them easily understood.

Adding more “bar { ... }” sections into file we can have multiple bar instances (two, in practice, since bars can be placed on top and bottom edge, unless you want stacked bars as the green one shown below), each one referring to its own configuration file “-c /path/to/conf_file” as the example above. A tray area for icons is also a feature of i3bar.

The second configuration file is for the bar: the system-wide basic file is in /etc/i3status.conf. Such file is the (first) default if no other one is given on i3status command line: it list which “modules” and format are included in i3bar.

for a customized configuration just copy the original one anywhere in your home folder and rename it as you prefer: each instance of i3status will point to a specific file at run time. To exclude unwanted or unnecessary modules you need to comment out the corresponding lines:

order += "disk /"
#order += "wireless wlan0"

The “true” source of information is i3status that pipes its output into i3bar. You can even set a different data source (Conky is a frequent choice) provided it uses the JSON standard to format the data stream. Needless to say, man pages of both components are detailed and clear enough.

Communicating with i3

There are three tools integrated into i3, that are also handy to make little “control” scripts:

  • i3-msg: sends “messages” (commands, even multiple ones separated by “;”) to i3, for example “go to workspace 3, start iceweasel, go to workspace 1“:
    exec --no-startup-id i3-msg 'workspace 3; exec iceweasel; workspace 1'
  • i3-input: takes user input as argument for commands: in the example below, a new name for a workspace
    bindsym $mod+r exec i3-input -F 'rename workspace to "%s"' -P 'New name: '
  • i3-nagbar: is a ntofication bar where you can configure “buttons” linked to different commands
    bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. \
    Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

Examples are taken from the User Guide (once more, do read it!!1!1!).

What about programs? Easy, we start them through dmenu (part of the suckless-tools package – home page) or i3-dmenu-desktop, a wrapper for dmenu  that list applications shipped with a “.desktop” file.

Question: “Can I use i3?” – Answer: “Yes and no”

Yes if you, average user bound to mouse and buttons, are aware that you are facing a peculiar interface to your pc, an interface that sets a very specific way to get things done, different from the usual graphic environments.

Yes if you make an effort to learn the new “way” (and customize the environment while you do so).

Yes if you are convinced that i3 is exactly what you are looking for to accomplish your typical tasks.

Yes if you have a quite large screen (or more than one): on smaller screens there might be no room to keep multiple windows on a single workspace at a decent size. Think of a split screen with a browser (that might take even 2/3 of width) and a terminal: anyway, shelling out some money might solve the issue.

No if you can’t stand such a sober appearance and the reduced possibilities to add some bells and whistles.

No if the concept itself of a window nailed to the desktop and always visible sounds absurd.

No if you are not comfortable with keyboard shortcuts and, in general, with the keyboard (including the famous “terminal”). Nevertheless i3 allows for a balanced use of the mouse, differently from other WMs.

No if a couple of windows are all you need. In this case it makes little difference to use a “normal” WM/DE (stacking).

No if you don’t want / don’t know how to build your environment from scratch, starting from a minimal install (Ubuntu in my example but also Debian, Arch and more) installing and configuring all you need. For such a niche WM there are no ready-to-go distros. To start, I have got something on topic.

Up to now, the only problem I had was about windows re-arrangement, that is moving combined with split variation (horizontal to vertical or vice-versa). I am on a “trial and error” mode for the moment, as I can get any possible arrangement except the one I really want! I am getting the hang of it, anyway, and that’s the point: i3 is “reasoned and reasonable”, easy to learn and to understand. In a while you’ll be mastering it (I am quite there) very naturally.

A little off-topic (not so much) trivia: Windows 1.0 (1985!!!) could only tile open windows.

“i3-msg exit”: conclusion

Despite being so “basic”, i3 is very flexible to fit the needs of different users. I had to and I meant to leave out more details, that will probably deserve a dedicated post. for example, I am not talking about the useful “scratchpad“, that you are surely going to search in the User Guide (just kidding, here is the link). One more stop for tips and hacks is the forum. I even took a peek into the #i3 IRC channel to collect opinions and advice from real “power users”: a common stance is “It works great, there is no looking back”.

In conclusion, if you want a light, functional, stable, fast WM, even appealing for its minimalism, i3 is your choice. You will have the complete control of the desktop while remaining focused on what you are doing. Even if you’re just watching a movie or carelessly surfing the web! You will take an inquisitive look at your desktop, thinking: “Do I really need this window here, now? No? Then go away onto a different workspace!”

Advertisements

Informazioni su Man from Mars

https://extendedreality.wordpress.com/

Un Commento

  1. Pingback: i3 tips ‘n’ tricks | Extended Reality

Dimmi che ne pensi o fai "Ciao ciao!" con la manina // Share your thoughts or just say "Hello!"

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: