Arch Linux - Installing i3

This post is the continuation of the previous post Arch Linux - Base Installation. Here we are installing X and i3 window manager. Then we install most of the necessary programs that I use daily and configure them. Feel free to skip not relevant steps to you.

Apart from the above, we also add some additional steps that conclude previous blog process, like enabling the Network Manager.

Install graphic drivers and X

My laptop has Intel graphics, so below command installs Inter graphic drivers and X packages

pacman -S xorg-server xorg-xinit xorg-xinput xorg-xrandr xorg-xdpyinfo xf86-video-intel lib32-mesa-libgl 

Install touchpad and Network Manager

pacman -S xf86-input-libinput networkmanager network-manager-applet

Audio controls

This will be used with Polybar, so we can control audio from the panel.

pacman -S pasystray pavucontrol paprefs

Enable Network Manager

systemctl enable NetworkManager

Install packages

Here I install most of the packages that I will require in day to day use

pacman -S net-tools bash-completion gstreamer gst-plugins-ugly libmad zsh git nodejs yarn composer
cups cups-pdf ghostscript gsfonts gutenprint dosfstools ntfsprogs tlp reflector pulseaudio
pulseaudio-alsa alsa-utils vim wget cmake rsync mongodb-tools python-greenlet zathura
zathura-pdf-mupdf calcurse chromium gnome-keyring libgnome-keyring zip unzip
python-virtualenvwrapper perl-anyevent-i3 perl-json-xs

Login as your user

Some of the steps below will use yay AUR wrapper, which is discouraged to be used as root user, so we can safely log in now as normal user and use sudo commands if we require root access. So log out and log back in.

Install yay

I choose to use yay AUR package manager. Execute below to install it and clean up after.

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay

Mirrorlist

In one of the previous steps we installed Mirrorlist. This package generates the most up-to-date packages for Arch Linux, but also has a flag to rank mirrors. I use it to rank the quickest ones for my location. First backup your current mirrors and then replace them with Reflector:

sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.BAK
sudo reflector –verbose -l 5 –sort rate –save /etc/pacman.d/mirrorlist

Enable some services

Here we enable TLP, Linux power manager and printing services

sudo tlp start
sudo systemctl enable org.cups.cupsd.service
sudo gpasswd –add haon lp
sudo gpasswd –add haon sys

Preload

Preload used to speed up program execution

yay preload –noconfirm
sudo systemctl enable preload

oh my zsh

oh my zsh is popular zsh framework. I use it for command history autocompletion as well as git aliases when in terminal.

curl -L http://install.ohmyz.sh | sh
chsh -s /bin/zsh

To install auto-completion plugin we need to log out and log back in. Then execute below:

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

SSH keys

This step is optional. I copy all of my work and personal SSH keys to ~/.ssh folder and change their permissions

chmod -R 700 ~/.ssh
chmod 600 ~/.ssh/*
chmod 644 ~/.ssh/.pub
chmod 400 ~/.ssh/.pem

Start i3 awesomeness

Here we start to install i3 and all packages that will complement the workflow. See the links for more info:

compton, rofi, feh, termite, awesome-terminal-fonts, lxappearance, scrot, pcmanfm, gvfs, dunst, nitrogen, imagemagick

sudo pacman -S i3 compton rofi feh termite awesome-terminal-fonts lxappearance scrot pcmanfm gvfs dunst nitrogen imagemagick

Polybar

I use Polybar rather than default i3status.

yay polybar –noconfirm

Betterlockscreen

I use betterlockscreen rather than default i3lock

yay betterlockscreen –noconfirm

Laptop screen brightness

Light is app to control backlight

yay light-git –noconfirm

Login manager

I do not use any login managers, so below steps will configure Arch Linux to auto login my user, start X and start i3 automatically resulting in me seeing my desktop without the need to first login. Proceed with caution. Think what would happen if your laptop is lost or stolen. I still have no answer to it, by my laptop is like a gem so I guard it :D

sudo vim /etc/systemd/system/getty.target.wants/getty@tty1.service
Replace ExecStart to look like this (replace USERNAME with your user)
ExecStart=-/sbin/agetty -a USERNAME ? %I $TERM
Now we setup X to start i3
cp /etc/X11/xinit/xinitrc ~/.xinitrc
vim ~/.xinitrc
Add the following towards the end of the file
xscreensaver &
exec i3
Because we use zsh, create ~/.zprofile with the following to make this all work
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec startx
fi

FINISH

That’s it. You can take it from here or you can follow my next post to have solarized-dark i3 system.