Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

xwayland: support HiDPI scale

Open moetayuko opened this issue 1 year ago • 17 comments

Describe your PR, what does it fix/add?

This supports the xorg-xwayland patch at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733

Ported from https://gitlab.freedesktop.org/lilydjwg/wlroots/-/commit/5a7c65cab11c9f3c3dc79f9c4cfb8a6acf6cbaae

See #6281 for motivation.

AUR package hyprland-hidpi-xprop-git applies this patch on top of hyprland mainline. After installing, do the following to enable (scaling factor 2 in this example):

  1. Add exec-once = systemctl --user start xsettingsd.service && echo "Xft.dpi: 192" | xrdb -merge && xprop -root -format _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 to hyprland configuration.
  2. Add the following to ~/.config/xsettingsd/xsettingsd.conf
    Gdk/UnscaledDPI 98304
    Gdk/WindowScalingFactor 2
    
  3. Remove GDK_SCALE, QT_SCALE_FACTOR, and other per-application scaling options.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

N/A

Is it ready for merging, or does it need work?

No, for cherry-pick only

moetayuko avatar Jun 12 '24 15:06 moetayuko

what advantages does this have over force_zero_scaling?

vaxerski avatar Jun 12 '24 15:06 vaxerski

what advantages does this have over force_zero_scaling?

Quoting from my description in #6281:

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.

moetayuko avatar Jun 12 '24 15:06 moetayuko

What is required to get this into a state where it can be merged? I would love to see this feature merged into Hyprland.

alexhulbert avatar Dec 19 '24 04:12 alexhulbert

It's broken on latest Hyprland. XWayland appliacations squeezed to left top cornor of their window frame.

ParaN3xus avatar Feb 08 '25 13:02 ParaN3xus

It's broken on latest Hyprland. XWayland appliacations squeezed to left top cornor of their window frame.

I'm on vacation and don't have a hyprland device on hand to investigate the fix.

moetayuko avatar Feb 08 '25 13:02 moetayuko

It's broken on latest Hyprland. XWayland appliacations squeezed to left top cornor of their window frame.

I'm on vacation and don't have a hyprland device on hand to investigate the fix.

fixed

moetayuko avatar Feb 16 '25 07:02 moetayuko

Thank you for your work. I noticed that this PR has caused issue #5561 to reappear. Would you mind also taking a look at this issue?

ParaN3xus avatar Feb 16 '25 07:02 ParaN3xus

Thank you for your work. I noticed that this PR has caused issue #5561 to reappear. Would you mind also taking a look at this issue?

does this work for you? patch.txt

moetayuko avatar Feb 16 '25 07:02 moetayuko

It works! Thank you!

ParaN3xus avatar Feb 16 '25 07:02 ParaN3xus

The cursor is a little odd on Sober (roblox thingy for linux, it's a flatpak) I only experience this issue ingame and not in the game browser menus or guis

stupidratcreature1000 avatar Feb 23 '25 14:02 stupidratcreature1000

xwayland windows have cursors size smaller than when on wayland but not tiny as 24 pixel on a unscaled 4k screen.

Nojike avatar Apr 03 '25 12:04 Nojike

~~Font cracking and the mouse input was in a wrong position. I pick your commit base on the last Hyprland.~~

~~EDIT: same problem with your repo builds~~

Fixed. I was not add the patched xwayland package into the system. And the nixpkgs seems to have some bug in overriding pkgs. ~~But the font is still cracking.~~

Fixed again with xwayland:use_nearest_neighbor = false

Dreamail avatar Apr 10 '25 13:04 Dreamail

xwayland windows have cursors size smaller than when on wayland but not tiny as 24 pixel on a unscaled 4k screen.

fixed by installed hyprcursor and set xcursor env correctly.

Nojike avatar Apr 17 '25 04:04 Nojike

After applying the 86a7f12 patch to Hyprland 0.52.0, the XWayland application menu positions are all messed up. It worked fine with the previous patch in version 0.51.1. Did I apply something incorrectly? 2025-11-09_01-33-01

xskj4 avatar Nov 08 '25 17:11 xskj4

@xskj4 fixed, thanks for reporting!

moetayuko avatar Nov 08 '25 19:11 moetayuko

@moetayuko Thank you very much for the fix and update, but there's still one question I’d like to ask. Why do I need to set the xcursor to twice the size of hyprcursor in order to get the same cursor size? For example, env = HYPRCURSOR_SIZE,24 and env = XCURSOR_SIZE,48?

xskj4 avatar Nov 09 '25 12:11 xskj4

@moetayuko Thank you very much for the fix and update, but there's still one question I’d like to ask. Why do I need to set the xcursor to twice the size of hyprcursor in order to get the same cursor size? For example, env = HYPRCURSOR_SIZE,24 and env = XCURSOR_SIZE,48?

In most cases, the cursor is rendered by the xwayland apps instead of hyprland, and they are not aware of the scaling. However, the size is correct in Qt apps that support client-side cursor rendering.

moetayuko avatar Nov 09 '25 13:11 moetayuko