89luca89 / io.github.luca.distrobox

Flatpak manifest for distrobox
GNU General Public License v3.0
17 stars 0 forks source link

Access to X11 #5

Open negatethis opened 1 year ago

negatethis commented 1 year ago

Distro: Fedora Kinoite 37 Beta Flatpak Version: Sept. 7, 2022 Windowing system: Wayland

I was using distrobox to run neovim from a container with R installed, and was using the Nvim-R plugin. One of its features is opening a window with X11 so you can see visualizations, such as plots or graphs. I switched to using the Flatpak version of distrobox, and noticed that these plots no longer open a window. I'm fairly certain it's because the Flatpak does not have permissions to use the X11 windowing socket. I enabled socket=x11, socket=wayland, and socket=fallback-x11 for the distrobox Flatpak using Flatseal, but even then no windows would open. I tried again, but passed the DISPLAY variable to the container, but still, nothing. What would be the proper way of giving containers access to the X11 socket?

89luca89 commented 1 year ago

@negatethis Not sure if this is related to flatpak or distrobox What errors do you get?

negatethis commented 1 year ago

When I use distrobox installed through a package manager, I can plot something in R and Nvim-R will take care of displaying the plot using X11 and it works fine. The window appears with my visualization.

When using the distrobox Flatpak, if I pass DISPLAY=:1 to my container and try to plot something in R, I get the error:

Error in .External2(C_X11, d$display, d$width, d$height, d$pointsize,  :
  unable to start device X11cairo
In addition: Warning message:                                      
In (function (display = "", width, height, pointsize, gamma, bg,  :
  unable to open connection to X11 display ''

I think the distrobox Flatpak does not have sufficient permissions to open an X11 connection. I tried opening a different GUI app in a separate container to see if it also throws an error, and sure enough I get:

Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org
Authorization required, but no authorization protocol specified
ERROR: X11 Display is not available
   at: initialize (platform/x11/os_x11.cpp:127)

An error occurred

But the same app can open just fine when using distrobox from my package manager.

89luca89 commented 1 year ago

Thanks @negatethis Will try to reproduce this, right now the flatpak package is really experimental so this type of stuff can happen