This post details bits and bobs from my i3 window manager setup. This guide is by no means a limit of what you can achieve. It details the boilerplate that enables a comfortable base for experimenting. It is up to you to get your setup the way you like. It is heavily influenced by what you will find in my dotfiles.

(And of course, this is a great reminder for me when I forget package names that I need to install.)

Graphics drivers

If you have not run a graphical interface on your system yet, you probably need to install a driver for your graphics hardware.

pacman -Ss xf86-video

E.g. if you have an Intel machine, you will want to install xf86-video-intel.

Xorg

You must have Xorg installed too.

pacman -S xorg xorg-xinit

Fonts

Personally, I am happy using Google Noto fonts. Feel free to install whatever you like. See ArchWiki for a list of fonts available.

pacman -S noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra

Terminal

I personally use termite, but if you want something simple to use without having to spend ages configuring, you should probably install gnome-terminal.

i3wm and dmenu

Now it’s time to install the window manager itself. Also, as a bonus, dmenu. That will allow starting programs and executing commands in your i3 environment. It is part of the suckless project. Check it out if you have not heard of it.

pacman -S i3-wm i3lock i3status dmenu

~/.xinitrc file

This is a file that contains commands that start i3wm. You need to create it yourself.

#!/bin/sh -e
exec i3

Make the file executable.

chmod +x ~/.xinitrc

Start i3

startx

After you type the command, you should see your desktop. It will ask you whether you want a default config or not. I suggest you use the default config as it provides a good base to start from.

GNOME keyring

For passwords and SSH passphrases being saved, I recommend using GNOME Keyring.

pacman -S gnome-keyring libsecret libgnome-keyring

To start the GNOME Keyring, I suggest you edit your ~/.xinitrc file again.

#!/bin/sh -e

# Start D-Bus and GNOME keyring
dbus-update-activation-environment --systemd DISPLAY
export $(dbus-launch)
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
export SSH_AUTH_SOCK

# Start i3wm
exec i3

To manage the keyring via a graphical user interface, I suggest installing seahorse. It’s sometimes useful to debug passwords and tokens saved by your applications.

Java apps problems

If you are planning to run Java apps, set the environment variable in your environment export _JAVA_AWT_WM_NONREPARENTING=1. Personally, I set it inside ~/.xinitrc.

Network manager applet

If you use NetworkManager and want to have a graphical non-faff way of connecting to new networks from your system tray, I suggest you use the network manager applet.

pacman -S network-manager-applet

To start this together with i3, add the following line to your config.

# ~/.config/i3/config
exec --no-startup-id nm-applet

Mounting disks

If you want an automatic mounting disks, I suggest udiskie.

pacman -S udiskie

To start this when you log in, please add the following to your i3 config.

exec --no-startup-id udiskie --tray

Clipboard

I love using clipmenu that uses dmenu interface.

pacman -S clipmenu clipnotify

To use it, set up two things in the i3 config.

bindsym $mod+c exec clipmenu -i
exec --no-startup-id clipmenud

mod+c will open the clipmenu.

To clear the clipboard, use:

clipdel -d .*

Audio

Install relevant packages:

pacman -S pulseaudio pavucontrol

Now set up PulseAudio to start together with i3:

# ~/.config/i3/config
exec --no-startup-id start-pulseaudio-x11

I suggest binding volume keys:

# ~/.config/i3/config
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +6%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle

I also bind pavucontrol to a key so I can easily change sound settings.

# ~/.config/i3/config
bindsym XF86Tools exec --no-startup-id pavucontrol

Bonus - disable annoying bell noise

# ~/.config/i3/config
exec --no-startup-id xset -b

Audio & video codecs

Install various codes.

pacman -S gst-libav gst-plugins-bad gst-plugins-ugly gst-plugins-good gst-plugins-base

Brightness

# ~/.config/i3/config
bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 10
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 10

Multiple screens

I use an AUR package called mons for configuring multiple screens. I recommend you trying it out if you look for a minimalistic solution for managing your screen configuration. It is especially useful for laptop users as it detects when screens are unplugged and makes sure that always at least one screen is enabled.

cd /tmp
git clone https://aur.archlinux.org/mons.git
cd mons
makepkg -si

It needs to be started together with i3 if you want it to automatically detect if there’s at least a single screen active whenever you unplug a screen cable.

# ~/.config/i3/config
exec --no-startup-id mons -a

Then you can bind keys to trigger a change. I use the following. It’s enough for simple set ups.

# ~/.config/i3/config
bindsym XF86Display exec --no-startup-id mons -n right

See the usage guide of mons for more configuration options.

Screen lock & sleep

I use a combination of i3lock and xss-lock.

pacman -S xss-lock i3lock

My lock script looks as follows:

#!/bin/sh
set -x
revert() {
    # Disable screen blanking.
    xset dpms 0 0 0
    xset -dpms
}

trap revert HUP INT TERM

# Set screen to blank after 5 seconds while on a lock screen.
xset +dpms dpms 5 5 5
xset dpms force suspend

# Active the lock
i3lock -n

# Run the following function after the screen has been unlocked.
revert

I suggest you place that script in ~/bin/lock.sh. Make it executable with chmod +x ~/bin/lock.sh.

I use xss-lock to detect when the screen turns off and it turns on the lock.

# ~/.config/i3/config
exec --no-startup-id xss-lock -l -- ~/bin/lock.sh --nofork

I bind the two keys that force screen to turn off which effectively triggers the lock.

# ~/.config/i3/config
bindsym $mod+shift+ctrl+l exec --no-startup-id xset dpms force suspend
bindsym XF86ScreenSaver exec --no-startup-id xset dpms force suspend

I also make power key suspend only - useful for laptops.

# ~/.config/i3/config
exec --no-startup-id systemd-inhibit --what=handle-power-key sleep infinity
bindsym XF86PowerOff exec --no-startup-id systemctl suspend

Music

I use a handy utility called playerctl to play and pause music. It sends commands via the MPRIS D-Bus interface that is supported by most music players such as Spotify, cmus, Lollypop or Rhythmbox.

pacman -S playerctl

Then you can set up key binds to control your music player.

# ~/.config/i3/config
bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
bindsym XF86AudioNext exec --no-startup-id playerctl next
bindsym XF86AudioPrev exec --no-startup-id playerctl previous

Screenshot

Simple all-in-one solution? Just use flameshot and save yourself a hassle.

pacman -S flameshot

I personally bind three different keys.

  • Print for saving a screenshot to a folder
  • Ctrl+print for saving a screenshot to clipboard
  • Shift+print for opening flameshot GUI that lets you select an area and do modifications to your screenshot.
# ~/.config/i3/config
set $screenshots_directory ~/Pictures/screenshots/
exec --no-startup-id mkdir -p $screenshots_directory
bindsym Print exec --no-startup-id flameshot full --path $screenshots_directory
bindsym Ctrl+Print exec --no-startup-id flameshot full --clipboard
bindsym shift+Print exec --no-startup-id flameshot gui --path $screenshots_directory

Recording video

pacman -S simplescreenrecorder

Notifications

Dunst is the way.

pacman -S dunst

Add the start-up command to your i3config.

# ~/.config/i3/config
exec --no-startup-id dunst

Copy the default config that you can customise if you want to.

cp /usr/share/dunst/dunstrc ~/.config/dunst/

Image browser

It is a good idea to have something to view image files. I personally use Xfce’s Ristretto. I do like using feh too.

pacman -S ristretto

File manager

I use Nemo which is a fork of GNOME files.

pacman -S nemo nemo-fileroller nemo-preview nemo-seahorse nemo-share gvfs-nfs gvfs-smb gvfs-mtp gvfs-afc gvfs-gphoto2

Create home directories

pacman -S xdg-user-dirs
xdg-user-dirs-update

Allow using trash from command line

I use the trash-cli utility that allows me use trash from a terminal conveniently.

pacman -S trash-cli

Commands are:

trash-put           trash files and directories.
trash-empty         empty the trashcan(s).
trash-list          list trashed files.
trash-restore       restore a trashed file.
trash-rm            remove individual files from the trashcan.

Printing

Install CUPS (the printing server) and drivers that should work for a vast amount of printer models.

pacman -S cups cups-pdf
pacman -S ghostscript foomatic-db foomatic-db-engine foomatic-db-nonfree gutenprint foomatic-db-gutenprint-ppds

Enable cups serice

systemctl enable org.cups.cupsd.service
systemctl start org.cups.cupsd.service

Now you can use a web interface to set up your printers. Please go to http://localhost:631/.

Set up Avahi - for network printers

To discover network printers for CUPS you must use Avahi that will allow discovery of the devices on the network.

First you must disable systemd’s mDNS resolver.

systemctl stop systemd-resolved.service
systemctl disable systemd-resolved.service

Then you should install Avahi.

pacman -S avahi nss-mdns

Configure hostname resolution for local domains. Edit /etc/nsswitch.conf to include mdns_minimal [NOTFOUND=return] before resolve and dns in the hosts line.

Now start Avahi.

systemctl enable avahi-daemon.service
systemctl start avahi-daemon.service

Bluetooth

Install Bluetooth tools.

pacman -S blueman pulseaudio-bluetooth bluez bluez-utils

Enable the system service that will start Bluetooth on system boot.

systemctl enable bluetooth
systemctl start bluetooth

To start Blueman tray icon together with i3 add the following to the i3 config:

# ~/.config/i3/config
exec --no-startup-id blueman-applet

Screen timeout

I suggest you start with having no screen blanking at all and at some point make it more robust if you want to. It is a good starting point as a default if you ask me.

# ~/.config/i3/config
exec --no-startup-id xset dpms 0 0 0
exec --no-startup-id xset -dpms
exec --no-startup-id xset s 0 0
exec --no-startup-id xset s off

PDF

I use web browser as my PDF reader.

xdg-mime default google-chrome.desktop application/pdf

Resources

Generally, most helpful sources about i3 and related topics are: