Skip to content

Instantly share code, notes, and snippets.

@Axioms
Forked from lbrame/archtweaks.md
Last active April 17, 2022 21:09
Show Gist options
  • Save Axioms/3d6ef2876d9add0be9d03d9533cb56d9 to your computer and use it in GitHub Desktop.
Save Axioms/3d6ef2876d9add0be9d03d9533cb56d9 to your computer and use it in GitHub Desktop.
Tweaks I've made to my Arch Linux installation

Arch Linux tweaks

This is a collection of the tweaks and modification I've made to my Arch Linux installation over the months. These may be applicable to other distros, but please check first before doing anything. I also included Arch Wiki references for all the procedures I mentioned. My recommendation is not to blindly follow this gist but to always check with the Arch Linux wiki first. Things move fast and by the time you're reading this my gist may be out of date. Lastly, the golden rule: never execute a command you don't understand.

Installing the KDE Plasma desktop

My current DE of choice is KDE's Plasma. I find it just about perfect.

There are various ways to install it on Arch. The most popular one is to install plasma and plasma-applications, but I don't like doing that because it comes with too many programs I'll never use. I, instead, install the base plasma group, remove the few extra packages that come with it, then I finish off by installing a few KDE apps that don't come with the plasma group, plus packages needed to use some of their features. I'm aware it's possible to get an even more minimal install by foregoing the plasma group and just installing plasma-desktop and a few other packages, but there are nice features, such as the browser integration, that I actually use.

# pacman -S plasma
# pacman -Rnsc discover oxygen plasma-vault
# pacman -S xdg-desktop-portal ark kdeconnect sshfs dolphin okular konsole kate gwenview

I then export the export GTK_USE_PORTAL=1 environment variable so that programs that read it might load KDE-specific APIs, which can influence some programs to present the Qt file picker over the GTK one - it's way better integrated with Plasma and it's, frankly, superior.

Even though Plasma was built with customization in mind, I mostly use it with its default settings: I just change the action key to META, import my keyboard shortcuts and set the double-click, not the single-click, to open a file or folder.

Chaotic-AUR

Chaotic-AUR compiles some of the packages on the AUR so you don't have too.

Follow the instructions on their website to install it https://aur.chaotic.cx

Yay!

I use yay as my AUR helper. You can install it from the AUR: If you don't want Golang dependencies, yay-bin is the package you're looking for.

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

or install it from the Chaotic-AUR

sudo pacman -S yay

Installing Windows fonts

I finally added Microsoft fonts as they're handy to keep around and tend to be necessary to display web pages and Office documents correctly.

To install them system wide, copy the C:\Windows\Fonts folder from a Windows installation to /usr/share/fonts:

# mkdir /usr/share/fonts/WindowsFonts
# cp /windows/Windows/Fonts/* /usr/share/fonts/WindowsFonts/
# chmod 644 /usr/share/fonts/WindowsFonts/*

These commands assume your Windows partition is mounted at /windows as they've been copied verbatim from the Arch Wiki. If you don't dual boot or don't mount your Windows partition to /windows, just replace /windows/Windows/Fonts/* with wherever location you copied that folder to.

Misc packages

I also install some packages that are generally needed in order to make things work well but don't really fall under any category here:

# in repos
pacman -S \
    libappindicator-gtk3 `#Fixes blurry icons in Electron programs` \
    appmenu-gtk-module  `#Fixes for GTK3 menus` \
    xdg-desktop-portal \
    xdg-desktop-portal `#These two instruct programs to show KDE's file picker whenever possible` \
    gtk3-nocsd-git `#makes gtk applications use qt window bar` \

To get xdg-desktop-portal to work you need to add export GTK_USE_PORTAL=1 to /etc/profile

Improving laptop battery life with TLP and powertop

Arch Wiki reference: https://wiki.archlinux.org/index.php/TLP https://wiki.archlinux.org/index.php/Powertop

Linux distros tend to deplete laptops' batteries quite quickly, which can be detrimental to some. tlp is a set-and-forget, auto-tuning option for laptops that I have found to work very well (albeit it comes with drawbacks, such as a perceived decrease in performance). Setting it up on Arch Linux is pretty straightforward:

# pacman -S tlp
# systemctl enable tlp.service --now

powertop is a powerful commandline program to keep track of battery consumption. It also allows the user to quickly alter some system settings that have an impact on battery life. You can use it to make a quick tuning:

# powertop --auto-tune

However, don't enable powertop's service if you already use TLP.

Systemd configuration

Arch Wiki reference: https://wiki.archlinux.org/index.php/Systemd/

Taming the journal's size

Systemd's system journal's size can go out of control. There are some things you can do to keep it in control:

# journalctl --vacuum-size=100M
# journalctl --vacuum-time=2weeks

Improving performance on Intel + Intel graphics

I'm using a Intel i5 7200-U CPU with Intel HD 620 integrated graphics. It's not a particularly powerful chip by any means, but with some tuning I got it to run very respectably and even allow me to play some lightweight games on the side without framerate drops or having to set low graphics (notably osu, the Portal series, Don't Starve, Starbound, Minecraft and others).

Needed packages

Install necessary packages:

# pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel intel-ucode

Intel microcode

Arch Wiki reference: https://wiki.archlinux.org/index.php/Microcode https://en.wikipedia.org/wiki/Intel_Microcode

The first thing you should do on Arch Linux if you have an Intel CPU is setting up intel-ucode.

The first thing to do to set up the microcode on my Intel laptop was to install the intel-ucode package:

# pacman -S intel-ucode

The second thing was to configure my bootloader, GRUB, with microcode early-loading. I just let grub-mkconfig handle this:

# grub-mkconfig -o /boot/grub/grub.cfg

Reboot and you're done.

Using the modesetting driver

Arch Wiki reference: https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start

I use the kernel modesetting driver for my Intel processor. To use it, it's sufficient to make sure the xf86-video-intel package is not installed. This is important because how I set up HuC / GuC depends on the kernel modesetting being used.

Enabling Early KMS

Arch Wiki reference: https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start https://wiki.archlinux.org/index.php/Mkinitcpio#Image_creation_and_activation

I decided to start kernel modesetting during the initramfs stage. To do this, you can just add the i915 module to /etc/mkinitcpio.conf like this:

MODULES=(i915)

And then

# mkinitcpio -p linux

Finally, reboot.

Solaar

My mouse is a Logitech MX Master 2S. It's fantastic, but Logitech does not provide any Linux software to control some of its settings. Fortunately, FOSS project Solaar helps with this:

# pacman -S solaar

I hide its system tray icon because KDE Plasma already tells me my mouse's remaining battery life.

Setting up touchpad gestures

Arch Wiki reference: https://wiki.archlinux.org/index.php/Libinput

libinput-gestures README: https://github.com/bulletmark/libinput-gestures/blob/master/README.md

My laptop comes with an excellent touchpad. Unfortunately, Linux distros don't ship an equally excellent touchpad driver / implementation. The only real fix would be to contribute to the Libinput project and improve it, but for now we can use libinput-gestures as a workaround.

The first thing you should do is to make sure you're using the libinput driver. If you are not, remove the xf86-input-synaptics, xf86-input-evdev packages and reboot. Finally, I'm using Xorg for this and I don't recommend using this hack in Wayland since desktop environments in Wayland typically have better touchpad gestures already.

Once that's cleared, it's time to install AUR package libinput-gestures as well as other packages from the repos we will need.

# pacman -S xdotool wmctrl
# yay -S libinput-gestures

libinput-gestures will detect touchpad gestures and run a command when any set gesture is detected. xdotool will react to this by simulating keyboard events. To allow xdotool to work, the user you're using should be added to the input group:

# gpasswd -a $USER input

My dotfiles already contain a valid ~/.config/libinput-gestures.conf file that works well with a Plasma session set up with my own keybindings. Finally, let's finish the setup:

libinput-gestures-setup autostart
libinput-gestures-setup start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment