In this post, we will continue the arch journey, we are going to install a wayland compositor

Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn’t sacrifice on its looks.

wiki

repo

Warning before install

Hyprland is not meant to be a full and user-friendly Desktop Environment. In a nutshell, it’s a set of tools to allow you to create your own Desktop Environment.

Apps, integrations, shells, etc, are your responsibility to pick, install and configure.

This wiki is very verbose. It’s highly recommended to scour and read the wiki first before assuming something is not working or not available.

We officially run and test Hyprland on Arch and NixOS, and we guarantee Hyprland will work there. For any other distro (not based on Arch/Nix) you might have varying amounts of success. However, since Hyprland is extremely bleeding-edge, distros like Pop!_OS, Ubuntu, etc. will have major issues running Hyprland. Rolling release distros like Fedora, OpenSUSE, etc. will likely be fine.

Installation

EHHHH there’s no internet connection, and you don’t have iwctl, you can use nmtui

  1. start the nmtui

before that make sure networkManager is running

systemctl start NetworkManager
nmtui
pacman -S hyprland

If it doesn’t work , try sync repo, update packages , then install

pacman -Syu hyprland

BTW, there’s a pre-configured hyprland setup , created by DHH, here is the omarchy website, maybe feels like back when I choose LazyVim, get comfortable then decide to not to use a distro.

Before that , install font to make neovim looks normal

pacman -Syu ttf-hack-nerd

give pacman the ability to manager your fonts, dont by creating an Arch package.

Install kitty terminal, latter will be used in hyprland too

pacman -Syu kitty

However , the X11 DISPLAY environment variable is missing

Install X11

pacman -Syu xorg-server xorg-xinit xorg-twm xorg-xclock xterm

determine what gpu you are using

lspci -k | grep -EA3 'VGA|3D|Display'

For my laptop, it’s Intel

install graphics drivers and essential wayland packages

pacman -S --needed mesa vulkan-intel hyprland kitty xorg-xwayland

install the dependencies:

install yay, An AUR Helper Written in Go

You cannot run makepkg in root,

create a non-root user for daily use

# useradd -m -g users -G wheel,storage,video,audio,power -s /bin/bash yourusername
useradd -m -g users -G wheel,storage,video,audio,power -s /bin/bash davidgao
  • -m: Creates the user’s home directory (/home/yourusername).

  • -g users: Sets users as the primary group for this account.

  • -G wheel,storage,video,audio,power: Adds the user to common supplementary groups:

    • wheel: This group is typically used to grant sudo access.

    • storage: Allows access to storage devices.

    • video: Grants access to video hardware.

    • audio: Grants access to sound hardware.

    • power: Allows shutdown/reboot capabilities from the user session.

  • -s /bin/bash: Sets Bash as the default login shell.

switch user

# su - yourusername # Replace yourusername with the non-root username you created
su davidgao
# clone yay into davidgao's dir
cd /home/davidgao

You have to switch to non root user to build yay

You have to install go lang to build yay

# switch to root
su root
sudo pacman -S go

change to user davidgao, add write access tot he yay source dir

su root
chown davidgao yay/

if you are in China… set go proxy

unset http_proxy https_proxy ALL_PROXY
export GOPROXY="https://goproxy.cn,direct" && makepkg -si
su davidgao
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

You can also build using yay-bin (specially in China…)

add sudo permission to the user davidgao

id davidgao
usermod -aG wheel davidgao

edit sudoers file (/etc/sudoers)

EDITOR=vim visudo

in the editor, find this exact line:

# %wheel ALL=(ALL:ALL) ALL

Delete only the # symbol at the very beginning of that line. It should become:

%wheel ALL=(ALL:ALL) ALL

save and exit vim

back to non-root user (davidgao)

Once you’re logged in as davidgao, try a simple sudo command:

sudo whoami
  • It should prompt you for [sudo] password for davidgao:. Enter davidgao’s password.
  • If successful, it should output root. This means sudo is working!
su - davidgao   # The '-' ensures a full relogin for group changes to take effect
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
yay -S ninja gcc cmake meson libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite libxrender libxcursor pixman wayland-protocols cairo pango libxkbcommon xcb-util-wm xorg-xwayland libinput libliftoff libdisplay-info cpio tomlplusplus hyprlang-git hyprcursor-git hyprwayland-scanner-git xcb-util-errors hyprutils-git glaze hyprgraphics-git aquamarine-git re2 hyprland-qtutils

and then type

You can also build from source(recommended)

git clone --recursive https://github.com/hyprwm/Hyprland
cd Hyprland
make all && sudo make install

EDIT: I’m stupid, just run hyprland in root then you can goto main screen -<_-, HOWEVER in the manual it specifically warn that

[WARN] Do not launch Hyprland with root permissions (don’t sudo)

If you hit “Permission denied” when running Hyprland as a user means that this user lacks permissions or environment setup to interact with the display hardware or Wayland’s session management.

Here are the most common reasons and how to check/fix them:

1. Check User Group Memberships (Most Common Initial Cause): Your user needs to be part of specific groups to access graphics, input, and other devices. While video is crucial, others like input and render are also sometimes necessary.

  • Log in as your davidgao user in the terminal.

  • Run the following command to check your group memberships:

    id davidgao
    
  • You should see wheel, storage, video, audio, power (from our useradd command) and potentially input and render.

    • If input or render are missing, add them (as root):
# First, switch to root
exit # if you are davidgao, or su -
# As root, run:
usermod -aG input,render davidgao
# Then, exit root and fully log out of davidgao and log back in
exit # to leave root
# Then, full logout/login as davidgao
exit # from davidgao
# Login again at the TTY prompt as davidgao

2. Check XDG_RUNTIME_DIR (Crucial for Wayland): Wayland compositors (like Hyprland) heavily rely on a temporary directory (XDG_RUNTIME_DIR) that’s set up when a user logs in. This is usually handled by systemd-logind.

  • As your davidgao user in the terminal, run:

    echo $XDG_RUNTIME_DIR
    
  • Expected output: A path like /run/user/1000 (where 1000 is your user’s UID, which you can see from id davidgao).

  • If the output is blank or missing: This means your systemd user session (which sets up XDG_RUNTIME_DIR) isn’t starting correctly. This is often the root cause of “Permission denied.”

To ensure XDG_RUNTIME_DIR is set up correctly:

  • Ensure systemd-logind.service is running: (It should be enabled by default, but verify.)
    • Switch to root: exit
    • Check status: systemctl status systemd-logind.service (It should be active (running)).
    • If it’s not, enable and start it: systemctl enable --now systemd-logind.service
    • Switch back to davidgao: exit
  • Perform a Full Logout and Login:
    • Even if systemd-logind is running, changes to user groups or the login environment often require a full logout from the TTY and then logging back in for the systemd user session to properly initialize.
    • From your davidgao TTY session, type exit to log out.
    • At the login: prompt, log in as davidgao again.
    • Then, try echo $XDG_RUNTIME_DIR again. If it’s now set, proceed.

Once XDG_RUNTIME_DIR is confirmed to be set (not blank) and you’ve verified your group memberships, try launching Hyprland again as davidgao:

Hyprland

Oops this is when you run in root, here is the correct one (no anime girl, sad, but you have cursor)

hyprland, btw