Blurry text in Obsidian.md - How to make Obsidian.md (i.e. Electron) play nice with Wayland

Sunday, September 1, 2024

TroubleshootingObsidianWayland

Christoffer Strömblad

Entusiastisk Jedi inom Cybersäkerhet
3 minuter att läsa.

TL;DR - if you are having issues with blurry Electron based applications such as Obsidian all you probably need to do is to run the following command flatpak override --user --socket=wayland md.obsidian.Obsidian. This should resolve the issue for you, at least it did for me.

Flatpak override and wayland socket

Electron apps and Wayland are not playing entirely nice together and a consequence of this squabble is that you may experience that one or more of your apps under Linux is providing you with a rather blurry experience.

Wayland is a display server protocol aimed at replacing the older X WIndow System (X11). Unfortunately not all applications are enjoying the experience of transitioning to Wayland; Electron apps are especially sad about it all. But, fret not for there is a solution.

If you’ve spent time trying to figure out how to resolve this and tried all of these ozone-platform-hint options, and enable-features flags to no avail? Well, the problem is apparently no harder than to simply run flatpak override --user --socket=wayland md.obsidian.Obsidian.

For me that resolved this very annoying issue and I can FINALLY enjoy a clean and not-fucking-blurry text in my very important Obsidian life.

You’re welcome!

How did I find the solution?

Well, first of all I tried to manually run the affected application from the command line using flatpak run.... That in turn provided me with some debugging output, specifically the following

flatpak run md.obsidian.Obsidian --ozone-platform-hint=wayland
Deleting cache directory: /home/nopatience/.var/app/md.obsidian.Obsidian/config/obsidian/GPUCache
Debug: Will run Obsidian with the following arguments: 
Debug: Additionally, user gave: --ozone-platform-hint=wayland
[14:0831/133522.335741: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
2024-08-31 11:35:22 Loading updated app package /home/nopatience/.var/app/md.obsidian.Obsidian/config/obsidian/obsidian-1.7.1.asar
LaunchProcess: failed to execvp:
xdg-settings
[14:0831/133522.648968:ERROR:wayland_connection.cc(200)] Failed to connect to Wayland display: No such file or directory (2)
[14:0831/133522.649025:ERROR:ozone_platform_wayland.cc(265)] Failed to initialize Wayland platform
[14:0831/133522.649037:ERROR:env.cc(258)] The platform failed to initialize.  Exiting.
/app/bin/obsidian.sh: line 61:    14 Segmentation fault      (core dumped) zypak-wrapper /app/obsidian $@ ${EXTRA_ARGS[@]}

Having poked around in every other file I could find, manipulated every flag and option I thought… what’s in the script /app/bin/obsidian.sh file referenced towards the end, just before the lovely Segmentation fault.

There I found it in the sh-script file:

# Wayland support can be optionally enabled like so:
# flatpak override --user --socket=wayland md.obsidian.Obsidian

Say what now? Tried it… and it worked.

So yeah… it was there in the active Flatpak all along /var/lib/flatpak/app/md.obsidian.Obsidian/current/active/files/bin

Annoying? Well, yes. It was not an entirely obvious place to look for a solution, but thanks to some rather verbose wrapper script I could find a solution.

TroubleshootingObsidianWayland

Christoffer Strömblad

Entusiastisk Jedi inom Cybersäkerhet

Har du läst dom här?

Cyber Sunday - Vecka 35

Infekterad - Baksidan av det digitala Sverige