1
0

arch-i3.md 32 KB


title: Arch (i3) breadcrumbs:

  • title: Configuration
  • title: PC --- {% include header.md %}

For Arch with LUKS encrypted root (and boot), using the i3 window manager.

Related Pages

{:.no_toc}

Resources

Arch

i3

TODO

  • The "i3 User's Guide"
  • Plymouth
  • picom compositor

Installation

Note: The use of sudo in the text below is a bit inconsistent, but you should know when you need it and when you don't.

Live Image Install

  1. (Pre install) Download and burn an Arch ISO:
    • Arch downloads.
    • Always verify the ISO's hash or PGP signature found on the Arch download page (not from the download mirrors).
  2. (Pre install) Disable secure boot in the BIOS settings.
  3. Boot into the Arch live image:
    1. Make sure you're in UEFI BIOS mode. Disable CSM in the BIOS settings if you don't need legacy BIOS for anything, to avoid future complications.
    2. Avoid broken display drivers: In the GRUB bootloader menu, press E on the main entry, add nomodeset at the end, and press enter to boot.
  4. Set the keymap:
    1. (Optional) List available keymaps: ls /usr/share/kbd/keymaps/**/*.map.gz | less
    2. (Optional) Find the appropriate keymap, e.g. the Norwegian no for /usr/share/kbd/keymaps/i386/qwerty/no.map.gz
    3. Load: loadkeys <keymap> (e.g. loadkeys no)
  5. Verify the (UEFI) boot mode:
    1. Check efivar --list or ls /sys/firmware/efi/efivars. If either exists, it's in UEFI mode.
  6. Setup networking:
    1. (Note) For cabled Ethernet with DHCP, it should already be working. For WLAN or exotic setups, check the wiki.
    2. (Optional) Test it somehow (e.g. with ping or curl).
  7. Setup time:
    1. Enable NTP: timedatectl set-ntp true
    2. (Optional) Check the "synchronized" line from timedatectl.
  8. Partition the main disk (for LUKS encryption):
    1. Find the main disk: lsblk
    2. (Optional) Overwrite the full disk to get rid of all traces of the previous install: dd if=/dev/zero of=/dev/<disk> bs=1M conv=fsync status=progress
    3. (Note) Create these partitions by repeatedly running the steps below:
      • Partition 1: Size 512MiB, type ESP (type 1 in fdisk and EF00 in gdisk), mountpoint /boot/efi/.
      • Partition 2: Remaining space, type doesn't matter (leave as-is). Will contain the encrypted root filesystem.
      • TODO Maybe add an encrypted swap partition. For hibernation support and stuff, idk.
    4. Setup and partition the disk: fdisk /dev/<disk>
      1. Create a new GPT partition table: g
      2. Start the new partition wizard (for each partition): n
        • Partition number: See table.
        • First sector: Default.
        • Last sector (effectively partition size): See table. e.g. +512M for a 512MiB volume or nothing to fill it all.
      3. Set the partition type (for each partition): t
        • Partition number and type: See table.
      4. Show partitions: p
      5. Write to disk and exit: w
  9. Format the ESP (first partition):
    1. mkfs.fat -F32 /dev/<partition-1>
  10. Create encrypted root volume (second partition):
    1. (Note) GRUB currently has limited support for LUKS2, so use LUKS1.
    2. Check which cryptohash and encryption algorithms are fastest on the system: cryptsetup benchmark
    3. Create: cryptsetup luksFormat --type=luks1 --use-random -h sha256 -i 2000 -c aes-xts-plain64 -s 256 /dev/<partition-2> (example parameters)
    4. Enter the password to unlock the system during boot.
    5. (Note) There is a later step for avoiding entering the password twice during boot.
  11. Unlock the encrypted root volume:
    1. cryptsetup luksOpen /dev/<partition> crypt_root (for example name crypt_root)
  12. Format the root volume:
    1. mkfs.ext4 /dev/mapper/crypt_root
  13. Mount the volumes:
    • Mount root: mount /dev/mapper/crypt_root /mnt
    • Mount ESP: mkdir -p /mnt/boot/efi && mount /dev/<partition> /mnt/boot/efi
  14. Install packages to the new root:
    • Base command and packages: pacstrap /mnt base linux linux-firmware archlinux-keyring sudo bash-completion man-db man-pages xdg-utils xdg-user-dirs smartmontools zsh vim tar zip unzip htop git jq rsync openssh tmux screen reflector usbutils tcpdump nmap
    • TODO Maybe for laptops: wpa_supplicant networkmanager
  15. Generate the fstab file:
    1. genfstab -U /mnt >> /mnt/etc/fstab
    2. Check it for errors or duplicates.
  16. Chroot into the new root:
    1. arch-chroot /mnt
  17. Setup localization:
    1. Set time zone: ln -sf /usr/share/zoneinfo/<region>/<city> /etc/localtime
    2. Update the hardware clock (using UTC): hwclock --systohc
    3. Uncomment locales to generate: vim /etc/locale.gen
      • Always include en_US.UTF-8 UTF-8.
    4. Generate selected locales: locale-gen
    5. Set the locale: In /etc/locale.conf, set LANG=<locale> (e.g. LANG=en_US.UTF-8).
    6. Set the TTY keyboard layout: In /etc/vconsole.conf, set KEYMAP=<keymap> (e.g. KEYMAP=no).
  18. Set hostname:
    1. echo <hostname> > /etc/hostname
  19. Set the root password:
    1. passwd
  20. Create the initial ramdisk:
    1. Add extra hooks: In /etc/mkinitcpio.conf, find the HOOKS=() line. Add encrypt after block and keymap after keyboard (ordering matters).
    2. Create the initial ramdisk: mkinitcpio -P
  21. Setup GRUB:
    1. Install bootloader: pacman -S grub efibootmgr
    2. Install CPU microcode updates: pacman -S <x>-ucode (for amd or intel)
    3. Enable encrypted disk support: In /etc/default/grub, set GRUB_ENABLE_CRYPTODISK=y.
    4. Find the UUID of the encrypted root partition: blkid
    5. Add kernel parameters for the encrypted root (e.g. /dev/sda2): In /etc/default/grub, in the GRUB_CMDLINE_LINUX variable, add cryptdevice=UUID=<device-UUID>:crypt_root root=/dev/mapper/crypt_root.
    6. Install GRUB to ESP: grub-install --target=x86_64-efi --efi-directory=/boot/efi
    7. Generate GRUB config: grub-mkconfig -o /boot/grub/grub.cfg
  22. Exit the chroot and reboot:
    1. exit
    2. reboot
  23. Wait for the GRUB screen.

Post Install Setup

  1. Boot into the newly installed system:
    1. Avoid broken display drivers: In the GRUB bootloader menu, press E on the main entry and add nomodeset at the end of the linux line. Press Ctrl+X to continue. After proper display drivers are installed, this is no longer required.
  2. (Optional) Disable the beeper:
    1. Unload the module: rmmod pcspkr
    2. Blacklist the module: echo blacklist pcspkr > /etc/modprobe.d/nobeep.conf
  3. Setup default editor:
    • Create a new profile file: /etc/profile.d/editor.sh
    • Set the editor: export EDITOR=vim
    • Set the visual editor: export VISUAL=vim
  4. Setup wired networking:
    1. Enable: systemctl enable systemd-networkd
    2. Don't wait for network during boot: systemctl disable systemd-networkd-wait-online.service
    3. Add a config for the main interface (or all interfaces): See the section with an example below.
    4. (Re)start: systemctl restart systemd-networkd
    5. Wait for connectivity (see ip a).
  5. Setup DNS server(s):
    1. echo nameserver 1.1.1.1 >> /etc/resolv.conf (Cloudflare)
    2. echo nameserver 2606:4700:4700::1111 >> /etc/resolv.conf (Cloudflare)
  6. Setup Pacman:
    1. Enable color: In /etc/pacman.conf, uncomment Color.
    2. Enable the multilib repo (for 32-bit apps): In /etc/pacman.conf, uncomment the [multilib] section.
  7. Update the system and install useful stuff:
    1. Upgrade: pacman -Syu
  8. Install display driver:
    • (Note) For AMD GPUs, Intel GPUs, older NVIDIA GPUs etc., check the Arch wiki.
    • For NVIDIA Maxwell and newer GPUs: pacman -S nvidia nvidia-utils nvidia-settings.
    • (Optional) For NVIDIA CUDA (in addition to driver): pacman -S cuda
  9. Avoid having to enter the encryption password twice during boot:
    1. (Note) To avoid entering the password once for GRUB and then for the initramfs, we can create a keyfile and embed it into the initramfs. If the keyfile fails, it will fall back to asking for a password again.
    2. Secure the boot dir (to protect the embedded key from user processes): chmod 700 /boot
    3. Generate keyfile:
      1. mkdir -p /root/.keys/luks && chmod 700 /root/.keys
      2. dd if=/dev/random of=/root/.keys/luks/luks/crypt_root bs=2048 count=1 iflag=fullblock && chmod 600 /root/.keys/luks/crypt_root
    4. Add key to LUKS: cryptsetup luksAddKey /dev/<partition> /root/.keys/luks/crypt_root
    5. Add key to initramfs: In /etc/mkinitcpio.conf, set FILES=(/root/.keys/luks/crypt_root).
    6. Recreate initramfs: mkinitcpio -P
    7. Add extra kernel parameters for the keyfile: In /etc/default/grub, in the GRUB_CMDLINE_LINUX variable, add cryptkey=rootfs:/root/.keys/luks/crypt_root.
    8. Update GRUB config: grub-mkconfig -o /boot/grub/grub.cfg
    9. Reboot to make sure it works. If not, it should fall back to the extra password prompt.
  10. Setup sudo:
    1. (Note) Both the wheel and sudo groups are commonly used for giving sudo access, but I personally prefer sudo since wheel may also be used by polkit rules, su (pam_wheel), etc.
    2. Install: pacman -S sudo
    3. Add the sudo group: groupadd -r sudo
    4. Enter the config: EDITOR=vim visudo
    5. Add line to allow sudo group without password: %sudo ALL=(ALL:ALL) NOPASSWD: ALL
    6. (Note) To give users sudo access through the group: usermod -aG sudo <user>
  11. Add a personal admin user:
    1. Create the user and add it to relevant groups: useradd -m -G sudo,adm,sys,uucp,proc,systemd-journal <user>
    2. Set its password: passwd <user>
    3. Relog as the new user, both to make sure that it's working and because some next steps require a non-root user.
  12. Install yay to access the AUR (as non-root):
    1. (Note) This needs to be done as non-root.
    2. Install requirements: sudo pacman -S --needed base-devel git
    3. Clone and enter: git clone https://aur.archlinux.org/yay.git
    4. Install: cd yay && makepkg -si
    5. Remove the tmp. repo: cd .. && rm -rf yay
    6. Idk (once): yay -Y --gendb
    7. (Note) Yay needs to be run as a normal user, not as root and not with sudo.
  13. Enable early numlock (initramfs phase):
    1. Install package: yay -S mkinitcpio-numlock
    2. Add numlock to the HOOKS list in /etc/mkinitcpio.conf somewhere before encrypt (assuming the system is encrypted) (e.g. before modconf).
    3. Regenerate the initramfs: mkinitcpio -P
  14. Tweak the PAM login faillock:
    1. (Note) It applies to password logins only, not SSH keys.
    2. (Note) To unlock a user, run faillock --reset --user <user>.
    3. Increase the failed login count threshold: In /etc/security/faillock.conf, set deny = 5.
  15. Setup the local DNS resolver (systemd):
    1. (Note) The systemd-resolve config is /etc/systemd/resolved.conf.
    2. (Optional) Configure static upstream DNS servers (don't use any provided by DHCP/SLAAC): In the confug, set DNS=1.1.1.1 2606:4700:4700::1111.
    3. (Optional) Set the domain/search string: In the config, set Domains=<domain>.
    4. Enable or disable DNSSEC validation (do if the upstream servers don't): In the config, set DNSSEC=<yes|no>.
    5. Enable and start it: systemctl enable --now systemd-resolved
    6. Setup resolv.conf: ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
    7. Check: curl google.com
  16. Setup the NTP client (systemd):
    1. (Note) The default server pool is fine.
    2. Enable: timedatectl set-ntp true
    3. Check: timedatectl (see the "synchronized" field)
  17. Setup firewall (IPTables):
    1. Install IPTables: sudo pacman -S iptables
    2. Enable the IPTables services: sudo systemctl enable --now iptables.service ip6tables.service
    3. Download my IPTables script (or do it yourself): curl https://raw.githubusercontent.com/HON95/scripts/master/iptables/iptables.sh -o /etc/iptables/config.sh
    4. Make it executable: chmod +x /etc/iptables/config.sh
    5. Modify it.
      • It currently defaults to Debian-specific stuff, so remove those lines and uncomment the Arch-specific lines.
    6. Run it: /etc/iptables/config.sh
  18. (Optional) Setup colored man pages:
    1. (Note) Most breaks on wide displays (e.g. UHD), so don't use it if that may be a problem.
    2. Install the most pager: sudo pacman -S most
    3. Set it as the default pager: In .bashrc and/or .zshrc, set export PAGER=most
  19. Reboot to reload stuff and make sure nothing broke:
    1. sudo reboot

Setup the Xorg Display Server

  1. Install: sudo pacman -S xorg-server xorg-xinit xorg-xrandr
  2. Fix the keyboard layout for X11: sudo localectl set-x11-keymap <keymap> (e.g. no)

Setup the LightDM or Ly Display Manager

Note: Install either the LightDM (X11 GUI) or Ly (TTY TUI) display manager, not both. Ly is more minimalistic but doesn't work well with multiple monitors where you may want to specify the layout in Xorg.

LightDM (Alternative 1)

  1. Setup LightDM:
    1. (Note) User-local configuration/profile-stuff should be placed in ~/.xprofile.
    2. Install: sudo pacman -S lightdm
    3. Enable: systemctl enable lightdm
  2. Setup the LightDM GTK+ greeter (aka login screen) (one of many):
    1. (Note) The GTK+ greeter may be configured in /etc/lightdm/lightdm-gtk-greeter.conf or using the lightdm-gtk-greeter-settings GUI.
    2. Install: sudo pacman -S lightdm-gtk-greeter
    3. Set it as the default: In /etc/lightdm/lightdm.conf, under the [Seat:*] section, set greeter-session=lightdm-gtk-greeter.
    4. (Optional) Set the background: In /etc/lightdm/lightdm-gtk-greeter.conf, under the [greeter] section, set background=<image-path>. The /usr/share/pixmaps dir is recommended for storing backgrounds.
  3. Enable numlock on by default in X11:
    1. Install: sudo pacman -S numlockx
    2. Configure: In /etc/lightdm/lightdm.conf, under the [Seat:*] section, set greeter-setup-script=/usr/bin/numlockx on.

Ly (Alternative 2)

  1. Setup Ly:
    1. (Note) The config file is /etc/ly/config.ini.
    2. Install: yay -S ly
    3. Enable: sudo systemctl enable ly
    4. Add fire background: In the config, set animate = true and hide_borders = true.
  2. Enable numlock on by default in X11:
    1. Install: sudo pacman -S numlockx
    2. Configure: Create /etc/X11/xinit/xinitrc.d/90-numlock.sh, containing #!/bin/sh and numlockx &. Make it executable.

Setup the i3 Window Manager and Stuff

  1. (Note) Some notes about i3:
    1. Se i3 for more personal notes about i3.
    2. Use Mod+Shift+R to reload the i3 config. Note that exec_always statements will be run again during reload but exec will only run when starting i3.
  2. Install i3:
    1. Install: sudo pacman -S i3-wm
    2. (Note) Vital parts are missing in the i3 config, follow the remaining steps before attempting to use i3.
  3. Setup the Polybar system bar:
    1. (Note) i3bar, the default i3 system bar, shows workspaces and tray icons. It can include extra info like IP addresses and resource usage using i3status or i3blocks. Polybar is a replacement for i3bar.
    2. Disable i3bar: Comment the whole bar section of the i3 config.
    3. Install polybar: yay -S polybar
    4. Create the config: mkdir ~/.config/polybar && cp /usr/share/doc/polybar/examples/config.ini ~/.config/polybar/config
    5. Customize config:
      • Rename the "example" bar to e.g. "main" (or create one from scratch).
      • Set the font: In the bar section, remove the existing font-<n> statements. Set font0 = <family>:style=<s>:size=<n>;<vertical-offset> (e.g. font-0 = "MesloLGS NF:style=Regular:size=9;2"). Use fc-list | grep <font-name> (the part after the first colon) to search for fonts. Make sure to use a Unicode-compatible font (which the default may not be.
      • For the bar, set bottom = true to move it to the bottom.
      • For the bar, comment radius to disable rounded corners.
      • For the bar, comment border-size to disable the padding/border around the bar.
      • For the date module, customize how time should appear. "Alt" variants are swapped to when the module is clicked.
      • For the network/"eth" module, use %local_ip6% for the IPv6 address (one of them). Maybe clone the module to have one for IPv4 and one for IPv6. Maybe change the color to purple (#800080), so it doesn't clash with the Spotify module (if added).
      • Update the panel modules in the modules-{left,center,right} variables.
    6. Create a startup script: See the section below to use the new "main" bar. Make it executable.
    7. Add to i3: In the i3 config, add exec_always --no-startup-id $HOME/.config/polybar/launch.sh.
  4. Setup the Alacritty terminal emulator (or some other):
    1. Install: sudo pacman -S alacritty
    2. Create the config dir: mkdir ~/.config/alacritty/
    3. (Optional) Download the Dracula theme: curl https://raw.githubusercontent.com/dracula/alacritty/master/dracula.yml -o ~/.config/alacritty/dracula.yml
    4. Configure: Setup ~/.config/alacritty/alacritty.yml, see the example config below.
    5. Setup i3: In the i3 config, replace the bindsym $mod+Return ... line with bindsym $mod+Return exec alacritty
    6. (Note) Press Ctrl+Shift+Space to enter vi mode, allowing you to e.g. move around (and scroll up) using arrow keys and select text using V or Shift+V. Press Ctrl+Shift+Space again to exit.
  5. Setup the Rofi application launcher:
    1. Install: sudo pacman -S rofi
    2. Install rofimoji for emoji menu: sudo pacman -S rofimoji xdotool
    3. (Optional) Find a theme interactively (without selecting any): rofi-theme-selector (e.g. glue_pro_blue)
    4. Configure Rofi: Create ~/.config/rofi/config.rasi, see the example below.
    5. Configure Rofimoji: Create ~/.config/rofimoji.rc and set action = copy (copy to clipboard by default).
    6. Disable old i3 dmenu shortcut: In the i3 config, comment the bindsym $mod+d line.
    7. Setup i3 drun shortcut: In the i3 config, set bindsym $mod+d exec rofi -show drun.
    8. Setup i3 window shortcut: In the i3 config, set bindsym $mod+shift+d exec rofi -show window.
    9. Setup i3 emoji shortcut: In the i3 config, set bindsym $mod+mod1+d exec rofi -modi "emoji:rofimoji" -show emoji.
  6. Setup fonts:
    1. Install basic font with emoji support: sudo pacman -S noto-fonts noto-fonts-emoji
    2. (Optional) Download the MesloLGS font (used in examples here): Download the TTF font files from here and move them into /usr/share/fonts/TTF/.
  7. (Optional) Test the display server, display manager and and window manager:
    1. Restart LightDM/Ly and get pulled into it: sudo systemctl restart lightdm or [...] ly
      • Note that you will not be logged out of the PTY, use Ctrl+Alt+F1 to go back to it and log out.
    2. Select the i3 WM and log in.
    3. If prompted, follow the basic i3 setup wizard:
      1. Generate a new config.
      2. Win as default modifier.
    4. Test i3: Mod+Return to open terminal, Mod+D to open app launcher, etc.
    5. (Optional) Install Firefox to access the web ASAP: sudo pacman -S firefox
  8. Setup background image:
    1. Download a desktop image.
    2. Install the FEH image viewer: sudo pacman -S feh
    3. Update i3: In the i3 config, set exec_always --no-startup-id feh --bg-scale $HOME/Pictures/background.jpg (example).
  9. (Optional) Disable mouse hover window focus (you can still click windows to focus):
    1. In the i3 config, set focus_follows_mouse no.
  10. (Optional) Setup i3 gaps:
    1. (Note) Requires i3-gaps instead of normal i3, which should work as a drop-in replacement with more options.
    2. Replace i3 with i3-gaps: sudo pacman -S i3-gaps (then replace i3-wm with i3-gaps)
    3. Disable window title bar (required): In the i3 config, add for_window [class=".*"] border pixel 4 to only show the border and no title bar, or 0 to remove the border too.
    4. Add gaps around windows: In the i3 config, add gaps inner 8.
  11. Install clipboard manager:
    1. sudo pacman -S xsel
  12. Setup desktop notifications:
    1. Install the dunst server and the libnotify support library: sudo pacman -S dunst libnotify
    2. (Optional) Modify the config:
      1. Check the default config: vim /etc/dunst/dunstrc
      2. Create and open it: mkdir -p ~/.config/dunst && vim ~/.config/dunst/dunstrc
      3. Fix scaling for high-res displays, if broken (doesn't affect text size): In the global section, set e.g. scale = 2.
      4. Change the font and font size: In the global section, set e.g. font = MesloLGS NF 15.
    3. (Optional) Restart dunst: systemctl --user restart dunst
    4. (Optional) Test it: notify-send 'Hello world!' 'This is an example notification.' --icon=dialog-information
  13. Setup media keys:
    1. (Note) Install e.g. Spotify (aur/spotify) to test with.
    2. Install the playerctl utility for easy control: sudo pacman -S playerctl
    3. Add the following to the i3 config: See the i3 media keys config snippet below.
  14. Tweak audio volume keys:
    1. Install pamixer (like ALSA's amixer but for PulseAudio): sudo pacman -S pamixer
    2. Open the i3 config and find the bindsym XF86AudioRaiseVolume and similar lines.
    3. See the config i3 volume keys snippet below.
  15. Setup screen locking:
    1. Install the i3lock-color screen locker: yay -S i3lock-color
    2. Install the the xss-lock automatic locker: sudo pacman -S xss-lock
    3. Set a variable to run i3lock in i3: In the i3 config, before anything i3lock related, set e.g. set $i3lock i3lock --nofork --ignore-empty-password --pass-media-keys, to avoid repetition.
    4. (Optional) Specify an i3lock background image: To the above command, add e.g. --image Pictures/background.png.
    5. Set a locking keybind in i3: In the i3 config, add bindsym $mod+l exec --no-startup-id $i3lock. This may conflict with some focus keybinds you probably don't need, so just remove those (i3 will tell you about it if you don't remove them).
    6. Update i3 for automatic locking: In the i3 config, find the example xss-lock line and replace it with exec --no-startup-id xss-lock --transfer-sleep-lock -- $i3lock. (Test with loginctl lock-session after restarting or relogging.)
  16. Setup a Spotify module for Polybar:
    1. Install: yay -S polybar-spotify-git
    2. In the Polybar config (~/.config/polybar/config), add a module spotify (see config snipper below) and add it to some bar module section.

Setup Xorg Multi-Display and Stuff

  1. (Note) The Xorg configs are only read when the server is started, meaning you practically need to restart the system (or relog if using a non-X11 display manager) to apply new configuration.
  2. (Note) Query current Xorg settings: xset q
  3. (Optional) Try xrandr to get try display layouts and stuff:
    1. (Note) Changes made using the command line are not persistent.
    2. Show current config: xrandr
    3. (Note) The resolution with + is the oreferred and the one with * is the active one.
    4. Activate/update a display: xrandr --output <display> [--primary] [--right-of <other-display>] [--rotate left] --auto (auto selects the preferred resolution and frame rate)
    5. Deactivate a display: xrandr --output <display> --off
  4. Setup persistent layout config:
    1. See the example Xorg displays config below.
      • For each connected monitor, create a separate section.
      • Run xrandr to get display IDs.
      • Make sure to have exactly one display with Option "Primary" "true".
    2. Alternatively, create a script to set up displays using xrandr and call is from the i3 config.
  5. Setup display power management signaling (DPMS):
    1. See the example Xorg DPMS config below.
      • For non-CRT displays, the standby, suspend and off modes typically mean the same thing.
      • DPMS is enabled by default in recent Xorg, but it can be explicitly enabled by setting Option "DPMS" "true" in a monitor section.

Setup Audio

Note: We're using the PipeWire sound server, a modern, security-focused and compatible replacement for both PulseAudio and JACK. See PipeWire (Applications) for more config info.

  1. Install ALSA stuff:
    1. (Note) ALSA itself is already provided as built-in kernel modules and ALSA drivers will just work.
    2. Install ALSA utils and firmware: sudo pacman -S alsa-utils alsa-firmware
  2. Install PipeWire (including WirePlumber and adapters):
    1. Install: sudo pacman -S pipewire pipewire-alsa pipewire-pulse pipewire-jack pipewire-v4l2 wireplumber pavucontrol
    2. Start the PulseAudio adapter (to avoid relogging): systemctl start --user pipewire-pulse
  3. Configure inputs and outputs:
    1. Run pavucontrol to configure volumes, inputs, outputs and stuff.
  4. Test it:
    1. Try playing something from the browser or whatever. It should work.
  5. Install useful audio applications:
    1. Install the Helvum patchbay to patch nodes and endpoints (inputs and outputs for all audio devices): sudo pacman -S helvum
    2. See the PipeWire page (Arch Wiki).

Setup Bluetooth

  1. (Note) Make sure rfkill or some hardware switch isn't disabling/blocking the adapter.
  2. Setup the base stack:
    1. (Note) The canonical Bluetooth implementation is BlueZ.
    2. Install: sudo pacman -S bluez bluez-utils
    3. Enable and start: sudo systemctl enable --now bluetooth.service
    4. (Optional) Allow users to use Bluetooth networking or something: Add the users to the lp group.
    5. (Optional) Enable auto power-on after boot and resume: In /etc/bluetooth/main.conf, in the Policy section, set AutoEnable = true.
  3. Setup audio:
    1. (Note) Using PipeWire and its PulseAudio adapter (pipewire-pulse), which should already have been set up and includes support for Bluetooth.
  4. TODO See https://wiki.archlinux.org/title/bluetooth_headset
  5. Setup Blueman:
    1. TODO This broke for some reason, the GUIs won't open and the tray icon won't show. I haven't bothered fixing it yet.
    2. (Note) Blueman is a Bluetooth manager with a practical tray icon.
    3. Install: pacman -S blueman
    4. Enable tray icon on i3 start: In the i3 config, add exec --no-startup-id blueman-applet. (TODO Test.)
    5. (Optional) Try to run it. It's the "Bluetooth Manager" entry in e.g. Rofi.
  6. (Example) Connect a device using bluetoothctl:
    1. (Note) To avoid entering the interactive TUI and run single commands instead, use bluetoothctl -- <cmd>.
    2. Enter the TUI: bluetoothctl
    3. List controllers: list
    4. (Optional) Select a controller: select <mac>
    5. Enable the controller: power on
    6. Enable scanning: scan on
    7. List available devices: devices'
    8. Enable the pairing agent: agent on
    9. Set the agent as default: default-agent
    10. Pair with device: pair <mac>
    11. Trust it, maybe (TODO required?): trust <mac>
    12. Connect to device: connect <mac>
    13. Disable scanning (TODO required?): scan off
    14. Exit: Ctrl+D

Setup Applications

  1. Setup terminal emulator:
    1. Already done.
  2. Setup the ZSH shell:
    1. See Applications: ZSH (includes font, theme and plugins).
  3. Setup the VLC video and audio player:
    1. Install: sudo pacman -S vlc
  4. Setup the Mirage image viewer:
    1. Install: yay -S mirage
  5. Setup the GIMP image editor:
    1. Install: sudo pacman -S gimp
  6. Setup the Thunar graphical file manager:
    1. Install: sudo pacman -S thunar
  7. Setup the Ranger terminal file explorer:
    1. Install: sudo pacman -S ranger
  8. Setup the VS Code text editor/IDE:
    1. (Alternative 1) Install the Arch-built: sudo pacman -S code
    2. (Alternative 2) Install the Microsoft binary distribution with tracking and Microsoft extensions: yay -S visual-studio-code-bin
  9. Setup the LibreOffice office document suite:
    1. Install: sudo pacman -S libreoffice-fresh
  10. Setup the Okular PDF reader:
    1. Install: sudo pacman -S okular
  11. Setup the screenshot tool Maim (for keybinds and easy CLI usage):
    1. Install: sudo pacman -S maim
    2. Setup i3 keybinds: See the i3 config snippet below.
  12. Setup the screenshot tool Flameshot (for GUI and on-screen editing):
    1. Install: sudo pacman -S flameshot
    2. (Usage) Start the tray icon: Run the "Fireshot" desktop application.
    3. (Usage) Directly open the capture GUI from the terminal: fireshot gui
  13. Setup the 7-Zip CLI/GUI archiver:
    1. Install: yay -S p7zip-gui
    2. (Note) Don't use the .7z file format, it doesn't preserve owner info.
  14. Setup network tools:
    1. Install: sudo pacman -S nmap tcpdump wireshark-qt

Extra (Optional)

  • Setup secure boot using your own keys.

Notes and Snippets

systemd-networkd Network Config

File: /etc/systemd/network/eno1.network (example)

This example sets up interface eno1 (the main interface, see ip a) to use DHCPv4 and SLAAC/DHCPv6. The DHCP and IPV6ACCEPTRA sections are optional, the default values are typically fine.

[Match]
Name=eno1

[Network]
DHCP=yes

[DHCP]
UseDNS=yes
UseNTP=no
UseHostname=no
UseDomains=yes

[IPv6AcceptRA]
UseDNS=yes
UseDomains=yes

Alacritty Config

File: ~/.config/alacritty/alacritty.yml

font:
  # normal:
  #   family: MesloLGS NF
  #   style: Regular
  size: 9

env:
  TERM: xterm-256color

import:
  # Theme
  - ~/.config/alacritty/dracula.yml

Polybar Launch Script

File: ~/.config/polybar/launch.sh

#!/bin/bash

killall -q polybar

#polybar main &>>/tmp/polybar.log
polybar main

echo "Polybar launched"

Polybar Spotify Module

File: ~/.config/polybar/config

[module/spotify]
type = custom/script
interval = 1
format = <label>
#exec = python /usr/share/polybar/scripts/spotify_status.py -f '[{artist}] {song}' -t 50 -q
exec = python /usr/share/polybar/scripts/spotify_status.py -f '{song}' -t 25 -q
format-underline = #1db954

Rofi Config

file: ~/.config/rofi/config.rasi

configuration {
    font: "MesloLGS NF 10";
}
@theme "glue_pro_blue"

Xorg Monitors

File: /etc/X11/xorg.conf.d/10-monitor.conf

Section "Monitor"
    Identifier "DP-4"
    Option "Primary" "true"
EndSection

Section "Monitor"
    Identifier "DVI-I-1"
    Option "RightOf" "DP-4"
    Option "Rotate" "left"
EndSection

Xorg DPMS

File: /etc/X11/xorg.conf.d/20-dpms.conf

Section "ServerFlags"
    # In minutes, 0 to disable
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime" "30"
    Option "BlankTime" "0"
EndSection

Alternatively, to disable DPMS completely:

Section "Extensions"
    Option "DPMS" "Disable"
EndSection

i3 Media Keys

File: ~/.config/i3/config

Requires playerctl.

# Media keys
bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
bindsym XF86AudioPause exec --no-startup-id playerctl play-pause
bindsym XF86AudioStop exec --no-startup-id playerctl stop
bindsym XF86AudioPrev exec --no-startup-id playerctl previous
bindsym XF86AudioNext exec --no-startup-id playerctl next

i3 Volume Keys

File: ~/.config/i3/config

Requires pamixer.

# Volume keys
bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 5
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 5
bindsym XF86AudioMute exec --no-startup-id pamixer -t
bindsym XF86AudioMicMute exec --no-startup-id pamixer --default-source -t

i3 Maim Screenshot Keys

File: ~/.config/i3/config

Requires maim.

# Capture screen (active window and full)
bindsym $mod+Print exec maim -i $(xdotool getactivewindow) $HOME/Downloads/Screenshot_$(date -Iseconds).png
bindsym $mod+Shift+Print exec maim $HOME/Downloads/Screenshot_$(date -Iseconds).png

{% include footer.md %}