Using i3 on my Arch USB flash drive

Posted on 2014-11-15 14:08

Back in February I wrote about setting up a bootable USB stick with Arch Linux. At the time I was using it with a Dell laptop, but since then have been running it mainly off an old Thinkpad T410s (with a now totally non-functional power cable and a cracked palmrest) that had been retired from work after it went out of warranty. I had installed Arch on the hard drive of the machine already hoping to make the old girl usable again for web browsing at least (the graphics card and screen on this model are horrible - first gen Intel HD graphics and the screen, while touch enabled, has very little contrast and can't be seen well except straight on).

I had chosen to use KDE 4 at that time and it was the first time in a long while that I'd used KDE anywhere. It is, in fact, very impressive. Highly configurable, has all sorts of nifty graphics effects and I quickly got comfortable using it. For those who don't know what KDE looks like, think old Windows with a start button of sorts, but with a vast amount of Win7 and OSX-like graphical effects. I liked it so much I installed Arch and KDE on the Thinkpad's hard drive as well. However, it turned out that KDE on my USB install wasn't a good fit. KDE is big, and the USB on this model is only 2.0 making reads and writes slower than the drive is capable of with the result that loading up KDE is slower than it could be and using any cool graphical effects just makes the experience worse. I decided to bite the bullet and learn how to use a lighter weight DE (desktop environment) to see if I could get better performance.

I decided to go with i3 which is a tiling window manager (WM). Its very lightweight meaning there are less reads from the drive, making the experience over my slow USB 2 connection faster and better.

One of my workspaces with three terminals open. You can tile other programs like firefox or a file manager as well.

For most folks , using a desktop like this will be a paradigm shift. I'm not sure arguing about the definitions of "window manager" and "desktop environment" and into which of these i3 most neatly fits is worth exploring, so for now I will just mix them up as I see fit and suffer the inevitable wrath of those more qualified to classify such things. When i3 starts, depending on how it is configured you aren't even sitting at a command prompt (the thing about linux which always seems to inspire the most terror or disdain from users of those other OS') but instead you'll likely be staring at a black screen with a thin strip of information along the bottom with no obvious indication of how you would go about doing anything at all.

After getting over the initial shock of having absolutely nothing to click on, and delving into the user guide for help, I started to realize the genius of this type of DE.

If you're anything like me you use computers a lot. For many years now most DEs I've used have assumed a mouse or touchpad for some user input. Recently that has changed and shifted to a touchscreen interface which really isn't all that different from the mouse paradigm: the user is pointing at things and selecting them in some way. Its a visual object based control system. If you're old enough to remember computing before the mouse, DEs were based solely on keyboard input. Whether you're a desktop user, have a laptop, or use a tablet there is still always some kind of keyboard input required (even tablets have a virtual keyboard and all text entry is done using it). Touch typing (and we can argue if the layout of the keyboard is ideal or not another time) is arguably the central most basic input method for all computing and probably will remain so until such time that we can control our computers with voice. Mouse-centric DEs were seen as a major step forward at one time, but I've since come to believe that they are a wasteful abstraction for very little benefit. Dealing with older (non-computer savvy) users, the mouse is often their biggest hurdle to overcome. Touchscreens are much simpler for these folks to master.

i3 allows for the use of a mouse or touchpad, but doesn't treat the primary input device (the keyboard) as a bastard step-child. I'm not so sure how I'd like i3 on a tablet but some crazy person has it running on a Nexus 7 and was talking it up on reddit. In i3 I find I can keep my hands on the keyboard a lot more. Here's some examples of use:

A lot of the commands used in i3 depend on the use of a modifier key (a key you hold down in addition to another key to do some action). By convention the modifier is referred to in the documentation as $mod and can be set to any key you like (though some will make more sense than others in your keyboard layout). In my case I have it set to the Windows key which is an absolutely useless key in Linux otherwise.

To open a program, you can set a key combo (I have firefox set to $mod + b), or you can use $mod + d (if you install the optional dmenu package) which will open a list of programs installed on your system along the top of the screen and you can start typing in the name of whatever program you want to load. You can also type a path if you need to enter the program with some command line switches.

Once you've gotten a program open, the next thing you'll probably notice is that there isn't any way to close it - at least no way provided by i3. Most programs provide some way to shut the program down, either through a menu or an icon inside the program. For those that do not you can use $mod + Shift + q to quit. There is also no "minimize" because minimize doesn't make sense in the tiling paradigm.

Once a program is opened, the next program you open does not "float" on top of the first as you may be used to, but instead the screen is automatically divided in half (either horizontally or vertically) with your first program shrinking to fit inside one and the new program loaded into the other half of the screen. Unless something special is set up you won't be able to move these windows around by clicking with a mouse - although hovering your mouse arrow over one or the other is one of the ways i3 can determine which half is active (which has "the focus") - there is also a keyboard shortcut for this as you might be starting to expect. You can select the divider between the two halves and shrink one, you can use $mod + Shift + arrow to switch between horizontal or vertical split. If you're happy with all your programs fitting into smaller and smaller portions of screen real estate as you open more up, you're done. Good luck with that.

If you're like most folks this is going to get frustrating quick. You like to use your web-browser full screen, but you also want your email at full screen. If you have two screens you're golden. If not you're going to want to switch between these programs at full screen. In a mouse-centric desktop you could click on an icon to switch between them, or (ironically) use a key-combo like Alt-tab. In i3 you can use $mod + $num (where $num is another number 0-9 other than the one you're currently using) to open a new "workspace".

A workspace is just another empty black desktop into which you can load more programs. You can switch back to the initial workspace (ex. $mod + 1) and your two programs are still right where they were. There is no "miximizing" or moving windows around to find the one hidden behind the other open windows. All the windows in a workspace are open in as much space as the number of tiled divisions of the screen you've created allow them to be. You can set up several workspaces in this way and toggle between them quickly as needed. Instead of cycling through 10 applications you might cycle between three workspaces where those 10 applications are running in tiled windows.

You may end up needing to move a program running in one workspace to another. For me, when I've got the laptop plugged into a secondary monitor and I want to move a program to be displayed there instead of a workspace on the laptop I can use $mod + Shift + $num and select the $num corresponding to the workspace that is showing on the secondary monitor. This is so much easier than many other DEs I've used where you spend time operating your computer like a video game, pointing and clicking in just the right spots, dragging, and pointing and clicking again.

Another option for full screen is to use $mod + f to switch the active window to full screen mode, and when pressed again this combo reverts the application to its original tiled state.

There are some programs which, due to the nature of how they work will require some more thought. Gimp for instance, opens several windows which were intended to float over, not tile around, an image you're working on. These kinds of floating windows are supported - though they sort of violate the tiling paradigm. You can grab the top of these floating windows and move them around covering other tiled windows. A chat client which opens another window for chat messages is another.

I need to be able to lock the screen when I'm running this at work and I found this post invaluable. With i3lock installed, I can bind $mod+l (like this author I also have disabled l,k,j,; keys) to manually lock the screen, and with some tweaks to .i3/config, it can kick off after a certain amount of time of inactivity.

Exiting i3 can be done with $mod + Shift + e

Whether i3 is a good choice for you or not will depend on how much you're willing to learn about it. If you are willing to take the time to try to fit what you do into a new DE and finding out which things might work better for you, I bet you'll also find things you don't like which will lead to more time to investigate changing the default i3 behaviors. Most folks don't want to learn new ways to use their computer. They just want to use the computer for whatever tasks they have to get done and I get that. In my case I wanted to run Arch off USB and the experience (due to hardware) was poor. That drove me to discover i3. I was initially put off because it was so different - but I really like how the keyboard is a first class citizen again, and it makes the USB install usable for me.

To read a more in-depth article on using i3, check out this story.