Can't launch X11-only apps under Wayland running Hyprland

Hey there,

I recently switched my NixOS desktop from X11 (bspwm) to Wayland (Hyprland).
Hyprland is great, and I’ve seen some improvements of Wayland over X11 that I quite like.

However, kind of big issue is that I cannot get applications to launch that do not have a native Wayland client. From the JetBrains IDEs to something simple like xclock, I cannot get them to launch whatever I try, even though XWayland is enabled.

Whenever I try launching xclock for example, it complains about not being able to open a display:

Error: Can't open display: :0

Similar error messages pop up for other X11 applications.

I found several threads online, but couldn’t get to the bottom of my issue. I checked environment variables for issues and couldn’t find any. My WAYLAND_DISPLAY variable is set to “wayland-0” and I’ve tried setting DISPLAY to different values.

The only thing suggested that I haven’t tried, is what this comment on GH suggests, which is that setting GDK_BACKEND is a bad idea, and Hyprland should therefore better be installed using the upstream Hyprland flake.
The official docs also propose installing Hyprland from the upstream flake, but unfortunately I wasn’t able to integrate it into my existing config.

The NixOS hyprland module sets GDK_BACKEND to “wayland,x11” and I’m unsure if that might be causing the issues.

The hyprland module of my config can be found here.

Thanks in advance!

Alright, I’m still not sure what the issue exactly was, but switching to unstable seems to have solved the issue I was having with X11-only apps not launching, along with a bunch of other issues.

Lesson-learned…only run Hyprland on unstable or NixOS versions later than 22.05.

Did you happen to document your journey from bspwm to Hyprland? I too am embarking on the exact same journey, but after a day on Hyprland, I found my system to be quite unreliable and unstable.

Are you using waybar? Did you manage to get workspaces displayed in the bar?

No, sorry. I did not really document much. However, my dotfiles are publicly available. You can view them here.

My Hyprland module is still a mess.

As Hyprland was my first venture into Wayland, a lot of necessary environment variables had to be set, and I’ve recently noticed that enabling KDE Plasma, takes care of setting most of them or at least the necessary ones.

Since I wanted to enable it alongside of Hyprland on my desktop PC, I had to disable to the environment variables for now but before adding Plasma and XFCE, Hyprland worked fine with this config and all the environment variables set. I still have to clean up the desktop modules, but didn’t find the time.

I’ve got waybar configured, but haven’t had time to include the workspaces, because it wasn’t obvious how to do it.

My waybar looks like this but I haven’t worked on it recently:

Let me know if I can help you with anything else.