lobo_tuerto's notes
Home
Blog
Notes
About

Set up Manjaro i3

Imagine no longer having to minimize, maximize, resize or rearrange any windows, ever, again. Thx i3wm. ❤️

📅Published31 August 2019Last updatedJan 2023
🏷️
i3linuxmanjaro

If you still don’t know what i3 is, please have a look at this.

Table of contents

Prerequisites

Create a live USB for Manjaro Linux —instructions here.
Then install it.

Offline set up

Things to do before connecting to the network.

Create common directories:

mkdir -p ~/tmp ~/encrypted

Make some ~/.bashrc additions:

alias ll="ls -lhF"
alias la="ls -lahF"

export HISTCONTROL=ignoredups:ignorespace
export PATH=~/bin:$PATH

export PS1="\[\e[37;1m\]\t . \[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] "

Make some ~/.profile additions:

export CALIBRE_USE_SYSTEM_THEME=1

Mount back and restore backup from FDE drive.

Set up UFW

Let’s enable a firewall:

sudo ufw enable
sudo systemctl enable --now ufw.service

Set up Google Public DNS

If you don’t like using your ISP’s DNS servers, right click the nm-applet icon at the bottom right of the screen.

Select Edit Connections…, then Wired connection 1, then click on the little gear icon.

Click on the IPv4 Settings tab.
Then on Method pick: Automatic (DHCP addresses only).

On DNS servers enter:

8.8.8.8, 8.8.4.4

Then click on the IPv6 Settings tab.
On Method pick: Automatic, addresses only.

On DNS servers enter:

2001:4860:4860::8888, 2001:4860:4860::8844

Click on Save and close the Network Manager screen.

SSH key (optional)

To create a new SSH key in ~/.ssh:

ssh-keygen -t rsa -b 4096 -C "user@some-host"

SSH service (optional)

To be able to SSH into your machine you need to enable the service for it:

sudo systemctl enable --now sshd.service

Then allow incoming SSH connections through the firewall:

sudo ufw allow SSH

Now you can ssh-copy-id a key from somewhere else.

To harden the security uncomment and modify the following lines in /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no

Whenever the /etc/ssh/sshd_config file is modified, we need to restart the SSH service with:

sudo systemctl restart sshd.service

GRUB adjustments

Let’s tweak some stuff in our grub file.
Open it with:

sudo nano /etc/default/grub

A noisy startup

To see the terminal output when booting up, remove quiet from the GRUB_CMDLINE_LINUX_DEFAULT line.

Set up dm-crypt + TRIM support

When using FDE (Full Disk Encryption) with an SSD that has TRIM support, add allow-discards to GRUB_CMDLINE_LINUX_DEFAULT like this:

GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=UUID=SOME-ID:luks-SOME-ID:allow-discards root=/dev/mapper/luks-SOME-ID resume=/dev/mapper/luks-SOME-ID"

The point of insertion is just before root=....

Whenever we change the /etc/default/grub file we should run:

sudo update-grub

Restart your system now

You should be able to use the sudo fstrim / -v command, and see an output like:

/: 439.1 GiB (471479136256 bytes) trimmed

Let’s activate a service that’ll run it weekly for us:

sudo systemctl enable --now fstrim.timer

See the service status with:

sudo systemctl status fstrim.service

If we want, we can run the service immediately with:

sudo systemctl start fstrim

Change login screen background

Look at the files available in /usr/share/backgrounds/ pick one —or copy one of your own— then change the name for that in /etc/lightdm/slick-greeter.conf.

Online set up

Things to do after connecting to the Internet.

Update and synchronize the system clock:

sudo timedatectl set-ntp true
timedatectl status

Mirror list and system update

Update the repositories mirror list:

sudo pacman-mirrors -c United_States,Canada

To update the mirror list with the fastest on a global scale:

sudo pacman-mirrors --geoip

You can tweak the ranked mirror list by:

sudo nano /etc/pacman.d/mirrorlist

Adjust to your heart’s content, then update the packages lists and download any pending updates.

sudo pacman -Syy
sudo pacman -Su

Install common desktop software

First, let’s get a decent browser:

sudo pacman -S firefox

If you are getting coredump errors when Firefox is launched, this might help with that:

sudo pacman -Rns lib32-libva-vdpau-driver libva-vdpau-driver

To see if you are getting any, open a terminal and run journalctl -b -f then launch the browser.

To change the default browser, in your ~/.profile:

export BROWSER=/usr/bin/firefox

You’ll also need to:

xdg-settings set default-web-browser firefox.desktop

If you get an error like:

xdg-settings: $BROWSER is set and can't be changed with xdg-settings

Try with:

xdg-mime default firefox.desktop x-scheme-handler/https x-scheme-handler/http

This is the list of software I usually require at one point or another:

sudo pacman -S gnote nethogs transmission-gtk nmap \
darktable gimp inkscape krita libreoffice-fresh \
blender calibre feh obs-studio openshot xfce4-settings \
aegisub clementine redshift simple-scan thunar noto-fonts-emoji \
colordiff python-gobject python-xdg unzip youtube-dl \
pa-applet pavucontrol pulseaudio pulseaudio-bluetooth \
qgis python-gdal python-owslib python-psycopg2 python-pygments \
ansible bluez bluez-utils inotify-tools jq \
i3 i3-scrot i3exit dmenu-manjaro rxvt-unicode \
lxappearance

Run lxappearance and pick a dark theme so Thunar won’t dazzle you at night. 😎

Give Redshift a try, it is pretty good!
You don’t know what I’m talking about? Have a look here.

Terminal configuration

I like rxvt-unicode.

To change the default terminal —the one you get when you press Super + Enter— add this to your ~/.profile:

export TERMINAL="urxvt"

To set the default terminal you get when right clicking in Thunar and selecting Terminal use: xfce4-settings-manager.
Default Applications -> Utilities -> Terminal Emulator -> RXVT Unicode

For fonts available in your OS, you can see the list and get the names with:

fc-list

You might need those in case you want to use a different font in urxvt.

Dark themes for urxvt

I’ve found that dracula is a pretty good dark theme for a terminal.

Download the Xresources file and rename it to: ~/Xresources.dracula.

You can try solarized too, download Xresources.dark and move to ~/Xresources.dark.

Create a ~/.Xresources file with this content:

!! TERMINAL CONFIG

! fake transparency
URxvt*inheritPixmap: true
URxvt*transparent: true
! URxvt*shading: 0 to 99 darkens, 101 to 200 lightens
URxvt*shading: 13

! fix recent issue with prompt appearing in the middle of the screen
URxvt.geometry: 80x1

! blinky cursor
URxvt.cursorBlink: true


!! SCROLL BEHAVIOUR

! do not scroll with output
URxvt*scrollTtyOutput: false

! scroll in relation to buffer (with mouse scroll or Shift+Page Up)
URxvt*scrollWithBuffer: true

! scroll back to the bottom on keypress
URxvt*scrollTtyKeypress: true

! scrollback buffer in secondary screen
URxvt.secondaryScreen: 1
URxvt.secondaryScroll: 0

! disable the scrollbar
URxvt*scrollBar: false

! lines buffer
URxvt.saveLines: 4096


!! FONT CONFIG

! set terminal font
URxvt.font: xft:Inconsolata:size=10
!URxvt.font: xft:Fira Code:size=8

! tweak font spacing
URxvt.letterSpace: -1


!! CURSOR CONFIG

! magenta cursor color
URxvt.cursorColor: magenta


!! COLOR THEME

! load solarized dark theme
!#include "Xresources.dark"

! load dracula dark theme
#include "Xresources.dracula"

All the stuff with a ! at the beginning is a comment.

Make changes effective with:

xrdb ~/.Xresources

Then open a new terminal with Super + Enter and voilà. 🎉

Setting up i3

After installing i3 you can select the window manager you want to use from the login screen.

Let’s tweak come config files a lil’ bit so it’s more useful and looks better.

In ~/.config/i3status/config:

# i3status configuration file.
# see "man i3status" for documentation.

# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!

general {
        colors = true
        interval = 5
        color_good = "#2AA198"
        color_bad = "#586E75"
        color_degraded = "#DC322F"
}

order += "memory"
order += "cpu_usage"
order += "load"
order += "disk /"
# order += "disk /home"
order += "wireless _first_"
order += "ethernet _first_"
# order += "battery all"
order += "tztime local"
# order += "ipv6"

memory { format = "  🐏  %used / %total  " }

cpu_usage {
        format = "    %usage  "
}

load {
        format = "    %1min  "
        # max_threshold = 0.3
}

disk "/" {
        # format = " hdd %avail "
        format = "    %avail  "
}

ethernet _first_ {
# if you use %speed, i3status requires root privileges
        format_up = "    %ip  %speed  "
        format_down = "  No    "
}

wireless _first_ {
# if you use %speed, i3status requires root privileges
        format_up = "    %ip  %speed  "
        format_down = "  No    "
}

battery all {
        # format = "%status %percentage %remaining %emptytime"
        format = " %status %percentage"
        format_down = "No battery"
        last_full_capacity = true
        integer_battery_capacity = true
        # status_chr = ""
        status_chr = "⚡"
        # status_bat = "bat"
        # status_bat = "☉"
        status_bat = ""
        # status_unk = "?"
        status_unk = ""
        # status_full = ""
        status_full = "☻"
        low_threshold = 15
        threshold_type = time
}

tztime local {
        # format = "%Y-%m-%d %H:%M:%S"
        # format = "%H:%M:%S %Z »«  %A, %d de %B de %Y"
        format = "  %A    %Y / %m / %d       %H: %M: %S      "
}

In ~/.config/i3/config, at the end add:

# CUSTOM STUFF

# Move to workspace with focused container
bindsym $mod+Ctrl+1 move container to workspace $ws1; workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2; workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3; workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4; workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5; workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6; workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7; workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8; workspace $ws8
bindsym $mod+Ctrl+9 move container to workspace $ws9; workspace $ws9

# Set shut down, restart and locking features
bindsym $mod+0 mode "$mode_system"
set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown
mode "$mode_system" {
    bindsym l exec --no-startup-id i3exit lock, mode "default"
    bindsym s exec --no-startup-id i3exit suspend, mode "default"
    bindsym u exec --no-startup-id i3exit switch_user, mode "default"
    bindsym e exec --no-startup-id i3exit logout, mode "default"
    bindsym h exec --no-startup-id i3exit hibernate, mode "default"
    bindsym r exec --no-startup-id i3exit reboot, mode "default"
    bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"

    # exit system mode: "Enter" or "Escape"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

# Open specific applications in floating mode
for_window [class="Pavucontrol"] floating enable border normal

# Configure border style <normal|1pixel|pixel xx|none|pixel>
default_border pixel 1
default_floating_border normal

# change borders
bindsym $mod+u border none
bindsym $mod+y border pixel 1
bindsym $mod+n border normal

# Start Applications
#bindsym Print exec --no-startup-id i3-scrot
#bindsym $mod+Print --release exec --no-startup-id i3-scrot -w
#bindsym $mod+Ctrl+Print --release exec --no-startup-id i3-scrot -w -d 5
#bindsym $mod+Shift+Print --release exec --no-startup-id i3-scrot -s
bindsym Insert exec --no-startup-id i3-scrot
bindsym $mod+Insert --release exec --no-startup-id i3-scrot -w
bindsym $mod+Ctrl+Insert --release exec --no-startup-id i3-scrot -w -d 5
bindsym $mod+Shift+Insert --release exec --no-startup-id i3-scrot -s


# Set up workspace default output
workspace 1 output DP-2
workspace 2 output DP-2

workspace 7 output DP-0
workspace 8 output DP-0


# To get the right values for the two or one monitor setup, run `xrandr`.

# Two monitor setup
exec --no-startup-id xrandr --output DP-2 --primary --mode 3440x1440 --pos 0x560 --rotate normal --output DP-0 --mode 2560x1440 --pos 3440x0 --rotate left --output DVI-D-0 --off --output HDMI-0 --off --output HDMI-1 --off

# One monitor setup
#exec --no-startup-id xrandr --output HDMI-0 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output HDMI-1 --off --output DVI-D-0 --off --output DP-1 --off --output DP-2 --off

# Wallpapers
exec_always --no-startup-id feh --recursive --randomize --bg-fill ~/.wallpapers

# Bind volume related keys
bindsym $mod+Shift+Prior exec --no-startup-id amixer -D pulse sset Master 2%+
bindsym $mod+Shift+Next exec --no-startup-id amixer -D pulse sset Master 2%-
bindsym $mod+Shift+Delete exec --no-startup-id amixer -D pulse sset Master toggle

# Desktop stuff
#exec --no-startup-id /usr/lib/geoclue-2.0/demos/agent
#exec --no-startup-id redshift-gtk
exec --no-startup-id redshift -x && redshift -O 4500
exec --no-startup-id blueman-applet

exec --no-startup-id pa-applet
exec --no-startup-id xfce4-power-manager


# NO LONGER USED
#bindsym XF86AudioMute exec --no-startup-id amixer -D pulse sset Master toggle

# Bind clementine player related keys
#bindsym $mod+Prior exec --no-startup-id clementine --prev
#bindsym $mod+Next exec --no-startup-id clementine --next
#bindsym $mod+Home exec --no-startup-id clementine --play
#bindsym $mod+End exec --no-startup-id clementine --stop
#bindsym $mod+Delete exec --no-startup-id clementine --play-pause

Configure Calibre styling

Let’s tweak Calibre a little bit now.

Open any book, then right click anywhere to make the main menu appear.

Go into Preferences -> Styles and paste this in the box:

body {
  line-height: 2;
}

Go into Preferences -> Colors and pick: Sepia dark or System.
Also set Override all book colors to In dark mode.

For adding visual cues about book progress:

Go into Preferences -> Headers and footers

For the Header:

  • Left: Top level section
  • Middle: Current section

For the Footer:

  • Left: Progress
  • Middle: Pages in chapter
  • Right: Position in book

To increase the font size a bit:
Go into Font size and click on the desired font size (20px).

To specify the number of pages per screen:
Go into Preferences -> Page layout
Change the values in Portrait and/or Landscape

Network printing with CUPS

To enable CUPS:

sudo pacman -S cups
sudo systemctl enable --now cups.service

Access http://localhost:631 and add your printer.

For me using the driverless option works just fine —then driverless, cups-filters

Software development stuff

Now let’s install some useful tools that every software developer worth their salt should have. 😛

Set up z

With Git installed by default, let’s bring z to easily navigate directories on the CLI:

git clone https://github.com/rupa/z ~/z
echo ". ~/z/z.sh" >> ~/.bashrc
exec $SHELL

Its usage is super simple, after cding into various directories:

cd ~/development/web/project1
cd ~/development/mobile/client33

You can now cd into those directories from anywhere on the CLI with:

z project1
z client33

Stuff to install and set up

GRASS for QGIS

To have v.generalize available on QGIS:

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

Godot engine

Fancy some gamedev?

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

VirtualBox

You’ll need to enable CPU Virtualization in your BIOS.

sudo pacman -S virtualbox virtualbox-guest-iso

You’ll be presented with some options:

:: There are 11 providers available for VIRTUALBOX-HOST-MODULES:
:: Repository extra
   1) linux316-virtualbox-host-modules  2) linux414-virtualbox-host-modules  3) linux419-virtualbox-host-modules
   4) linux44-virtualbox-host-modules  5) linux49-virtualbox-host-modules  6) linux51-virtualbox-host-modules
   7) linux52-virtualbox-host-modules  8) linux53-virtualbox-host-modules
:: Repository community
   9) linux419-rt-virtualbox-host-modules  10) linux52-rt-virtualbox-host-modules  11) virtualbox-host-dkms

Enter a number (default=1):

Pick the host modules that match your kernel version.
You can find out which kernel version you have with:

uname -a

Once you are done with the installation get into your VM and you can adjust the screen size with:

xrandr --output Virtual1 --mode 1920x1200

Using VirtualBox in i3 can be daunting, but it works really well.
You can resize floating dialogs by pressing the right mouse button and dragging from a corner.

Misc stuff

Random stuff that we might need at one point or another…

Chromecast & Videostream

Add the Videostream for Google Chromecast extension.

You need to set up a couple of rules if you have a Chromecast and want to cast videos from your PC:

For a specific IP

Assuming your Chromecast is on 192.168.1.66 you’d need to add these:

sudo ufw allow from 192.168.1.66 to any port 5556
sudo ufw allow from 192.168.1.66 to any port 5558

For any IP in the subnet 192.168.1.x

If your Chromecast changes IP frequently —because you disconnect it or otherwise— it might be easier to allow all devices on your subnet:

sudo ufw allow from 192.168.1.0/24 to any port 5556
sudo ufw allow from 192.168.1.0/24 to any port 5558

Here are some examples of how these rules apply given some CIDR notations:

192.168.1.0/24 => 192.168.1.x
192.168.0.0/16 => 192.168.x.x
192.0.0.0/8 => 192.x.x.x

Videostream won’t start in Chrome

OK, according to my notes, the latest version it was known to work with was:

* 44a87c7 google-chrome-stable v99.0.4844.84

So, to compile and install that specific version:

git clone https://aur.archlinux.org/google-chrome.git
cd google-chrome/
git co 44a87c7
makepkg -si

That’s all for now! 🎉

Resources


Got comments or feedback?
Follow me on
v-3ab054c