Changing flatpak app startup settings?

While trying to change Discord to use Wayland:

$ flatpak run com.discordapp.Discord --enable-features=UseOzonePlatform --ozone-platform=wayland 

Disabling updates already done
[5:0603/051518.107507:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Discord 0.0.54
[5:0603/051518.417571:ERROR:wayland_connection.cc(193)] Failed to connect to Wayland display: No such file or directory (2)
[5:0603/051518.417587:ERROR:ozone_platform_wayland.cc(259)] Failed to initialize Wayland platform
[5:0603/051518.417591:ERROR:env.cc(257)] The platform failed to initialize.  Exiting.
/app/bin/com.discordapp.Discord: line 17:     5 Segmentation fault      (core dumped) env TMPDIR=$XDG_CACHE_HOME zypak-wrapper /app/discord/Discord $FLAGS "$@"
2024/06/03 05:15:18 socat[3] W exiting on signal 15

I guess this Discord package does not support Wayland?
Or, is there a different way to change the settings?

Flatpak Discord runs on Wayland on my machine without me needing to add any flags. Have you enabled the toggle for Wayland within Flatseal?

Also I believe UseOzonePlatform is no longer needed by Chromium-based browsers and Electron apps, --ozone-platform-hint=auto should be enough. --ozone-platform-hint=auto --enable-features=VaapiVideoDecodeLinuxGL,WebRTCPipeWireCapturer enables Wayland and HW acc for me on Chromium, Slack, and Webcord, for example.

Ok, I’m not familiar with flatseal, maybe that’s my problem.

oh wow, flatseal has lots of options. ,Discord uses wayland now, Thank you!

So for the others, I guess I look in Flatseal for references to

 --ozone-platform-hint=auto --enable-features=VaapiVideoDecodeLinuxGL,WebRTCPipeWireCapturer 

?

I believe Discord will launch under Wayland by default if the Wayland socket toggle is enabled, so you shouldn’t need to do anything else.

For browsers, such as Chromium, it’s easier to create a .conf file containing those files, so f.ex, for Flatpak Chromium it would be like this:

│ ~
│ cat ~/.var/app/org.chromium.Chromium/config/chromium-flags.conf 
--ozone-platform-hint=auto
--enable-features=VaapiVideoDecodeLinuxGL,WebRTCPipeWireCapturer

This also works for Ms. Edge, just replace the folder name with com.microsoft.Edge and the file name with edge-flags.conf. Also, I don’t think WebRTCPipeWireCapturer is actually required for browsers, so you’re free to just use VaapiVideoDecodeLinuxGL.

It’s also possible to use the flags.conf method with Slack or Webcord for example, but AFAIK you have to name the file something like electron[version]-flags.conf. It’s easy to keep track of which Electron version if you build the package yourself, but with Flatpak it’s kind of a hassle because you’ll have to track the build specs from Github. Because of this, I typically use Main Menu to add the flags to the desktop entry, so it looks like this:

Execution Command
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=com.slack.Slack --file-forwarding com.slack.Slack --ozone-platform-hint=auto --enable-features=VaapiVideoDecodeLinuxGL,WebRTCPipeWireCapturer @@u %U @@

Basically just put the flags after the app ID, in this case com.slack.Slack. In this case I added WebRTCPipeWireCapturer because in my personal experience, screen sharing becomes much more reliable

One thing to remember is that if you uninstall the app, the modified desktop entry will not be automatically removed. You have to manually remove it from Main Menu.

Add.: On Flatseal I typically enable Wayland here so I don’t have to manually enable it for all possible apps. :wink:

1 Like

exemplary response, thank you.

Much appreciated :partying_face:

Your post actually inspired me to do some digging, and apparently now you can set ELECTRON_OZONE_PLATFORM_HINT=auto instead as an environment variable via Flatseal in place of the --ozone-platform-hint=auto flag.

In curiosity I tried to set ELECTRON_ENABLE_FEATURES=VaapiVideoDecodeLinuxGL as well, but it didn’t work. Tested by playing a video on Slack and monitoring sudo intel_gpu_top - with. So you still have to use the --enable-features= flag within the execution command.

I still think it’s easier to use Main Menu to add both --ozone-platform-hint= and --enable-features=. But now you (and I) know there’s an alternative for Electron apps!

1 Like