Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run Compass under native Wayland? #3938

Open
sepehr opened this issue Jan 5, 2023 · 7 comments
Open

How to run Compass under native Wayland? #3938

sepehr opened this issue Jan 5, 2023 · 7 comments

Comments

@sepehr
Copy link

sepehr commented Jan 5, 2023

Since Electron 12.x, there is support for native Wayland through the use of these feature flags:

--enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

or using --ozone-platform-hint=auto. This is the way to avoid a badly-stretched blurry, and hardly-usable UI on HiDPI displays. HiDPI Wayland users usually run VSCode, Chromium itself, and other popular Electron apps like so.

Passing those arguments to Compass on a Fedora 37, Gnome 4.32 desktop using:

flatpak run com.mongodb.Compass --enable-features=UseOzonePlatform --ozone-platform=wayland

Compass crashes with:

[3:0105/181354.163494:ERROR:wayland_connection.cc(180)] Failed to connect to Wayland display
[3:0105/181354.163517:FATAL:ozone_platform_wayland.cc(211)] Failed to initialize Wayland platform
/app/bin/run.sh: line 2:     3 Trace/breakpoint trap   (core dumped) zypak-wrapper '/app/main/MongoDB Compass' "$@"

I wonder how we could safely pass native wayland feature flags down to Electron and Chromium? It's definitely not a pleasure to use Compass in XWayland. Passing --ignore-additional-command-line-flags did not help.


blurry compass under XWayland

@addaleax
Copy link
Collaborator

addaleax commented Jan 6, 2023

@sepehr We aren’t doing that much in terms of fancy work on top of Electron, so this probably isn’t very Compass-specific. At the same time, I’m not an expert for how Electron/Chromium work with different display servers.

Do you know if there would be a way to repro this without having to fully set up a physical machine using wayland?

@sepehr
Copy link
Author

sepehr commented Jan 18, 2023

@addaleax Thanks for the follow-up and apologies for the my late reply.

I have to look closer tbh. However, knowing that there is upstream support for native Wayland in Electron, Compass job is done if we are sure that the arguments it does not recognize are passed downwards to Electron rather than being omitted.

Here's how VSCode output look like when it's passed the wayland-specific arguemnts:

Warning: 'enable-features' is not in the list of known options, but still passed to Electron/Chromium.
Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.

I hope I'll find the time to look into this closer.

@ahmafi
Copy link

ahmafi commented Mar 23, 2023

I ended up using the rpm package instead of flatpak. Like this:

mongodb-compass --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland --ignore-additional-command-line-flags

@sepehr
Copy link
Author

sepehr commented Mar 28, 2023

Thanks for your input @ahmafi. I ended up ditching fractional scaling to address my issues. With 200% scaling, things are vivid again.

@seantcanavan
Copy link

seantcanavan commented Feb 19, 2024

the flatpak route did not help me unfortunately as I just got different critical GPU errors:

flatpak run com.mongodb.Compass --enable-features=UseOzonePlatform --ozone-platform=wayland

flatpak run com.mongodb.Compass --enable-features=UseOzonePlatform --ozone-platform=wayland                                                                                                                             

Note that the directories 

'/var/lib/flatpak/exports/share'
'/home/userhome/.local/share/flatpak/exports/share'

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

[3:0219/120110.383040: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
[3:0219/120110.553187:ERROR:wayland_connection.cc(193)] Failed to connect to Wayland display: No such file or directory (2)
[3:0219/120110.553201:ERROR:ozone_platform_wayland.cc(259)] Failed to initialize Wayland platform
[3:0219/120110.553209:ERROR:env.cc(257)] The platform failed to initialize.  Exiting.
/app/bin/run.sh: line 2:     3 Segmentation fault      (core dumped) zypak-wrapper '/app/main/MongoDB Compass' "$@"

However, this approach finally did work but after a reboot. I suspect I had too many pre-existing versions of the app already run with different parameters after trying a bunch of different things to get it to start up.

yay -Syu mongodb-compass mongodb-compass --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland --ignore-additional-command-line-flags

Also this is very specific to my distro most likely but I was missing a backend for Manjaro Sway:

sudo pacman -Syu xdg-desktop-portal-gtk
sudo pacman -Syu xdg-desktop-portal-wlr

I'm a little beyond my depth here so I don't know exactly why the above commands are needed but I'm able to run compass now.

@Ugzuzg
Copy link

Ugzuzg commented Jun 13, 2024

It would be great if the app also respected $XDG_CONFIG_HOME/electron-flags.conf options.

@faileon
Copy link

faileon commented Sep 27, 2024

I am gonna post my fair share of problems with wayland and mongo-compass, the whole discussion is here:
https://bbs.archlinux.org/viewtopic.php?pid=2198925#p2198925

tl;dr is that if I have env variable
ELECTRON_OZONE_PLATFORM_HINT
set to any value auto or wayland, the app will not render at all. I must unset the variable to get compass to render. This will use xwayland, but at least it works.

In combination with fixing credential storage, I changed my desktop file
/usr/share/applications/mongodb-compass.desktop
by setting the Exec line to:
Exec=env MONGODB_COMPASS_TEST_LOG_DIR=/dev/null ELECTRON_OZONE_PLATFORM_HINT= mongodb-compass --ignore-additional-command-line-flags --password-store="gnome-libsecret" %U

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants