i3 and Arch Linux, Oh My

i3 and Arch Linux, Oh My

Summary

I'm one of those people that doesn't really have a preference on desktop environments. It doesn't really matter if it's Linux, Windows, or a Mac as long as I can get to my applications. If anything, I find myself enjoying desktop environments less and less because they get in the way of applications. Enter i3, a tiling window manager that stays out of the way and maximizes productivity.

Background

Lots of people seem to like their Mac and Windows desktops since they provide a wealth of integrated features. A while back I found myself going the opposite route: I'd run most of my applications full-screen mode so I wouldn't need to interact with the desktop. I didn't want a fancy start menu, a color-coded list of applications, or super-fancy effects as I moved around the environment: I simply wanted to use the application while the desktop stays out of the way.

I then discovered tiling window managers, specifically i3. It simply lays out all of your applications so they utilize maximum screen space. Opening a terminal? It takes up 100% of that monitor. Want to open a second one? Now they both have 50% of the desktop. Two terminals, Signal Desktop, and Thunar? They each take up exactly 25% of the monitor by default. Perfect!

If this is what you're looking for, then you're in the right place.

i3 Setup

Installing the OS

I'm running i3 on Arch Linux. It isn't always the easiest to configure, so I'd highly recommend something like archi to make the process a whole lot faster. If you're looking for something a bit easier to install, try the i3 version of Manjaro. It'll make the setup much, much easier.

These are the basic packages that I install once I'm at the shell. You'll probably get prompted for questions at some point. I just say "yes" to everything or keep hitting return until the install is finished.

pacman -S pacman-contrib base-devel sudo neovim bash-completion git nmap tcpdump mlocate bind-tools tmux zsh wget

Next up is to install yay:

# First switch to a non-root user
su - username
git clone https://aur.archlinux.org/yay-git.git
cd yay-git
makepkg -si

This is totally personal preference here, but I like being able to type the command vi and have it run Neovim.

yay -S neovim-symlinks

Install i3 and Addons

I'll preface this by saying these are my preferred addons and setup. You're free to swap them out as needed. The great thing about i3 is that you can basically pick-and-choose whatever components you'd like, e.g. the web browser, file manager, chat client, etc. It's entirely up to you. I also happen to like the Dracula theme.

That being said:

yay -S google-chrome-beta lightdm-gtk-greeter ttf-meslo-nerd-font-powerlevel10k ranger rofi dunst xfce4-terminal \
lxappearance i3-wm i3lock i3blocks i3status imwheel picom scrot gimp bumblebee-status i3ipc-python \
python-tzlocal redshift dnf xorg-xbacklight network-manager-applet papirus-icon-theme ttf-opensans \
xautolock tmux thunar gvfs obs-stupid libfdk-aac gtkmm3 dracula-gtk-theme

Yes, it's a lot of components, but you'll thank me later :).

Next, copy over the configuration files. There are a bunch of them. Rather than copying and pasting everything here, I'll just include them all as a download in the commands below.

cd ~
wget https://nathanlabadie.com/uploads/i3wm-general-config.tar.gz
tar zvxf i3wm-general-config.tar.gz
cd i3wm-general-config
cp -rvf .config .local ~/
chmod +x .config/scripts/screenlock.sh

A note on that screenlock.sh script: it'll auto-lock the screen after 15 minutes. It's easy enough to change in the file. Once it's locked, you'll notice a blank screen that randomly shows a circle when you mash on the keyboard. That's the password screen :). Quit mashing on the keyboard and just type in your password to unlock.

Now we'll enable LightDM:

sudo systemctl enable lightdm

And finally we'll tweak a few settings so fonts look better:

sudo ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
sudo ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/

Lastly:

sudo reboot

Setting the GTK Theme

The last configuration tweak will be setting the GTK Theme to Dracula. I'll touch on these key combinations in a second. Hit ALT+d and you'll be presented with rofi, the closest you'll find to a start menu. Type in lxappearance and you'll see a GTK settings menu open. Choose the Dracula theme. I'd also switch the font to Open Sans 11 since it generally looks pretty good.

i3 Basics

This reference card is probably the best you'll find for i3. I have a printed copy on my desk until the key commands become muscle memory. Below are additional commands that were mapped in the configuration above. I'm using ALT as the modifier key in my setup, but you can also switch that to the WIN key if you feel that's more natural.

ALT+b = Google Chrome
ALT+return = xfce4-terminal
ALT+d = rofi, aka your start menu

Another concept that took me a second to wrap my brain around was horizontal versus vertical when it came to stacking. My mind kept going back to how they were separated, e.g. "horizontal" meaning that they're separated with a horizontal line and stacked on top of each other. That is incorrect. It's how the applications are aligned, i.e. "horizontal" means they're side by side.

i3 Demonstration

Let's say you'd like to do the following:

  1. Open Chrome and have it take up 50% of the left side.
  2. Have a terminal in the upper-right 25%.
  3. Have a file explorer in the lower-right 25%.

You'd just do the following key commands:

ALT+b = open a browser.
ALT+return = open a terminal, to the right by default.
ALT+v = the next window should be stacked vertically to above.
ALT+d = open rofi, aka the start menu
Type "Thunar" and hit return.

You could even remove rofi from there by mapping Thunar to a key command in the .config/i3/config file. This is basically the gif that's displayed near the beginning of the article.

Conclusion

There is a ton of customization that can be done with i3 to improve productivity. Just about every action can be mapped to a key command. I'd highly recommend reading through the docs until you get everything tweaked to your liking. Hope this helps!

Show Comments