Whenever I try to run any Gtk+ Flatpak-ed app on wayland I get error such as:
(porto:3): Gtk-WARNING **: 00:55:13.780: cannot open display: :99.0
(setzer:2): Gtk-WARNING **: 01:01:41.868: cannot open display:
(org.gnome.Maps:2): Gtk-WARNING **: 01:02:18.136: cannot open display:
Asked
Active
Viewed 5,349 times
2

user140345
- 135
- 1
- 10
2 Answers
2
The problem seems to be that GDK_BACKEND
variable is for some reason set to X11. Run following commands to check whether you have the same problem. I'm using gnome maps, but you can use whichever app you like.
flatpak run --command=sh org.gnome.Maps
echo $GDK_BACKEND:$WAYLAND_DISPLAY:$DISPLAY
Your output should be something like wayland-0,x11:wayland-0,:0.0
. If it's not you should try experimenting with those variables
export GDK_BACKEND="wayland,x11"
export WAYLAND_DISPLAY="wayland-0"
export DISPLAY="wayland-0"
gnome-maps
Variable changes aren't permanent and are set only until container's shell is closed.

user140345
- 135
- 1
- 10
0
In my case it was a Java app under flatpak refusing to launch with said cannot open display error.
I fixed it by changing "--socket=fallback-x11"
to be just "--socket=x11"
in the flatpak manifest "finish-args"
element.

Nelson
- 49,283
- 8
- 68
- 81