Skip to content

Instantly share code, notes, and snippets.

@Vertecedoc4545
Last active November 9, 2024 02:40
Show Gist options
  • Save Vertecedoc4545/3b077301299c20c5b9b4db00f4ca6000 to your computer and use it in GitHub Desktop.
Save Vertecedoc4545/3b077301299c20c5b9b4db00f4ca6000 to your computer and use it in GitHub Desktop.
Ubuntu 23.04 Build and Install instructions for Hyprland

Building on Ubuntu 23.04

You have 2 options, use the script descrived bellow or follow the instrutions

script in this gist if you want the source code

wget https://gist.githubusercontent.com/Vertecedoc4545/6e54487f07a1888b656b656c0cdd9764/raw/2c5e8ccb428fc331307e2f653cab88174c051310/build-ubuntu-23.sh
chmod +x build-ubuntu-23.sh
./build-ubuntu-23.sh

Warning you will need to add the bellow config to your hyprland.conf file after installing hyprland either way. If you detect a bug respect to xdg-portals reffer to the issue in github

misc {
  suppress_portal_warnings = true
}

INSTRUCTIONS

Nvidia building : Here

Dependencies:

Most of our dependencies are disponible in the official repos, for speed is recomendable to use nala package manager intead of apt

installing nala will keep apt

sudo apt-get install -y nala
sudo nala install -y meson wget build-essential ninja-build cmake-extras cmake gettext gettext-base fontconfig libfontconfig-dev libffi-dev libxml2-dev libdrm-dev libxkbcommon-x11-dev libxkbregistry-dev libxkbcommon-dev libpixman-1-dev libudev-dev libseat-dev seatd libxcb-dri3-dev libvulkan-dev libvulkan-volk-dev  vulkan-validationlayers-dev libvkfft-dev libgulkan-dev libegl-dev libgles2 libegl1-mesa-dev glslang-tools libinput-bin libinput-dev libxcb-composite0-dev libavutil-dev libavcodec-dev libavformat-dev libxcb-ewmh2 libxcb-ewmh-dev libxcb-present-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-res0-dev libxcb-xinput-dev libpango1.0-dev xdg-desktop-portal-wlr hwdata-dev

or if you don't want to use nala apt replacement do:

sudo apt-get install -y meson wget build-essential ninja-build cmake-extras cmake gettext gettext-base fontconfig libfontconfig-dev libffi-dev libxml2-dev libdrm-dev libxkbcommon-x11-dev libxkbregistry-dev libxkbcommon-dev libpixman-1-dev libudev-dev libseat-dev seatd libxcb-dri3-dev libvulkan-dev libvulkan-volk-dev  vulkan-validationlayers-dev libvkfft-dev libgulkan-dev libegl-dev libgles2 libegl1-mesa-dev glslang-tools libinput-bin libinput-dev libxcb-composite0-dev libavutil-dev libavcodec-dev libavformat-dev libxcb-ewmh2 libxcb-ewmh-dev libxcb-present-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-res0-dev libxcb-xinput-dev xdg-desktop-portal-wlr hwdata-dev

but some dependencies that we requiere are a little older in the repos so we need to build them

Building libs from source

first get all of our sources for building then extarct them

Hyprland and containing folder

mkdir HyprSource
cd HyprSource

## We get Source
wget https://github.com/hyprwm/Hyprland/releases/download/v0.24.1/source-v0.24.1.tar.gz
tar -xvf source-v0.24.1.tar.gz
wget https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.31/downloads/wayland-protocols-1.31.tar.xz
tar -xvJf wayland-protocols-1.31.tar.xz

wget https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.22.0/downloads/wayland-1.22.0.tar.xz
tar -xzvJf wayland-1.22.0.tar.xz

wget https://gitlab.freedesktop.org/emersion/libdisplay-info/-/releases/0.1.1/downloads/libdisplay-info-0.1.1.tar.xz
tar -xvJf libdisplay-info-0.1.1.tar.xz

now only get inside each one, we build and install directly

build wayland 1.22.0

cd wayland-1.22.0
mkdir build &&
cd    build &&

meson setup ..            \
      --prefix=/usr       \
      --buildtype=release \
      -Ddocumentation=false &&
ninja
sudo ninja install

cd ../..

bulild wayland protocols

cd wayland-protocols-1.31

mkdir build &&
cd    build &&

meson setup --prefix=/usr --buildtype=release &&
ninja

sudo ninja install

cd ../..

Lets build libdisplay-info

cd libdisplay-info-0.1.1/

mkdir build &&
cd    build &&

meson setup --prefix=/usr --buildtype=release &&
ninja

sudo ninja install

cd ../..

Lets build Hyprland!!!

you will need to change the folder permisions due to the use of sudo, so in the future you can acces and modify the folder

chmod a+rw hyprland-source

cd hyprland-source/

modify config.mk and change PREFIX=/usr/local to PREFIX=/usr or use this command

sed -i 's/\/usr\/local/\/usr/g' config.mk

also in that file you could use your custom cflags as for example adding -O3 or -Ofast optimization even -Og etc..

then only do:

sudo make install

*enjoy Hyprland !!

@neilbags
Copy link

I am running Ubuntu 22.04. I installed Hyprland up by downloading pika-sources.deb, https://ppa.pika-os.com/dists/lunar/pika-sources.deb.

Just a warning to everyone else - installing this deb wipes out your /etc/apt/sources.list

@hmajid2301
Copy link

hmajid2301 commented Nov 20, 2023

Just a warning to everyone else - installing this deb wipes out your /etc/apt/sources.list

Apologies, I missed this, thanks for raising have updated my post above.

Thanks for raising!!!!

@itsmenewbie03
Copy link

Just a warning to everyone else - installing this deb wipes out your /etc/apt/sources.list

Apologies, I missed this, thanks for raising have updated my post above.

Thanks for raising!!!!

did it worked without issues?

@itsmenewbie03
Copy link

I am running Ubuntu 22.04. I installed Hyprland up by downloading pika-sources.deb, https://ppa.pika-os.com/dists/lunar/pika-sources.deb.

Just a warning to everyone else - installing this deb wipes out your /etc/apt/sources.list

if it gets wiped out what will happen then? what should be done?
i'm sorry for a dumb a question, i'm new to linux

@neilbags
Copy link

neilbags commented Dec 3, 2023

I am running Ubuntu 22.04. I installed Hyprland up by downloading pika-sources.deb, https://ppa.pika-os.com/dists/lunar/pika-sources.deb.

Just a warning to everyone else - installing this deb wipes out your /etc/apt/sources.list

if it gets wiped out what will happen then? what should be done? i'm sorry for a dumb a question, i'm new to linux

Restore from backups

@itsmenewbie03
Copy link

I am running Ubuntu 22.04. I installed Hyprland up by downloading pika-sources.deb, https://ppa.pika-os.com/dists/lunar/pika-sources.deb.

Just a warning to everyone else - installing this deb wipes out your /etc/apt/sources.list

if it gets wiped out what will happen then? what should be done? i'm sorry for a dumb a question, i'm new to linux

Restore from backups

so i just need to back up the original before proceeding, is that correct?

@neilbags
Copy link

neilbags commented Dec 3, 2023

so i just need to back up the original before proceeding, is that correct?

No I don't think installing this .deb is a good idea at all

@itsmenewbie03
Copy link

so i just need to back up the original before proceeding, is that correct?

No I don't think installing this .deb is a good idea at all

thanks for the warning then.

@ipg0
Copy link

ipg0 commented Dec 20, 2023

for anybody doing this now, you'll also need to build the latest version of https://github.com/marzer/tomlplusplus

@AlexandreSantAnaLangunno

I nedd help .
When I go to build it, it gives the following error:

17057964495713958182432883126367

@Heus-Sueh
Copy link

Heus-Sueh commented Feb 9, 2024

Could someone try to create a pkgbuild in MPR (makedeb repo):

https://mpr.makedeb.org/

makedeb pkgbuild example:

# Contributor: your_name <your_email>
pkgname=hyprland
pkgver=0.35.0
pkgrel=1
pkgdesc="a highly customizable dynamic tiling Wayland compositor"
license=('BSD')
arch=('amd64')
conflicts=('hyprland')
provides=('hyprland')
makedepends=('cmake' 'cmake-extras' 'meson' 'build-essential' 'ninja-build' 'wget')
depends=(
    'ca-certificates'
    'libasound2>=1.0.16'
    'libatk-bridge2.0-0>=2.5.3'
    'libatk1.0-0>=2.2.0'
    'libatspi2.0-0>=2.9.90'
    'libc6>=2.14'
    'libc6>=2.15'
    'libc6>=2.17'
    'libc6>=2.4'
    'libc6>=2.8'
    'libcairo2>=1.6.0'
    'libcups2>=1.6.0'
    'libcurl3-gnutls|libcurl3-nss|libcurl4|libcurl3'
    'libdbus-1-3>=1.5.12'
    'libdrm2>=2.4.38'
    'libexpat1>=2.0.1'
    'libgbm1>=8.10'
    'libglib2.0-0>=2.12.0'
    'libglib2.0-0>=2.39.4'
    'libgtk-3-0>=3.9.10'
    'libgtk-3-0>=3.9.10|libgtk-4-1'
    'libnspr4>=2:4.9-2'
    'libnss3>=2:3.22'
    'libnss3>=3.26'
    'libpango-1.0-0>=1.14.0'
    'libsecret-1-0>=0.18'
    'libstdc++6>=5'
    'libstdc++6>=5.2'
    'libstdc++6>=6'
    'libx11-6'
    'libx11-6>=2:1.4.99.1'
    'libxcb1>=1.9.2'
    'libxcomposite1>=1:0.4.4-1'
    'libxdamage1>=1:1.1'
    'libxext6'
    'libxfixes3'
    'libxkbcommon0>=0.4.1'
    'libxkbfile1'
    'libxrandr2'
    'xdg-utils>=1.0.2'
    'gettext'
    'gettext-base'
    'fontconfig'
    'libfontconfig-dev'
    'libffi-dev'
    'libxml2-dev'
    'libdrm-dev'
    'libxkbcommon-x11-dev'
    'libxkbregistry-dev'
    'libxkbcommon-dev'
    'libpixman-1-dev'
    'libudev-dev'
    'libseat-dev'
    'seatd'
    'libxcb-dri3-dev'
    'libegl-dev'
    'libgles2'
    'libegl1-mesa-dev'
    'glslang-tools'
    'libinput-bin'
    'libinput-dev'
    'libxcb-composite0-dev'
    'libavutil-dev'
    'libavcodec-dev'
    'libavformat-dev'
    'libxcb-ewmh2'
    'libxcb-ewmh-dev'
    'libxcb-present-dev'
    'libxcb-icccm4-dev'
    'libxcb-render-util0-dev'
    'libxcb-res0-dev'
    'libxcb-xinput-dev'
    'xdg-desktop-portal-wlr'
    'libtomlplusplus3'
)
optdepends=(
    'libvulkan1'
)

source=("https://github.com/hyprwm/Hyprland/releases/download/v${pkgver}/source-v${pkgver}.tar.gz")

sha256sums=('608192d9abab899d3ed787590f86da7dc18151d1618a3455ff25e580503d58cb')

# prepare
prepare() {

}

# build
build() {

}

# install 
package() {

}

# vim: set sw=4 expandtab:


@mohammedaouamri5
Copy link

thnx bro
just in

tar -xzvJf wayland-1.22.0.tar.xz

it should be

tar -xvJf wayland-1.22.0.tar.xz

jus remove the z

@BlueTree242
Copy link

I accidentally ran this on 22.04 now I can't get into any desktop environment it just sends me back to login after 1 second

@zanexGHG
Copy link

zanexGHG commented Mar 5, 2024

I accidentally ran this on 22.04 now I can't get into any desktop environment it just sends me back to login after 1 second

If I remember correctly alt + f2 will send you to the console where you can just uninstall hyprland and reinstall gnome. Shouldnt be too complicated. If you want the easier way you just save your data and reinstall linux

@BlueTree242
Copy link

Reinstalling gnome did absolutely nothing, I already reinstalled linux because it was messed up from the beginning, I was using plasma on Ubuntu so I switched to Kubuntu

@katabame
Copy link

katabame commented Apr 9, 2024

if anybody still trying to build Hyprland on Ubuntu here, I tried research some dependency issues and finally got working built artifact
the script that I used to build is this, I wish this one help you
https://gist.github.com/katabame/e368988c968278c83c19bd5f5b60f407

@YeesterPlus
Copy link

errors : hyprinstall.sh: line 15: cd: wayland-1.22.0: No such file or directory
mkdir: cannot create directory ‘build’: File exists
ninja: error: loading 'build.ninja': No such file or directory
hyprinstall.sh: line 27: cd: wayland-protocols-1.31: No such file or directory
mkdir: cannot create directory ‘build’: File exists
ninja: error: loading 'build.ninja': No such file or directory
chmod: cannot access 'hyprland-source': No such file or directory
hyprinstall.sh: line 40: cd: hyprland-source/: No such file or directory
sed: can't read config.mk: No such file or directory
make: *** No rule to make target 'install'. Stop.

@katabame
Copy link

katabame commented May 18, 2024

errors : hyprinstall.sh: line 15: cd: wayland-1.22.0: No such file or directory mkdir: cannot create directory ‘build’: File exists ninja: error: loading 'build.ninja': No such file or directory hyprinstall.sh: line 27: cd: wayland-protocols-1.31: No such file or directory mkdir: cannot create directory ‘build’: File exists ninja: error: loading 'build.ninja': No such file or directory chmod: cannot access 'hyprland-source': No such file or directory hyprinstall.sh: line 40: cd: hyprland-source/: No such file or directory sed: can't read config.mk: No such file or directory make: *** No rule to make target 'install'. Stop.

@YeesterPlus seems you're using self-written install script (hyprinstall.sh)
as error said, needed directory doen't found. this may caused by working directory discrepancy or missing dependencies.

here's script that I used to build hyprland v0.4.0 on Ubuntu noble. if you're still stucking, please try this.
https://github.com/katabame/Ubuntu-Hyprland/

@mklx25
Copy link

mklx25 commented Jun 29, 2024

after following the steps and installing hyprland on linux mint the " hyperland" option does not appear after loggin out and trying to log back in

@mklx25
Copy link

mklx25 commented Jun 29, 2024

@defxsec for this just go to the hyprland repo take .desktop file and put it where the building from source doc from original hyprland says it

can you explain in more details
what is the hyprland repo take .desktop file? and where it is ?
and the source doc?

@forsyth47
Copy link

forsyth47 commented Jul 20, 2024

Installing Hyprland through PikaOS Repository

For anyone wanting to install hyprland from the pika-os repo, which is easier (but only if ya trust them), here is a neat and concise guide for adding the PikaOS repository, installing Hyprland, including the fix for hyprland not showing up on login screen... Since some of y'all are new to linux.


1. Download and Install the GPG Key

  1. Create a Directory for Keyrings (Skips automatically, if exists):

    sudo mkdir -p /usr/share/keyrings
  2. Download and Add the GPG Key:

    wget -qO- https://ppa.pika-os.com/key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/pikaos-archive-keyring.gpg

2. Add the Repository

  1. Create the Repository List File:

    sudo nano /etc/apt/sources.list.d/pikaos.list
  2. Add the Repository Entry:
    Add the following line to the file:

    deb [arch=amd64 signed-by=/usr/share/keyrings/pikaos-archive-keyring.gpg] https://ppa.pika-os.com pikauwu main external
    

    This line includes:

    • arch=amd64: Specifies the architecture (adjust if necessary or leave as it is).
    • signed-by=/usr/share/keyrings/pikaos-archive-keyring.gpg: Uses the GPG keyring for repository verification.
    • https://ppa.pika-os.com: Base URL for the repository.
    • pikauwu main external: Specifies the distribution and components.

3. Update Package List

Update your package list to include packages from the new repository:

sudo apt update

4. Install Packages

You can now install packages from the repository. In our case, to install hyprland:

sudo apt install hyprland

(Optional) If Hyprland does not show up in the login screen, you may need to add a .desktop file for it in the appropriate directory and maybe restart. Here’s how you can do it:

1. Create the .desktop File

  1. Open a Terminal and Create/Edit the File:

    sudo nano /usr/share/xsessions/hyprland.desktop
  2. Add the Following Content:

    [Desktop Entry]
    Name=Hyprland
    Comment=Hyprland Window Manager
    Exec=hyprland
    Type=Application
    DesktopNames=Hyprland
    
    • Name: The name that will appear in the login screen.
    • Comment: A short description of the window manager.
    • Exec: The command to start Hyprland.
    • Type: The type of desktop entry.
    • DesktopNames: The name of the desktop environment (optional, used in some login managers).
  3. Save and Exit:

    Save the file and exit the editor (Ctrl + O, Enter, Ctrl + X).

2. Ensure Permissions Are Correct

Make sure the .desktop file has the correct permissions:

sudo chmod 644 /usr/share/xsessions/hyprland.desktop

3. Restart the Display Manager

Restart your display manager to refresh the login screen options. The exact command may vary depending on your display manager (or just try all of them xD):

  • GDM (GNOME Display Manager):

    sudo systemctl restart gdm
  • LightDM:

    sudo systemctl restart lightdm
  • SDDM (Simple Desktop Display Manager):

    sudo systemctl restart sddm

4. Log In

Restart your system or log out and Hyprland should appear as an option in your login screen. Try to select Hyprland from the login screen.

Well that's it lads, have a great day and have fun ricing! 💛

@ferrreo @MartinFillon @mklx25


Edit: It seems that @katabame has a way easier solution. I would recommend to follow their method than the above for anyone who wants to install in future, here is the comment for reference:

https://gist.github.com/Vertecedoc4545/3b077301299c20c5b9b4db00f4ca6000?permalink_comment_id=5061289#gistcomment-5061289

@katabame
Copy link

katabame commented Jul 20, 2024

Edit: It seems that @katabame has a way easier solution. I would recommend to follow their method than the above for anyone who wants to install in future, here is the comment for reference:
https://gist.github.com/Vertecedoc4545/3b077301299c20c5b9b4db00f4ca6000?permalink_comment_id=5061289#gistcomment-5061289

Thanks for referencing my repository!
I'm using that repository for my own environment, so it can install keep updated hyprland.
I wrote that repository for Ubuntu noble (checking codename) so maybe there's a chance to fail installation on other Ubuntu/Debian-based repository.
If that happens, please open issue with occured environment! I'll try fix it :)

Edit: also there's another repository/project for install hyprland on Ubuntu/Debian environment with feature-rich hyprland maintained by another person. you might also like check it out
https://github.com/JaKooLit/Ubuntu-Hyprland

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment