==========
== Lura ==
==========
Complaining website for complaining

Installing Gentoo

Table of Contents

On the 28th of December, I installed Gentoo.

(Shock and awe abound.)

This is a bit of a ramble both about why, about my experiences with Gentoo and Wayland, and about my software choices.

Why?

That could mean two things. One: Why install Gentoo? Two: Why tell people about it in the form of a blog post? The latter is easier to answer: because I want to show off, and also as a basic repository of all the things I learned in this adventure.

The former has its own, much more pathetic answer: because I needed change in my life. A lot of things happened to me throughout December 2023 (it’s in the running for worst month of my life, alongside Oct 2018 and Feb 2019) and most of them were very bad. But, being a shut-in NEET with a sleep disorder, my only real outlet for this was my computer.

Some background

I’ve been a Linux user since I was a kid. My first distribution was Ubuntu 8.04 (or 7.04, I don’t really remember) that came on a CD with a computer magazine my dad used to buy for me. I booted it up, messed around in the live CD, got spooked, and never used it again. My first real distribution was Debian Squeeze on a “barebones” box that my parents got for my 11th birthday, which I used to run Minecraft servers. It had an AMD Athlon II X2 255 (fucking hell) and was my day-to-day PC when my uncle’s old hand me down died.

(I still have it in my box of old CPUs, alongside a Pentium E2160, a very dead Core 2 Q6600, and my beloved G3258. My old 4690k is still in service as my father’s Strava PC.)

In 2014, I took the plunge and installed Arch Linux. There’s always been an unofficial hierarchy of Linux distributions - similar to programming languages - that people tend to (subconsciously) sort individual distros into. At the bottom of the totem is the “beginner friendly” distributions, such as Ubuntu or Mint. These are the distributions the “new to Linux” user will install and are unofficially seen as kind of “lesser” distros. The next rung is the “professional” distributions - the ones that real, productive Linux users will install - such as Fedora or Debian. There’s some blurring between these two types with newer distributions such as Nobara or Pop!_OS, but most people will try and graduate to a Professional Distribution before long.

Near the top of the pole is the Scary Distribution - Arch Linux. Arch is famously memed in the consumer Linux community as being hard to use, having things break constantly, and having a terrifying install process (none of which are true); but on the flipside, you get more customisability (true to some extent) and the latest packages (something something Python 3.11). So, to a 14 year old Computer Savant, this was the perfect choice of distribution to install.

I used Arch for 10 years. I like Arch. I’m not quite one of those “I use Arch btw” guys, but I would seriously recommend Arch as the distro of choice for the majority of Linux users. I like how simple pacman is, I like the AUR, I like that the wiki is the place to get information about any Linux problems. On a technical level, I don’t have any problems with Arch, and if it wasn’t for life circumstances I wouldn’t’ve switched - at best, I would’ve done a reinstall. But I wanted to try something new! And that leaves only the Terrifying Distributions.

The Terrifying Distributions are usually only invoked as a joke. If a newbie asks what distribution to install, you utter the canned response to the laughs of everyone else: you tell them to “install Gentoo”. Gentoo is a source-based distribution, meaning that rather than having some poor Threadripper buildbot compiling software for -march=x86_64, your PC checks out the code and compiles it locally, allowing you to make compile-time customisations and have the compiler generate code tailored to your PC - in theory, making things faster.

There’s a few Terrifying Distributions out there: Gentoo is the stereotypical one; Slackware is lesser known by more modern users but is the archetypical Terrifying Distribution; and LFS is often mentioned (albeit, unseriously). I’ve done LFS before; it’s more boring than scary or interesting. It’s also a bastard to update. So that’s why I picked Gentoo. There’s nothing really deeper than “it’s rolling, it’s customisable enough for me, and it’s not Arch”.

(Obviously, everything about the hierarchy of distributions is wrong. There’s no such thing. Fedora or Debian are the best options for new users, and Arch/NixOS for everyone else. But frequent any Linux forum or subreddit and you’ll pick up on it too.)

Installing Gentoo

I’m familiar with the process of actually installing a Linux distribution manually, so I opted to ignore the Gentoo Live CD and install things from my running Arch partition. I went with the systemd option rather than OpenRC because I am a diehard systemd defender (I would rather die than write a complex shell script), selected the KDE profile, and let it install inside a chroot.

Christening a new system the best way

And… well, that was it? The only issue I had was with installkernel and systemd-boot interactions (A: I am also a gummiboot diehard. Fuck GRUB. B: It appears the Gentoo devs are also having issues with installkernel, given how it’s been updated about five times in the last week) but after figuring that out (it’s still broken) I now had a functional desktop. I installed firefox-bin, logged back into all of my websites… and that was that. I even had my very-out-of-date Arch partition on my other SSD ready in case I broke things and needed to chroot in.

The Need For Customisation

You can skip this section if you don’t care about software I installed on my PC; I question why you’re even reading this post in that case.

But… the reason I installed this is because I needed change. I was already using KDE on Arch, customised in 2019 and never touched again. I don’t remember how I set it up and the subtle differences were going to annoy me for weeks.

I am extremely sensitive to tiny annoyances, like a fresh install having different animations or slightly different styling in all the wrong places. The only reason I installed KDE for my fresh arch install in 2019 was because GNOME would cause my entire desktop to freeze on iowait or new windows opening (the latter of which is a very big problem when you use IDEs like IntelliJ, which pops up an autocomplete window!). This is also the same reason I switched from X11 to Wayland (despite using the proprietary NVIDIA drivers. Fear me!), when it reappeared after an -Syu in late 2023.

So, fuck it! Let’s change all of my apps. I have a few criteria for what I pick to install:

  • Prefer Rust-based (or other memory safe language) utilities when possible. I don’t want my system to be compromised by some random C utility. (I mostly failed in this goal).

    Rust developers also seem to be generally smarter at making sane software, which is always a bonus.

  • It should have reasonable defaults out of the box, or it should be incredibly easy to configure. I don’t like seeing 10000 keybinds in a config file that I now have to think about as soon as I realise they exist.

  • I try and minimise the amount of Go software on my PC. It’s not always avoidable (e.g. I use Hugo for this very blog) but I have a very poor opinion of Go as a language and that also goes for software written in it.

The Compositor: Hyprland

I’ve never used a tiling WM. I started with GNOME 2 on Debian, used Openbox for my first Arch install, used GNOME 3 (until it broke) on my second, then KDE on my third. I have all of my windows fullscreen most of the time, so the difference between a floating and tiling WM doesn’t matter that much.

There’s a few options I considered:

  • Sway is the wayland compositor; it’s been around for the longest and the library it uses (wlroots) is used by most independent Wayland compositors. However, it doesn’t make any effort to work on NVIDIA GPUs (especially not ones in the awkward inbetween Pascal era, like mine), and I make a habit of avoiding ddvault-ware.

  • Hyprland is the other wayland compositor, or so its fans would have you believe. Every ricing space is inundated with Hyprland posts, and for good reason - it looks damn good out of the box. Sadly, the community is full of cunts (which I didn’t know until well after I configured it), so that means getting support is out of the picture.

  • Niri is a newcomer (although I found it several days into my wayland journey) to the scene and looks cool, but the lack of integrated XWayland support is a complete killer for me. If/when it does pick it up, however, I’ll give it a try.

There’s a few options I saw, but ruled out early:

  • Wayfire appears to be Sway with animations. I’m too young to have enjoyed Compiz, so it’s lost on me.

  • swayfx is literally Sway with animations. See above.

  • I tried installing qtile but decided I had better things to do than figure out wlroots version conflicts.

  • river proudly boasts in its wiki about not actually having defaults; instead, you write a shell script to configure its layout. Novel, but not what I’m looking for, especially not with the verbosity of the Python example.

    This, alongside Niri, is one of the more promising ones that I might take a look at again in the future.

  • hikari uses a cutesy gTLD (red flag #1) and states it is developed primarily for a *BSD (red flag #2) - so I can assume it’s not my style.

In the end, I went with Hyprland based on the fact a trusted friend had tried it out previously. I’ve stayed on Hyprland since for a single reason: the virtual desktops plugin. I hate the way workspaces seem to work in the Wayland world. I didn’t use workspaces much in KDE outside of having PDFs on a different workspace, but a tiling WM demands their usage as you can’t just hide a window with M-Tab.

I also installed the hy3 plugin which provides an alternative mechanism for tiling, closer to what i3/sway provide. I haven’t learned it very well, but it required changing my Hyprland config, so it’s too late to go back now.

I’ve only experienced a handful of major issues with Hyprland and they are legacy XWayland based applications not working properly, e.g. Steam popups and IntelliJ autocomplete. I’ve found some window rules from the issue tracker that alleviate this:

# Fix steam context menus
# https://github.com/hyprwm/Hyprland/issues/2661
windowrulev2 = stayfocused, title:^()$,class:^(steam)$
windowrulev2 = minsize 1 1, title:^()$,class:^(steam)$

# https://github.com/hyprwm/Hyprland/issues/3450
# -- Fix odd behaviors in IntelliJ IDEs --
#! Fix focus issues when dialogs are opened or closed
windowrulev2 = windowdance,class:^(jetbrains-.*)$,floating:1
#! Fix splash screen showing in weird places and prevent annoying focus takeovers
windowrulev2 = center,class:^(jetbrains-.*)$,title:^(splash)$,floating:1
windowrulev2 = nofocus,class:^(jetbrains-.*)$,title:^(splash)$,floating:1
windowrulev2 = noborder,class:^(jetbrains-.*)$,title:^(splash)$,floating:1

#! Center popups/find windows
windowrulev2 = center,class:^(jetbrains-.*)$,title:^( )$,floating:1
windowrulev2 = stayfocused,class:^(jetbrains-.*)$,title:^( )$,floating:1
windowrulev2 = noborder,class:^(jetbrains-.*)$,title:^( )$,floating:1
#! Disable window flicker when autocomplete or tooltips appear
# windowrulev2 = nofocus,class:^(jetbrains-.*)$,title:^(win.*)$,floating:1

I disabled all of the Hyprland animations as well as most of the visual FX.

general {
    gaps_in = 2
    gaps_out = 0
    border_size = 1
    col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
    col.inactive_border = rgba(595959aa)

    layout = hy3

    allow_tearing = false
}

decoration {
    rounding = 0

    blur {
        enabled = false
        size = 3
        passes = 1
    }

    drop_shadow = false
    shadow_range = 4
    shadow_render_power = 3
    col.shadow = rgba(1a1a1aee)
}

animations {
    enabled = no
}

It’s cute at first, but I want my workspaces to load instantly. I kept borders enabled for visual feedback on focused windows. There’s a plugin that can help with this, but it hasn’t been updated in four months and so doesn’t use hyprpm.

Finally, the only other issue I found was not being able to bind the Compose key to Right-Super; I’ve bound it to Menu instead. If anyone knows how to do this, please let me know.

Fucking XDG Desktop Portals

As a detour, let’s talk about XDG Desktop Portals. In the X11 world, applications can do whatever they want to your display, including keylogging and stealing the rendered output. This was widely regarded as a Bad Idea, and in the Wayland world applications only get input when focused and can only see what they themselves render. (Pro tip: Try running xeyes under XWayland.)

But! Screen recording is a useful thing to have! If you run an application in a sandbox like Flatpak, it needs to be able to talk to the outside world. This is what XDG portals are for; they provide a protocol to allow apps running under Flatpak or Wayland talk to the rest of the system and perform privileged actions like take screenshots, send notifications, copy to the clipboard, record parts of the screen, or choose files.

A portal implementation is designed specific for the environment it’s running under. For example, the Hyprland portal is xdg-desktop-portal-hyprland (until recently, this was packaged incorrectly upstream for Gentoo so it wasn’t loaded correctly. Move the .service file out of /usr/lib64/systemd/user and into /usr/lib/systemd/user, then do a daemon-reload. This is fixed in the latest versions) - although it works for any wlroots based compositor - and provides the ability to take screenshots and use global shortcuts.

But… the Hyprland portal doesn’t support anything else. It only provides a handful of capabilities:

XDP: loading /usr/share/xdg-desktop-portal/portals/hyprland.portal
XDP: portal implementation supports org.freedesktop.impl.portal.Screenshot
XDP: portal implementation supports org.freedesktop.impl.portal.ScreenCast
XDP: portal implementation supports org.freedesktop.impl.portal.GlobalShortcuts

This means that apps running in flatpaks will be broken in various ways! Long story short, you need to do the following:

  1. Install an alternative portal such as the KDE portal:

    sudo emerge -av kde-plasma/xdg-desktop-portal-kde

    This pulls in a lot of QT dependencies because its designed for KDE.

  2. (Optional) Install the gnome-keyring portal. I don’t know if this is actually needed, but I don’t know how keyrings work.

    sudo emerge -av gnome-base/gnome-keyring

  3. Configure your desktop portals to fall back to KDE in ~/.config/xdg-desktop-portal/portals.conf

    [preferred]
    default=hyprland;kde
    org.freedesktop.impl.portal.FileChooser=kde
    org.freedesktop.impl.portal.OpenURI=kde
    org.freedesktop.FileManager1=kde
    org.freedesktop.Notifications=kde
    

    This will speak Hyprland by default, fall back to KDE if Hyprland doesn’t exist, and explicitly use KDE for the specified protocols. (In case you somehow end up with the GNOME portal.)

  4. Force GTK apps to use the XDG portal by adding export GTK_USE_PORTAL=1 to /etc/profile.

This almost works… but GTK-based apps will have fucked up font rendering. Yay! You can fix this by adding org.freedesktop.impl.portal.Settings=hyprland to nullroute the settings portal, but this breaks automatic Flatpak system themeing.

(You’re welcome, future me.)

Screenshots: Grimblast

After that detour about portals - which enable screenshots - let’s talk about screenshot utilities.

Under Arch/KDE, I used Flameshot 0.10.2 (exactly that version) because it was the last version with DBus controls for screenshotting, and I didn’t want to adjust my key bindings when they already worked fine. I switched to Spectacle after a few years, and used that up until I switched distribution.

I tried Spectacle again when I first installed Gentoo, but ran into the tiny issue of “it wouldn’t stop fucking hanging around” and I could not remember/figure out how to get it to FUCK OFF after I took a screenshot. Instead, I went straight for grimblast (by copying it into my ~/.local/bin), and it works perfectly! I didn’t explore any other options.

The only thing that’s missing is on-screen annotations.

Terminal: foot

A good terminal emulator has one job: display the output of commands. Yet, there’s a surprising amount of choices available when it comes to a terminal. I have a minimal set of requirements: it needs to support bitmap fonts and it needs to have low input latency.

I’ve used several terminals throughout my Linux journey. I was a diehard xfce4-terminal fan for about five years before switching to sakura in 2017-2018, which I used until an update broke fonts and I switched to Alacritty.

Since 2018, the terminal world has come a long way, and I’ve tried a few options:

  • kitty is used by a lot of people, but it doesn’t support bitmap fonts (and the author is a dickhead about it).

  • I could go back to sakura, but it doesn’t support bitmap fonts (or it just ignores me). Plus it seems to have poor wayland support.

  • wezterm seems cool but doesn’t work properly on Wayland (by the author’s own admission) and has pretty bad input latency.

At first, I used Alacritty again (because why replace something that works?)… but it has relatively high memory usage (70MiB per terminal). foot terminal only uses 40MiB for the server and 1MiB per footclient. Sixel support also doesn’t hurt.

Shell: fish

I have been a fish shell convert for a decade now. This has not changed with Gentoo. I’ve tried other shells, including xonsh and nushell (which looks promising) but I’ve always gone back to Fish for one big reason: it has completion previews. I use it with the kawasaki fish prompt, a two-line prompt. Two-line prompts are better because they leave maximum room for your command whilst still keeping useful information about the environment.

The biggest issue I have with nushell is that it opens with a prompt telling me if I read the documentation I can find out how to remove the prompt that tells me I can do that. Don’t do that! Remove the prompt by default! And the configs are over 800 lines out of the box! I don’t want to deal with that at all!

Command Line Replacement Tools

I decided to go all-in on trying to replace some of my terminal commands with more Modern alternatives this time.

  • I already used exa as a replacement for ls, but it’s been abandoned, so I took the chance to switch to eza instead. I’ve also considered erd but I don’t like the default recursive view.

  • ripgrep over grep. Enough said. I’ve used this long enough that my muscle memory is to type | rg -i over | grep.

  • atuin replaces the default Fish shell history. It took a bit to get used to, but I like it a lot, especially being able to fuzzy find through my history. No more history | rg -i ".*thing.*".

    The only tweak I made was disabling enter_accept to get parity with Fish’s default history behaviour, where I can end-complete and edit.

  • bat as a “pager”. It’s not really a pager (it even forwards things to a regular pager) but I like having syntax highlighting and line numbers when viewing files in the command line.

  • jj as a semi-replacement for Git. I even made my own ebuild for this!

Other things I’ve tried, but didn’t vibe with:

  • zellij for terminal multiplexing. I’ve never used a terminal multiplexer (except for screen -S background_process) and with a tiling WM (with tabs, thanks to hy3) I don’t really see the utility.

    Zellij additionally annoys me by dumping a list of keybinds on the screen in powerline font (I make a conscious choice not to use powerlines) and having a 300 line config file with the default keybinds there. I don’t like this! As soon as I see this, I then have to deal with figuring out if I need to change the config!

  • yazi for file managing. I don’t use file managers, graphical or otherwise, outside of the one embedded in my IDE. I’m open to using one (preferably onee that isn’t written in C/shell scripts and doesn’t mandate v*m bindings), so I tried it out.

    But… it uses powerline fonts (strike one), doesn’t respond to C-c (strike two), and doesn’t generate a default config file at all (strike three).

    This is one of the things I’m more likely to come back to, as well as exploring some other options like xplr.

  • starship requires a powerline/icon font by default (ugh). It’s allegedly moving away to a config that doesn’t (and it’s also the config that I tried) but that doesn’t fill me with hope.

    Plus, I already like Kawasaki. If I was to change prompt, I’d likely write my own.

  • gitui uses unreadable colours by default. Hard pass.

Editor: micro + VS Code

I have a confession (not really a confession, more of a brag): I only type with two fingers. I’m sure your mental image of me is of a technophobic grandma typing at one word per minute and staring down at the keyboard to find each key individually; but no. I type at a high speed (around ~120wpm peak on my mechanical desktop keyboard, 150wpm on a laptop keyboard, and about 90wpm when typing things out at a relatively relaxed pace.) I use the arrow keys and the home row means nothing to me. Ctrl/Alt/Esc are inconvenient to hit. I type by moving my entire arms rather than just my fingers like most people do, because I have extremely poor hand coordination and this allows me to keep a high accuracy. I don’t need to look at the keyboard (my keycaps are a mishmash of new and old ones as the old ones break).

This means about 95% of editor shit is lost on me. I don’t care about modal editors because I have to contort my hands to hit all the keybinds. I used nano as a kid, I installed micro a few years ago to replace it and have used it ever since. For complicated projects where I need an LSP I switch into VS Code. I’ve often considered making my own keyboard layout which focuses primarily on one-hand typing and letting me use the mouse for modifier keys. I can type decently fast with just my left hand as it is. (That entire paragraph was typed with just my left hand, sans the brackets.)

I’m not entirely against the idea of using a Fancy Pants terminal editor, but it would have to be one that fits the two-finger typing layout that I’ve been using for the last sixteen years. Maybe something that uses the Insert/Delete/etc keys.

My micro configuration is extremely small:

{
    "clipboard": "terminal",
    "colorscheme": "atom-dark",
    "diffgutter": true,
    "mkparents": true
}

Fonts: KNXT, Iosevka SS14, Galmuri

I am a monospace font maniac. I use monospace fonts for everything whenever possible; even this website uses a monospace font (Sudo). In this sense, I can also trace back my font progression throughout the years.

  • Early on, I liked Overpass Mono which was my terminal font for many years.

  • At some point, I switched to DejaVu Sans Mono, which I used as both my editor font and my terminal font. I was a die-hard fan of DJVU and I ran a fork that enabled ligatures.

  • When JetBrains Mono launched, I switched to it instantly. It’s very similar to DejaVu but it looks a bit better. (I would guess that JB Mono is one of the most widely used monospace fonts out there now, alongside Fira Code and Source Code Pro).

I don’t use any of these fonts these days. Instead, I use a combination of fonts:

  • All of my editors use Iosevka SS14, which is Iosevka with some style variations to use JetBrains Mono inspired characters. (USE="iosevka-ss14")

    I find it impossible to go back to a wide font after using Iosevka for the last year or two.

  • I’ve tried several bitmap fonts on my terminal, including envypn (which I think is straight up the best looking font ever made) and Cozette, but they are too small for my monitor.

    Instead, I use KNXT which is both clear and large on my screen.

  • I use Galmuri as my fallback font for CJK characters.

Panel: waybar

I’m a sucker for a panel. Ever since I was born, I knew I needed to use a computer which has a status bar at the top. This is part of the reason Windows doesn’t appeal to me (outside of some early Chicago builds) - the taskbar is at the bottom by default! I’ve used tint2, the default GNOME shell panel, and the default KDE panel, and they’ve all been great. I only really have two requirements for a panel: show me my current volume level, and show me the time.

I went with Waybar with the -mpd mpris network tray USE flags. I didn’t look into any other panel further because it worked immediately after installation with reasonable defaults, and configuring it was dead simple. I even added a weather widget thanks to wttrbar, which I would otherwise sorely miss from my KDE panel.

The main thing I dislike about it is lack of auto-reload, but there’s a shell script further down which uses inotifywait (from sys-fs/inotifywait).

Wallpaper: swww

For the longest time, I used Variety for my wallpaper utility. I assumed this would be a non-starter on Wayland, but it seems like it might work. It’s not available in any overlays, so installing it would be a pain.

In the spirit of change, I didn’t even try Variety and instead tested a few utilities. I first tried Hyprpaper but it seems like it lacks esoteric features such as “loading a new wallpaper at runtime”. I tried wpaperd but it made my (non-1080p) wallpapers fit weirdly.

I’ve settled for the combination of swww for the backend, and Waypaper for a simple GUI setter (provisional). I’m considering making my own wrapper for swww. I’ve also seen Waypaper-Engine, but I imagine it would need some ebuild wrangling.

Launcher: rofi + various scripts

I didn’t really use an application launcher until my KDE hot corner arbitrarily stopped working one day and I found out about the Alt-F2 menu. Since then, I’ve always needed a launcher.

I think everyone has made their own launcher, so there’s not exactly a dearth of options available - and believe me, I tried a lot.

  • wofi - sourcehutware. I don’t trust the decisions of anyone who uses sourcehut.
  • anyrun - Doesn’t work at all.
  • fuzzel - Looks incredibly ugly out of the box.
  • bemenu - Not really what I’m looking for. I like having my launcher pop down.
  • tofi - Too big!
  • kickoff - Too big again!
  • yofi - Also looks pretty ugly out of the box.

ignore the double cursor

I settled with rofi’s wayland fork as my launcher. It looks fantastic out of the box with icons and is very easily customisable (I use a modified Darcula that sets the background to #000000 black.)

I also have a handful of custom launchers bound to various keys:

  • Alt-F2 shows rofi in combi run+drun mode. This shows desktop applications and every exe in my $PATH together.

  • Alt-F3 shows my Kaomoji picker (seen in the screenshot), powered by kaokao. It copies it straight to my clipboard.

  • Alt-F6 shows my self-made Prism Launcher instance launching menu.

  • M-v shows my clipboard history, powered by cliphist. I am considering clipcat as well, as part of my Go minimisation protocol.