Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Support Xwayland HiDPI scaling for multi-monitor with different scale factors

Open moetayuko opened this issue 1 year ago • 3 comments

Description

The issue

The official Xwayland scaling solution xwayland:force_zero_scaling does not support multi-monitor with different scale factors. Specifically, when having two monitors of scale factors 2 and 1, Xwayland apps look good on the one of scale factor 2, but 2x larger on the one of scale factor 1.

The history

There's a draft https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733 and corresponding wlroots patches to fix the issue mentioned above: Xwayland apps will be downscaled on the monitor of scale factor 1 so they look good on both screens.

These patches were even documented in Hyprland wiki but removed after https://github.com/hyprwm/Hyprland/pull/2870 in favor of zero scaling. Nonetheless, they continued to work so users could still patch the corresponding packages to get the desired behavior, until the recent Xwayland refactoring.

What can be done

The easy way

Since Hyprland's Xwayland implementation now deviates from wlroots, the wlroots patch for https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733 is no longer effective. A new Hyprland-specific patch could be developed.

The sane(?) way

A new scaling solution for mutter is in development at https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567, which does not require patching xorg-xwayland. A similar approach could be implemented for Hyprland.

moetayuko avatar May 31 '24 03:05 moetayuko

sounds reasonable to do it the gnome way

vaxerski avatar May 31 '24 13:05 vaxerski

I've actually been testing the GNOME version of this commit for mutter as OP linked and can confirm its effectiveness, however there was some weird issues with electron which may or may not be directly related to mutter itself in that case but it was also mostly related to window resizing so probably won't be a huge issue for hyprland.

To confirm I can also replicate this issue on Fedora Silverblue on my end

AstralPhnx avatar Jun 20 '24 04:06 AstralPhnx

For xwayland apps cursor size are small issue. Source:

Sometimes in XWayland apps, the cursor is half the usual cursor size.

You can try adding the following as a startup script to manage the cursor for XWayland apps, replacing the cursor theme name and size as needed:

xsetroot -xcf /usr/share/icons/$your_cursor_theme_name/cursors/left_ptr 48

The -xcf option tells xsetroot to set the root window’s cursor using an X11 cursor file (XCF) format, and 48 is the size of the cursor in pixels.

Another option is to change your XWayland launch script to add the following:

export XCURSOR_SIZE=48 export XCURSOR_THEME=Adwaita

Nojike avatar Jul 20 '24 09:07 Nojike

Hello there!

This issue has been closed, as we are moving from issues to discussions. More about this can be found here and in #9854.

Firstly, please make sure this issue is still relevant in latest Hyprland. If so, we ask you to open a discussion (please read the discussion guidelines first, in the pinned post)

Thank you for your understanding!

vaxerski avatar Apr 05 '25 19:04 vaxerski