/dotfiles

Dotfiles focused on productivity and high customization 🔧

Primary LanguageShellMIT LicenseMIT

Dotfiles & Configs

✅ TODO's

  • Change docs
  • Add git sub modules
  • Improve .gitignore system
  • Add .local things
  • Remove install.md

Qtile

Language

Quick Links

Table of Contents

Overview

This guide will walk you through the process of building a desktop environment starting with a fresh Arch based installation. I will assume that you are comfortable with Linux based operating systems and command line interfaces. Because you are reading this, I will also assume that you've looked through some "tiling window manager" videos on Youtube, because that's where the rabbit hole starts. You can pick any window managers you want, but I'm going to use Qtile as a first tiling window manager because that's what I started with. This is basically a description of how I made my desktop environment from scratch.

Arch installation

The starting point of this guide is right after a complete clean Arch based distro installation. The Arch Wiki doesn't tell you what to do after setting the root password, it suggests installing a bootloader, but before that I would make sure to have working internet:

pacman -S networkmanager
systemctl enable NetworkManager

Now you can install a bootloader and test it "safely", this is how to do it on modern hardware, assuming you've mounted the efi partition on /boot:

pacman -S grub efibootmgr os-prober
grub-install --target=x86_64-efi --efi-directory=/boot
os-prober
grub-mkconfig -o /boot/grub/grub.cfg

Now you can create your user:

useradd -m username
passwd username
usermod -aG wheel,video,audio,storage username

In order to have root privileges we need sudo:

pacman -S sudo

Edit /etc/sudoers with nano or vim by uncommenting this line:

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

Now you can reboot:

# Exit out of ISO image, unmount it and remove it
exit
umount -R /mnt
reboot

After logging in, your internet should be working just fine, but that's only if your computer is plugged in. If you're on a laptop with no Ethernet ports, you might have used iwctl during installation, but that program is not available anymore unless you have installed it explicitly. However, we've installed NetworkManager, so no problem, this is how you connect to a wireless LAN with this software:

# List all available networks
nmcli device wifi list
# Connect to your network
nmcli device wifi connect YOUR_SSID password YOUR_PASSWORD

Check this page for other options provided by nmcli. The last thing we need to do before thinking about desktop environments is installing Xorg:

sudo pacman -S xorg

Login and window manager

First, we need to be able to login and open some programs like a browser and a terminal, so we'll start by installing lighdm and qtile. Lightdm will not work unless we install a greeter. We also need xterm because that's the terminal emulator qtile will open by default, until we change the config file. Then, a text editor is necessary for editing config files, you can use vscode or jump straight into neovim if you have previous experience, otherwise I wouldn't suggest it. Last but not least, we need a browser.

sudo pacman -S lightdm lightdm-gtk-greeter qtile xterm code firefox

Enable lightdm service and restart your computer, you should be able to log into Qtile through lightdm.

sudo systemctl enable lightdm
reboot

Basic qtile configuration

Now that you're in Qtile, you should know some of the default keybindings.

Key Action
mod + return launch xterm
mod + k next window
mod + j previous window
mod + w kill window
mod + [asdfuiop] go to workspace [asdfuiop]
mod + ctrl + r restart qtile
mod + ctrl + q logout

Before doing anything else, if you don't have a US keyboard, you should change it using setxkbmap. To open xterm use mod + return. For example to change your layout to spanish:

setxkbmap es

Note that this change is not permanent, if you reboot you have to type that command again. See this section for making it permanent, or follow the natural order of this guide if you have enough time.

There is no menu by default, you have to launch programs through xterm. At this point, you can pick your terminal emulator of choice and install a program launcher.

# Install another terminal emulator if you want
sudo pacman -S alacritty

Now open the config file:

code ~/.config/qtile/config.py

At the beginning, after imports, you should find an array called keys, and it contains the following line:

Key([mod], "Return", lazy.spawn("xterm")),

Change that line to launch your terminal emulator:

Key([mod], "Return", lazy.spawn("alacritty")),

Install a program launcher like dmenu or rofi:

sudo pacman -S rofi

Then add keybindings for that program:

Key([mod], "m", lazy.spawn("rofi -show run")),
Key([mod, 'shift'], "m", lazy.spawn("rofi -show")),

Now restart Qtile with mod + control + r. You should be able to open your menu and terminal emulator with keybindings. If you picked rofi, you can change its theme like so:

sudo pacman -S which
rofi-theme-selector

That's it for Qtile, now you can start hacking on it and make it your own. Checkout my custom Qtile config here. But before that I would recommend configuring basic utilities like audio, battery, mounting drives, etc.

Basic system utilities

In this section we will cover some software that almost everybody needs on their system. Keep in mind though that the changes we are going to make will not be permanent. This subsection describes how to accomplish that.

Wallpaper

First things first, your screen looks empty and black, so you might want to have a wallpaper not to feel so depressed. You can open firefox through rofi using mod + m and download one. Then install feh or nitrogen and and set your wallpaper:

sudo pacman -S feh
feh --bg-scale path/to/wallpaper

Fonts

Fonts in Arch Linux are basically a meme, before you run into any problems you can just use the simple approach of installing these packages:

sudo pacman -S ttf-dejavu ttf-liberation noto-fonts

To list all available fonts:

fc-list

Audio

There is no audio at this point, we need pulseaudio. I suggest also installing a graphical program to control audio like pavucontrol, because we don't have keybindings for that yet:

sudo pacman -S pulseaudio pavucontrol

On Arch, pulseaudio is enabled by default, but you might need to reboot in order for it to actually start. After rebooting, you can open pavucontrol through rofi, unmute the audio, and you should be just fine.

Now you can set up keybindings for pulseaudio, open Qtile's config.py and add these keys:

# Volume
Key([], "XF86AudioLowerVolume", lazy.spawn(
    "pactl set-sink-volume @DEFAULT_SINK@ -5%"
)),
Key([], "XF86AudioRaiseVolume", lazy.spawn(
    "pactl set-sink-volume @DEFAULT_SINK@ +5%"
)),
Key([], "XF86AudioMute", lazy.spawn(
    "pactl set-sink-mute @DEFAULT_SINK@ toggle"
)),

For a better CLI experience though, I recommend using pamixer:

sudo pacman -S pamixer

Now you can turn your keybindings into:

# Volume
Key([], "XF86AudioLowerVolume", lazy.spawn("pamixer --decrease 5")),
Key([], "XF86AudioRaiseVolume", lazy.spawn("pamixer --increase 5")),
Key([], "XF86AudioMute", lazy.spawn("pamixer --toggle-mute")),

Restart Qtile with mod + control + r and your keybindings should work. If you're on a laptop, you might also want to control the brightness of your screen, and for that I recommend brightnessctl:

sudo pacman -S brightnessctl

You can add these keybindings and restart Qtile after:

# Brightness
Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set +10%")),
Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 10%-")),

Monitors

If you have a multi-monitor system, you surely want to use all your screens. Here's how xrandr CLI works:

# List all available outputs and resolutions
xrandr
# Common setup for a laptop and a monitor
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x1080 --output HDMI-1 --mode 1920x1080 --pos 0x0

We need to specify the position for each output, otherwise it will default to 0x0, and all your outputs will be overlapped. Now if you don't want to calculate pixels and stuff you need a GUI like arandr:

sudo pacman -S arandr

Open it with rofi, arrange your screens however you want, and then you can save that layout, which will basically give you a shell script with the exact xrandr command that you need. Save that script, but don't click "apply" just yet.

For a multi-monitor system, it's recommended to create an instance of a Screen object for each monitor in your Qtile config.

You'll find an array called screens which contains only one object initialized with a bar at the bottom. Inside that bar you can see the default widgets that come with it.

Add as many screens as you have and copy-paste all widgets, later you can customize them. Now you can go back to arandr, click apply, and then restart Qtile.

Now your multi-monitor system should work.

Storage

Another basic utility you might need is automounting external hard drives or USBs. For that I use udisks and udiskie. udisks is a dependency of udiskie, so we only need to install the last one. Install also ntfs-3g package to read and write NTFS formatted drives:

sudo pacman -S udiskie ntfs-3g

Network

We have configured the network through nmcli, but a graphical frontend is more friendly. I use nm-applet:

sudo pacman -S network-manager-applet

Systray

By default, you have a system tray in Qtile, but there's nothing running in it. You can launch the programs we've just installed like so:

udiskie -t &
nm-applet &

Now you should see icons that you can click to configure drives and networking. Optionally, you can install tray icons for volume and battery:

sudo pacman -S volumeicon cbatticon
volumeicon &
cbatticon &

Notifications

I like having desktop notifications as well, for that you need to install libnotify and notification-daemon:

sudo pacman -S libnotify notification-daemon

For a tiling window manager, this is how you can get notifications:

# Create this file with nano or vim
sudo nano /usr/share/dbus-1/services/org.freedesktop.Notifications.service
# Paste these lines
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/notification-daemon-1.0/notification-daemon

Test it like so:

notify-send "Hello World"

Xprofile

As I have mentioned before, all these changes are not permanent. In order to make them permanent, we need a couple things. First, install xinit:

sudo pacman -S xorg-xinit

Now you can use ~/.xprofile to run programs before your window manager starts:

touch ~/.xprofile

For example, if you place this in ~.xprofile:

xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x1080 --output HDMI-1 --mode 1920x1080 --pos 0x0 &
setxkbmap es &
nm-applet &
udiskie -t &
volumeicon &
cbatticon &

Every time you login you will have all systray utilities, your keyboard layout and monitors set.

Further configuration and tools

AUR helper

Now that you have some software that allows you tu use your computer without losing your patience, it's time to do more interesting stuff. First, install an AUR helper, I use yay:

sudo pacman -S base-devel git
cd /opt/
sudo git clone https://aur.archlinux.org/yay-git.git
sudo chown -R username:username yay-git/
cd yay-git
makepkg -si

With an Arch User Repository helper, you can basically install any piece of software on this planet that was meant to run on Linux.

Media Transfer Protocol

If you want to connect your phone to your computer using a USB port, you'll need MTP implementation and some CLI to use it, like this one:

sudo pacman -S libmtp
yay -S simple-mtpfs

# List connected devices
simple-mtpfs -l
# Mount first device in the previous list
simple-mtpfs --device 1 /mount/point

File Manager

We've done all files stuff through a terminal up to this point, but you can install graphical or terminal based file managers. For a graphical one, I suggest pcmanfm, and for a terminal based one, ranger, although this one is very vim-like, only use it if you know how to move in vim.

sudo pacman -S thunar ranger

Trash

If you don't want to rm all the time and potentially lose files, you need a trashing system. Luckily, that's pretty easy to do, using some of these tools such as glib2, and for GUIs like thunar you need gvfs:

sudo pacman -S glib2 gvfs
# CLI usage
gio trash path/to/file
# Empty trash
gio trash --empty

With pcmanfm you can open the trash clicking on the left panel, but on the command line you can use:

ls ~/.local/share/Trash/files

GTK Theming

The moment you have been wating for has arrived, you are finally going to install a dark theme. I use Material Black Colors, so go grab a flavor here and the matching icons here.

I suggest starting with Material-Black-Plum-1.9.3 and Material-Black-Plum-Suru-1.9.2. You can find other GTK themes on this page. Once you have your theme folders downloaded, this is what you do:

# Assuming you have downloaded Material-Black-Blueberry
cd Downloads/
sudo pacman -S unzip
unzip Material-Black-Plum.zip
unzip Material-Black-Plum-Suru.zip
rm Material-Black*.zip

# Make your themes available
sudo mv Material-Black-Plum /usr/share/themes
sudo mv Material-Black-Plum-Suru /usr/share/icons

Now edit ~/.gtkrc-2.0 and ~/.config/gtk-3.0/settings.ini by adding these lines:

# ~/.gtkrc-2.0
gtk-theme-name = "Material-Black-Plum"
gtk-icon-theme-name = "Material-Black-Plum-Suru"

# ~/.config/gtk-3.0/settings.ini
gtk-theme-name = Material-Black-Plum
gtk-icon-theme-name = Material-Black-Plum-Suru

Next time you log in, these changes will be visible. You can also install a different cursor theme, for that you need xcb-util-cursor. The theme I use is Breeze, download it and then:

sudo pacman -S xcb-util-cursor
cd Downloads/
tar -xf Breeze.tar.gz
sudo mv Breeze /usr/share/icons

Edit /usr/share/icons/default/index.theme by adding this:

[Icon Theme]
Inherits = Breeze

Now, again, edit ~/.gtkrc-2.0 and ~/.config/gtk-3.0/settings.ini:

# ~/.gtkrc-2.0
gtk-cursor-theme-name = "Breeze"

# ~/.config/gtk-3.0/settings.ini
gtk-cursor-theme-name = Breeze

Make sure not to mistype the names of your themes and icons, they should match the names of the directories where they are located, the ones you can see in this output:

ls /usr/share/themes
ls /usr/share/icons

Remember that you will only see the new theme if you log in again. There are also graphical frontends for changing themes, I just prefer the traditional way of editing files though, but you can use lxappearance, which is a desktop environment independent GUI for this task, and it lets you preview themes.

sudo pacman -S lxappearance

Finally, if you want tranparency and fancy looking things, install a compositor:

sudo pacman -S picom
# Run it like so, place it in ~/.xrofile
picom &

Qt

GTK themes will not be applied to Qt programs, but you can use Kvantum to change the default theme:

sudo pacman -S kvantum-qt5
echo "export QT_STYLE_OVERRIDE=kvantum" >> ~/.profile

Lightdm theming

We can also change the theme of lightdm and make it look cooler, because why not? We need another greeter, and some theme, namely lightdm-webkit2-greeter and lightdm-webkit-theme-aether:

sudo pacman -S lightdm-webkit2-greeter
yay -S lightdm-webkit-theme-aether

These are the configs you need to make:

# /etc/lightdm/lightdm.conf
[Seat:*]
# ...
# Uncomment this line and set this value
greeter-session = lightdm-webkit2-greeter
# ...

# /etc/lightdm/lightdm-webkit2-greeter.conf
[greeter]
# ...
webkit_theme = lightdm-webkit-theme-aether

Ready to go.

Multimedia

There are dozens of programs for multimedia stuff, check this page.

Images

For image previews, one of the best that I could find is geeqie:

sudo pacman -S geeqie

Video and audio

No doubt vlc is exactly what you need:

sudo pacman -S vlc

Start Hacking

With all you've done so far, you got all the tools to start playing with configs and make your desktop environment, well, yours. What I recommend is hacking on Qtile to adding keybindings for common programs like firefox, a text editor, file manager, etc.

Once you feel comfortable with Qtile, you can install other tiling window managers, and you will have more sessions available when logging in through lightdm.

Here you have a list of all my window manager configs, which are located in this repository and have their own documentation:

Gallery

Qtile

Keybindings

These are common keybindings to all my window managers.

Windows

Key Action
mod + j next window (down)
mod + k next window (up)
mod + shift + h decrease master
mod + shift + l increase master
mod + shift + j move window down
mod + shift + k move window up
mod + shift + f toggle floating
mod + tab change layout
mod + [1-9] Switch to workspace N (1-9)
mod + shift + [1-9] Send Window to workspace N (1-9)
mod + period Focus next monitor
mod + comma Focus previous monitor
mod + w kill window
mod + ctrl + r restart wm
mod + ctrl + q quit

The following keybindings will only work if you install all programs needed:

sudo pacman -S rofi thunar firefox alacritty redshift scrot

To set up rofi, check this README, and for alacritty, this one.

Apps

Key Action
mod + m launch rofi
mod + shift + m window nav (rofi)
mod + b launch browser (firefox)
mod + e launch file explorer (pcmanfm)
mod + return launch terminal (alacritty)
mod + r redshift
mod + shift + r stop redshift
mod + s screenshot (flameshot)
mod + shift + s screenshot with timer (scrot)

Software

Basic utilities

Software Utility
networkmanager Self explanatory
network-manager-applet NetworkManager systray
pulseaudio Self explanatory
pavucontrol pulseaudio GUI
pamixer pulseaudio CLI
brightnessctl Laptop screen brightness
xinit Launch programs before wm starts
libnotify Desktop notifications
notification-daemon Self explanatory
udiskie Automounter
ntfs-3g NTFS read & write
arandr GUI for xrandr
cbatticon Battery systray
volumeicon Volume systray
glib2 Trash
gvfs Trash for GUIs

Fonts, theming and GTK

Software Utility
Picom Compositor for Xorg
UbuntuMono Nerd Font Nerd Font for icons
Material Black GTK theme and icons
lxappearance GUI for changing themes
nitrogen GUI for setting wallpapers
feh CLI for setting wallpapers

Apps

Software Utility
alacritty Terminal emulator
pcmanfm Graphical file explorer
ranger Terminal based explorer
neovim Terminal based editor
rofi Menu and window switcher
scrot Screenshot
flameshot Captura de pantalla
redshift Take care of your eyes
trayer Systray