Setting up I3-wm (just the basics)

Setting up I3-wm (just the basics)

Obviously, I don’t know if you’ve just installed Arch Linux from my rather long guide, but if you did, you are probably sitting there going: “Well.. What should I do now?”. It’s a good qustion. It’s hard to get started when you don’t know what is possible in this new and fascinating system. Let me help you setup a Graphic User Interface (GUI) and a few applications.

Now, there are a lot of different GUIs out there and presumably most of them have a hardcore devoted crowd which makes it kinda hard to discuss which is best. Do you want a nice, and sexy GUI or are you looking for productivity? How about productivity and sexy? Well.. The safest option is to try most of them and get a feel of what is right for you. Personally, I’m a tiling-GUI kinda guy. Tiling you say? Yes! You know when you open a window, and it takes up 20% of the screen somewhere random? Maybe 50% in the middle or attached to one of the sides. In my opinion this is not productive. Most of the time i start by maximizing a window or move it somewhere else. Instead, tiling window managers are GUIs where each window takes up as much space as possible. E.g. you only have one window? Then it takes up 100%. You have two? Then they are divided equally across the screen and so on. This is quite cool because you don’t really have to move windows around or manage their size. They are already using all of that sweet screen real estate, which is amazing! Now, there are more than one tiling window manager, but my weapon of choice is currently i3-wm. Or.. really it’s i3-gaps, but let’s keep it simple. In my opinion i3 has everything that you would want of a tiling window manager. It’s super light, highly configurable, and extremely fast.

How do we go about installing i3? Well, in my install-guide I didn’t tell you about the importance of creating another user for the system. This means that currently everything that you do on your system is done via the superuser (root). For security reasons this is not preferable and we need to create another user which also has some root privileges. In the following command I’ll just name the user “USER”. You should change this to what you want your user to be called. If you want to know more about this process you should look at the Arch wiki.
useradd -m -g wheel -s bin/bash USER

We also need to set a password for our new user. This should not be the same password as your choose for your root.
passwd USER

Moreover, we also need to give the user root privileges. This is done by editing visudo
EDITOR=nano visudo

Scroll down to where is says “Uncomment to allow members of group wheel to execute any command” and delete the hashtag in the line below
%wheel ALL=(ALL) All

Now that you have added your user and set privileges, it’s time to logout from root and in with your new user

You are now presented with a login screen. Please login with the newly created user. Now, I’m not sure if you have tested your internet after booting up in this new install so start by sending a ping to google
ping -c 3

If you are on wifi and you haven’t used it yet, then you need to set it up first. This will create a profile for the wifi which you are currently using.
sudo wifi-menu -o

Now we need to install xorg, i3, and the status bar. I have also added a few other applications to install, which I’ll cover later on. Note we now need to use sudo since we are installing applications which has to write files outside the home directory of the user. This means that you will also need to apply your password. I will explain the flags (-S) later on since they are quite essential for Linux in general.
sudo pacman -S xorg xinit i3-wm i3status i3lock dmenu

You will be given some different selections but if you don’t know which to select then select the default.

Okay, back to i3. Now we need to tell xorg which GUI to load
nano .xinitrc

In this file you only need to add the following
exec i3

Then save (ctrl+o) and quit (ctrl+x)

Now your start i3 with the command

There you go. This is the super basic i3-experience. But it can be customized a lot! However let’s go into some of the basics for using this window manager. First you will notice that you are asked to select which “mod key” you want to use – either ALT or WIN/CMD. I would suggest you choose “WIN” since the alt-key is used in a lot of applications and we don’t want to mess with that. The modkey is what you use to control I3. E.g. you can start a terminal with mod+enter – cool right (What? No terminal shows up? Check out the Q/A in the bottom of this post). Quit the current window with mod+q. Search for a file or application with mod+d. However, we don’t really have any applications at the moment, press ESC, so let’s install some basic ones that you would probably like. First start a terminal (mod+enter)
sudo pacman -S chromium libreoffice-still weechat tmux feh vim

Now you can start chromium by pressing mod+d and typing chromium. Notice that dmenu searches according to what you write. Cool. To chose an application make sure it’s selected with the blue color. You can more around the different suggestions with your left/right arrow. Start the chosen applications by pressing enter. Notice when you start chromium the screen is divided in two and chromium now takes up half of the screen. Very cool. Maybe your screen isn’t big enough to show everything because of a small screen? No problem. Just move the window to another workspace. Make sure chromium is selected and press mod+shift+2. Now a new workspace has become active in the statusbar at the bottom of the screen. Press mod+2 to access that workspace. Chromium now takes up 100% of that workspace.
This is indeed the basics or moving around in i3 and there are a butt load of other key combinations you should learn. Therefore, we’ll open up the i3-config. Start a new terminal (mod+enter) or move back to the terminal on workspace 1 (mod+1)
nano .config/i3/config

In this file you can see all the key combinations of I3 – endless possibilities man. You can change just about everything in here, but be careful since you can really mess it up. However, if you do, i3 will warn you and tell you in which line is out of order. Very very cool. Actually there are so many possibilities that I can’t possible cover them in one post. However, I will in a later post give some suggestions to how you can change some things and make I3 a bit more sexy.

First of all you could set a wallpaper? Sounds good – great. First head on back to workspace 2 where chromium is waiting for you (mod+2) then find a nice wallpaper and download is to your home directory. Earlier we installed feh which we are going to use to set the wallpaper. Let’s change that background. Go back to workspace 1 (mod+1) and type the following command in your terminal
feh --bg-fill /home/$USER/wallpaper.jpeg


But this will only set the wallpaper for the current session. If you reboot your computer or kill i3, the wallpaper will be gone. Sucks. However, the wallpaper can be set permanently if you configure i3 to set it at each start. Where do we do this? In the I3-config of course. Find your terminal and enter the config file
nano .config/i3/config

Now move to the bottom of the file and insert this line
exec_always feh --bg-fill /home/$USER/wallpaper.jpeg

Presto. The wallpaper will be the same after each reboot.

Okay. That’s most of the basics. Now you can browse the internet, set wallpapers and you know where to change the settings in i3. Let’s go back to the flags in the commands earlier.

What is up with all the flags?

You might notice the S-flag and wonder what it does. Yeah. You should really read the manual for pacman
man pacman

In the manual you will be presented to a description of the program and further down the man-page there is a list of operators (flags). To quit out of the man-pages press “q”. Many of the man-pages list some really incredible features so when you have the time it’s always fun to read through a man-page about an application. E.g.
man ls

You also installed libreoffice earlier, but how did I know that the libreoffice-package was called -still? Well, you should look at the man-page for pacman again because it also has a search-function
pacman -Ss libreoffice

Initial troubleshooting
Q: No terminal?
A: Quit out of i3 (mod+shift+e). And install a terminal And then start X again.
sudo pacman -S rxvt-unicode

Open your i3-config
nano ~/.config/i3/config

Add “urxvt” after “exec” in line 12 and then start x again.

Q: The stupid letters in the terminal are on top of each other?
A: Download the inconsolate font and insert this line in Xdefaults. However this requires that you add the AUR. I’ll cover this in a post soon. It’s really easy.
echo urxvt*font: xft:Inconsolate:pixelsize=16 > .Xdefaults

That’s about it. Good luck with I3 and please comment if you have any problems.