DEV Community

Cover image for How to dualboot Hyprland with Gnome Desktops on Linux
Ren Hiyama
Ren Hiyama

Posted on

How to dualboot Hyprland with Gnome Desktops on Linux

Linux desktops are like a box of chocolates - you never know what you’re going to get. One day, you’re working on a sleek and stylish desktop, and the next day, you’re staring at a screen that looks like it was designed in the 90s. But that’s the beauty of Linux - it’s unpredictable, quirky, and always keeps you on your toes.

Personally, I find Gnome the most usable desktop. Things just works - it stays out of my way, and apps work together with harmony, without causing any issues. Want to login to Vscode with Github? Just click yes, and gnome will open your preffered default browser automatically, login to Github, close the tab, and switch back to vscode app and log you in successfully.

However, sometimes I prefer Hyprland over Gnome. Maybe its because it looks cool, maybe you can customize it a lot, maybe it just has quality of life animations and customizable keybinds. But for me, its because Hyprland doesn't hook any keybind by default. And that includes the Win/Super key. It's just perfect for VM Guis and passing my inputs like the win key to open the windows start menu pretty easily, whereas Gnome would open its own overview panel when clicking the win key.

So, without further ado - Start by having GNOME preconfigured/already installed and ready to use.
I suggest using Fedora Workstation, it comes with Gnome desktop by default, unless you choose some other flavour.

BTW, many suggest to use other login display managers like SDDM, but I didn't find any problems using the default GDM login manager that comes with GNOME desktop by default.

For illustration purposes, I will be running Fedora Default/Gnome flavour ISO inside a VM (but dont worry, I still use Fedora on the real setup too lol)

So anyways, after setting up Gnome desktop properly, you should start by installing Hyprland package.
On Fedora, its as easy as installing sudo dnf install hyprland .

Installing Hyprland on Fedora

If everything goes perfect, you can log out to the login screen of GDM. Select your account if not already, and you will see a small "cog" icon at the bottom right. Clicking it will show available Desktops that you can use.

Select Hyprland

We now need to setup gnome polkit integration. Hyprland docs suggested kde integration, but since we want Gnome one, start by pressing win+Q to open up kitty terminal. Type in sudo dnf install polkit-gnome to do so. For other linux distros out there, consider finding a similar package by search online.

If you are setting Hyprland for the first time, you will get a yellow warning popup at the top of the screen. To remove it, you need to install a code editor like vim, edit the config file at ~/.config/hypr/hyprland.conf and remove the autogenerated=1 line.


Now the hard part - We need to setup passwords to be synced with Gnome desktop too.

If you had previously googled it, ArchWiki would say the binary was installed at /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1, however that's not the case here in Fedora.

ArchWiki Page

I found out that Fedora installs the binary at /usr/libexec/polkit-gnome-authentication-agent-1 (Thank me later). So you can run that command, and then open another terminal to try whether Gnome will ask password now back - win+Q to open another kitty terminal & type in pkexec whoami

Gnome Polkit Asking Password

If you provide the correct password, it will run the command as root user, and so it will return root to the terminal ;p

pkexec command ran successfully

So, now that we know that this polkit for gnome works successfully, we should write it to the hyprland config file to run this command everytime on logging into hyprland. To do so, open ~/.config/hypr/hyprland.conf.

gnome polkit

Now, save it and press win+M to crash/stop Hyprland, which will take you back to GDM login screen. Login back to Hyprland, and open up the terminal and run back pkexec whoami to find out that the Gnome UI like popup will ask the password back again - which confirms that Hyprland already ran that command which we asked it to.

But, its not over...
If you were already using your favorite browser on Gnome desktop before, I bet you logged into some of the sites. But if you try to open the same browser on Hyprland, you lose all your logged in passwords and such. Wonder why? It's because all those browsers and third party apps dont know what Hyprland environment is, and since they aren't inside gnome environment, they can use gnome password manager to login your online accounts. Wondering what's the solution? I did too. I searched all across the internet, and couldn't find any solution. However, I got a feeling that I should mess with the environment variables to check whether I can fake like as if I was in a Gnome environment - and to my suprise, I had succeeded!
After looking into Hyprland docs back again, I found a small spoiler alert that Hyprland sets up some envs which says to every app that they're in Hyprland environment.

oh well...

"however it is not a bad idea to set them explicitly" - oh wow... who knew the answer was put up like this?
Since we are using Wayland on both the desktops, we don't need to change the 2nd option. However, we need to set the other two envs to fake the whole environment that we are in Gnome.

Type in this to the ~/.config/hypr/hyprland.conf file, just on top/before any exec-once statements, so any command ran will have these envs setup already:



env = XDG_CURRENT_DESKTOP,GNOME
env = XDG_SESSION_DESKTOP,gnome


Enter fullscreen mode Exit fullscreen mode

Wondering where did I find these two variables? I just opened the terminal in Gnome desktop and echo'ed it back to me ;)

gnome envs

You can run any applications now, and they will be synced & logged in on both the desktops! Congrats, you have your (soon to be) dream setup! Happy ricing your Hyprland!

Never gonna...

Top comments (3)

Collapse
 
aloyshafin profile image
Aloy Shafin

however setting these environment variables
env = XDG_CURRENT_DESKTOP,GNOME
env = XDG_SESSION_DESKTOP,gnome
in hyprland.conf file will cause chromium browsers to not be able to use file picker (the thing that pops up when u choose to upload any file in any website). As it will look for xdg-desktop-portal-gnome which cant be run as we are in hyprland but because of the environment variables we set earlier the browsers think of using that and finds nothing.. i havent found a feasible solution that allows to use me both file picker and keep my passwords in chromium browsers. I hope if you find (or found) one will reply me.

Collapse
 
renhiyama profile image
Ren Hiyama

The most helpful answer I could say then is to not use both these envs.
For apps that doesnt pickup gnome keyrings properly when run in hyprland (like vscode), just append --password-store=gnome-libsecret at the end of those programs

Collapse
 
paulvlg profile image
Paul T. • Edited

Greetings! Thank you for the instructions for Fedora 40. However, with the release of version 41, the polkit-gnome package was removed due to an "orphan" issue. As a result, these instructions are not compatible with version 41 anymore.
rpms / polkit-gnome

It would be very interesting to see how this issue could be resolved in the next version of Fedora. I hope that you have already found a solution.