Skip to content

Instantly share code, notes, and snippets.

@hallettj
Last active January 10, 2023 20:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hallettj/3075e5fee24ce62dafef9c87ec353630 to your computer and use it in GitHub Desktop.
Save hallettj/3075e5fee24ce62dafef9c87ec353630 to your computer and use it in GitHub Desktop.
How I set up fractional scaling in Gnome

Fractional Scaling

With a bigger display 2x scaling might be too big. I'm trying out experimental support for fractional scaling in Gnome. To opt out again it is necessary to undo this experimental features setting:

$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

In addition to fractional scaling that setting allows different scaling factors per monitor!

The only issue I'm seeing so far is that apps running with XWayland look fuzzy. That includes web browsers. But! Firefox and Chrome both have opt-in support for Wayland which fixes the problem.

Firefox

For Firefox Wayland support set this environment variable:

$ MOZ_ENABLE_WAYLAND=1 firefox

There is a "Window Protocol" entry in about:support to confirm that the setting is active. But it's also very obviously less fuzzy.

I added ~/.config/profile.d/80-firefox to my dot-xmonad files to set that environment variable on login if Wayland is running.

Chrome

For Chrome Wayland support launch Chrome with this flag:

$ google-chrome --ozone-platform-hint=auto

Making this permanent requires editing launchers AFAICT.

  • I edited ~/.local/share/applications/chrome-cinhimbnkkaeohfgghhklpknlkffjgod-Default.desktop to set the flag for the Youtube Music launcher.
  • I copied /usr/share/applications/google-chrome.desktop to ~/.local/share/applications/ and modified line 108 to set the flag.

The Arch version of Chrome is specially configured to read flags from a config file. Some day...

Obsidian, Signal

Electron apps are configured to use Wayland similarly to Chrome:

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

Once again Arch has support for a special configuration file, ~/.config/electron-flags, but Debian does not. At least I think that is Arch specific - it might just be that some Electron apps read that file, and some don't

So once again I made an override for the launcher. I read a helpful post on where Flatpak puts launcher files. I copied /var/lib/flatpak/exports/share/applications/md.obsidian.Obsidian.desktop to ~/.local/share/applications/, and I modified the Exec line to add the above flags.

Signal is also installed through Flatpak, so I made a similar launcher override.

Discord

Discord is another Electron app, so I made another launcher override. This time I copied /usr/share/applications/discord.desktop to ~/.local/share/applications/.

Slack

I tried to make a launcher override for Slack the same way as for Obsidian and Signal, but the app fails to start. I get this error:

❮ flatpak run --branch=stable --arch=x86_64 --command=slack --file-forwarding com.slack.Slack @@u --enable-features=
UseOzonePlatform --ozone-platform=wayland @@
Initializing local storage instance
(electron) Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set
 { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reportin
g servers support.
[2:0707/133637.389912:ERROR:wayland_connection.cc(209)] Failed to connect to Wayland display
[2:0707/133637.389945:ERROR:ozone_platform_wayland.cc(226)] Failed to initialize Wayland platform
[2:0707/133637.389949:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.
[0707/133637.390209:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Operation not permitted (1)

Maybe this will work after a future Slack update.

@Wunderharke
Copy link

Slack is working out of the box by now. You might have to enable the Wayland socket tho (e.g. in flatseal).

@Wunderharke
Copy link

By adding --enable-features=UseOzonePlatform --ozone-platform=wayland as suggested here one loses window decorations therefore windows aren't movable anymore. You can try to fix this by adding --enable-features=WaylandWindowDecorations. Credits to @gordallott who posted this info here .

@Wunderharke
Copy link

Get better results for chrome by just setting your preferred window server at chrome://flags/#ozone-platform-hint (make sure wayland socket is activated).

@hallettj
Copy link
Author

Thanks so much for the updates! I'll work on updating my notes soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment