Philipp’s Blog

A Simple Linux Setup

I recently needed to re-install my laptop. I wanted to document the setup process for myself. Maybe someone will find this interesting.

This will cover the post-installation customization of a fresh Debian 13 installation.

Setup sudo

To be able to run commands as root you need to install sudo:

apt install sudo

Add your user to /etc/sudoers/:

echo 'user ALL=(ALL)   ALL' >> /etc/sudoers

To log out of the tty type exit. Now log in with your normal user.

Package Install

Firstly install the X11 components as well as some extra utilities:

sudo apt install xserver-xorg-core xserver-xorg-video-intel xserver-xorg-input-evdev x11-xserver-utils x11-xkb-utils x11-utils xinit xserver-xorg-input-libinput

Install i3 and some essentials:

sudo apt install i3 i3lock-fancy alacritty firefox-esr git network-manager network-manager-applet libnotify-bin notify-osd dunst arandr

I also like to install these extra programs:

sudo apt install nvim htop fastfetch unclutter zip unzip curl maim xdotool xclip rsync jq hugo sensors xcompmgr libreoffice libreoffice-gtk3 hunspell-en-us hunspell-de-de keepassxc zathura pcmanfm thunderbird mpv mpv-mpris playerctl nsxiv syncthing

Run sudo systemctl enable syncthing@$USER.service to Syncthing automatically start at login.*

Configure NetworkManager

You will want to replace Debians own network stack implementation with NetworkManager:

sudo systemctl stop networking.service
sudo systemctl disable networking.service
sudo systemctl restart NetworkManager

If you want to setup your existing dotfiles, it would be easiest to do it now.

X11 Configuration

Create ~/.xinitrc with the following content:

#!/bin/sh
exec i3

Type startx to start the X session.

On the first run of i3 you will be asked to generate the default config. Press Enter to to that and to choose your modifier key after that.

To automatically start the X session when you log into the tty, add this to ~/.profile:

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
    exec startx
fi

Altough the installer asks for the keymap during the install process, the X session does not pick it up. Edit /etc/X11/xorg.conf to persist the keymap for X sessions:

Section "InputClass"
    Identifier  "Keyboard Default"
    MatchIsKeyboard "yes"
    Option      "XkbLayout" "de"
EndSection

Audio

Getting audio to work is quite straightforward. Install the required packages:

sudo apt install pipewire pipewire-audio-client-libraries pipewire-pulse wireplumber pulseaudio-utils pulsemixer

Enable the services:

systemctl --user --now enable pipewire pipewire-pulse wireplumber

The default volume bindings do work out of the box, but they allow you to raise the volume above 100%. To avoid this I like to use pulsemixer with the following bindings:

bindsym XF86AudioRaiseVolume exec --no-startup-id pulsemixer --change-volume +10 --max-volume 100
bindsym XF86AudioLowerVolume exec --no-startup-id pulsemixer --change-volume -10 --max-volume 100

To apply your changes press Mod+Shift+c (This reloads your i3 config).

I also like to swap the bindings for reload and restart, so reloading the config is done with M̀od+Shift+r.

Font

You probably want to use a custom nerd font for your terminal, bar and launcher (a nerd font is a programming-focussed font that does include many extra icons). Firstly, create the fonts directory:

mkdir -p ~/.local/share/fonts

Download the font, unzip it and remove unused files:

wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.5.1/Iosevka.zip

unzip Iosevka.zip -d ~/.local/share/fonts/

rm ~/.local/share/fonts/*.md
rm Iosevka.zip

Update the font cache:

fc-cache -fv

Edit the i3 config file (~/.config/i3/config) to change the font for the bar and launcher:

font pango:Iosevka Nerd Font Propo 10
...
bindsym $mod+d exec --no-startup-id "dmenu_run -nf '#BBBBBB' -nb '#000000' -sb '#005577' -sf '#EEEEEE' -fn 'IosevkaNerdFontPropo-10'"

Dark mode

Install the required packages for dark mode:

sudo apt install gnome-themes-extra gsettings-desktop-schemas qt5ct qt6ct qt5-gtk-platformtheme adwaita-icon-theme gsettings-desktop-schemas

Create the config directories for the GTK settings:

mkdir -p ~/.config/{gtk-3.0,gtk-4.0}

Add the GTK settings file(~/.config/gtk-3.0/settings.ini):

[Settings]
gtk-theme-name = Adwaita-dark
gtk-application-prefer-dark-theme = true

Copy the GTK 3 settings to 4 as well:

cp ~/.config/gtk-3.0/settings.ini ~/.config/gtk-4.0/settings.ini

Add the QT theme exports to ~/.xprofile:

export QT_QPA_PLATFORMTHEME=qt5ct
export QT_STYLE_OVERRIDE=kvantum

To load ~/.xprofile at the start of a X session, add the following to ~/.xinitrc (at the top):

[ -f ~/.xprofile ] && . ~/.xprofile

Alacritty Customization

Change $mod+Return keybinding to open alacritty:

bindsym $mod+Return exec alacritty

Create the alacritty config directory:

mkdir -p ~/.config/alacritty/

Create the alacritty config (~/.config/alacritty/alacritty.toml):

[window]
opacity=1
[window.padding]
y = 6 
x = 6  

[font]
normal = { family = "Iosevka Nerd Font Propo", style = "Regular" }
size = 10

To add a custom color scheme head to https://github.com/alacritty/alacritty-theme and grab a theme you like. Add it below the [font] block.

Notifications

To recieve notifications you need to add a notification deamon (dunst) to autostart with the X session. Edit ~/.xinitrc:

dunst &

You may also want to style the notification banner. Create the config directory:

mkdir -p ~/.config/dunst

Create the configuration file ~/.config/dunst/dunstrc:

monitor = 0
follow = keyboard
width = (0, 512)
height = (0, 315)
frame_width = 3
offset = (20, 43)
padding = 15
horizontal_padding = 15
transparency = 0
font = Iosevka Nerd Font Propo 8
format = "<b>%s</b>\n%b"

[urgency_low]
background = "#222222"
foreground = "#e0e0e0"
frame_color = "#444444"
timeout = 3

[urgency_normal]
background = "#222222"
foreground = "#e0e0e0"
frame_color = "#444444"
timeout = 5

[urgency_critical]
background = "#222222"
foreground = "#e0e0e0"
frame_color = "#cc241d"
timeout = 10

Brightness (Laptop only)

If you are on a laptop you can use brightnessctl to chnage the brightness of your internal screen. Install it:

sudo apt install brightnessctl

Add to the i3 config:

bindsym XF86MonBrightnessUp exec brightnessctl set +5%
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-

Better audio bindings

i3 has bindings for volume and mute that work out of the box, but they allow you to raise your volume above 100%. To avoid this i like to use pulsemixer with the following bindings:

bindsym XF86AudioRaiseVolume exec --no-startup-id pulsemixer --change-volume +10 --max-volume 100
bindsym XF86AudioLowerVolume exec --no-startup-id pulsemixer --change-volume -10 --max-volume 100

Bluetooth

If you want to use bluetooth install the following packages:

sudo apt install libspa-0.2-bluetooth blueman

Use blueman-manager to manage your bluetooth devices.

If you like a tray entry for bluetooth add **blueman-applet` to the autostart of i3:

exec --no-startup-id blueman-applet

Dotfiles

I like to manage my dotfiles in a bare repo. To set this up, first configure your git identity:

git config --global user.name your_username
git config --global user.email your_email

Add a alias for git with the repo path in your ~/.bashrc:

alias conf='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'

Open a new terminal or reload the alias in the current shell:

source ~/.bashrc

Initialize the bare repo:

git init --bare $HOME/.dotfiles

Configure the repo to dont show the untracked files:

conf config --local status.showUntrackedFiles no

To add an existing dotfiles repo:

conf remote add origin git@github.com:<username>/dotfiles.git

Download all commits and update the local files:

conf fetch origin && conf pull origin master

Misc Packages

Some more packages i like to install for everyday work are:

Printing

Settings up a printer on debian is also quite easy. Install cups:

sudo apt install cups

And that should be it. Your printer should be recognized automatically.

List the avaliable printers:

lpstat -a

Really old printers may require drivers. You can install a comprehensive set of divers with

sudo apt install printer-driver-all

For document scanning I can recommend NAPS2. You can find the install instructions here.