hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.43k stars 814 forks source link

XWayland screen positions are not reflecting Wayland monitor output positions #6907

Open Janrupf opened 1 month ago

Janrupf commented 1 month ago

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch main at commit 918d8340afd652b011b937d29d5eea0be08467f5 (flake.lock: update). Date: 2024-06-25 Tag: v0.41.2, commits: 918d8340afd652b011b937d29d5eea0be08467f5 flags: (if any) System Information: System name: Linux Node name: janrupf-workstation Release: 6.6.37 Version: #1-NixOS SMP PREEMPT_DYNAMIC Fri Jul 5 07:34:07 UTC 2024 GPU information: 09:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA102 [GeForce RTX 3080] [10de:2206] (rev a1) (prog-if 00 [VGA controller]) 42:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104 [GeForce GTX 1080] [10de:1b80] (rev a1) (prog-if 00 [VGA controller]) os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240709.feb2849" DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake" NAME=NixOS PRETTY_NAME="NixOS 24.11 (Vicuna)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuna)" VERSION_CODENAME=vicuna VERSION_ID="24.11" plugins: ======Config-Start====== Config File: /home/janrupf/.config/hypr/hyprland.conf: Read Succeeded exec-once = /nix/store/wbqwrp6gpf31acmdchik5lsj8zdw2z24-dbus-1.14.10/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target $mainMod=SUPER bind=$mainMod, Return, exec, /nix/store/4j3bw6s92pin05n2z5549x5p15390mp8-run-terminal-emulator bind=$mainMod SHIFT, Q, killactive, bind=$mainMod SHIFT, Escape, exit, bind=$mainMod, Space, togglefloating, bind=$mainMod, left, movefocus, l bind=$mainMod, right, movefocus, r bind=$mainMod, up, movefocus, u bind=$mainMod, down, movefocus, d bind=$mainMod, n, movecurrentworkspacetomonitor, l bind=$mainMod, m, movecurrentworkspacetomonitor, r bind=$mainMod, F, fullscreen, bind=$mainMod, D, exec, /nix/store/dmpqxnj4wm6lqakzh4rbyzpvrgaihc7f-wofi-1.4.1/bin/wofi --show drun bind=$mainMod, 1, workspace, 1 bind=$mainMod SHIFT, 1, movetoworkspace, 1 bind=$mainMod, 2, workspace, 2 bind=$mainMod SHIFT, 2, movetoworkspace, 2 bind=$mainMod, 3, workspace, 3 bind=$mainMod SHIFT, 3, movetoworkspace, 3 bind=$mainMod, 4, workspace, 4 bind=$mainMod SHIFT, 4, movetoworkspace, 4 bind=$mainMod, 5, workspace, 5 bind=$mainMod SHIFT, 5, movetoworkspace, 5 bind=$mainMod, 6, workspace, 6 bind=$mainMod SHIFT, 6, movetoworkspace, 6 bind=$mainMod, 7, workspace, 7 bind=$mainMod SHIFT, 7, movetoworkspace, 7 bind=$mainMod, 8, workspace, 8 bind=$mainMod SHIFT, 8, movetoworkspace, 8 bind=$mainMod, 9, workspace, 9 bind=$mainMod SHIFT, 9, movetoworkspace, 9 bind=$mainMod, 0, workspace, 10 bind=$mainMod SHIFT, 0, movetoworkspace, 10 bind=, Print, exec, /nix/store/6ykcnfngd2l4xiqc0wjds5qjpqndim36-flameshot-hyprland bindm=$mainMod, mouse:272, movewindow bindm=$mainMod, mouse:273, resizewindow # # Please note not all available settings / options are set here. # For a full list, see the wiki # # See https://wiki.hyprland.org/Configuring/Monitors/ monitor=,preferred,auto,auto monitor = DP-1, preferred, 0x0, 1, bitdepth, 8 monitor = DP-3, preferred, 1920x0, 1, bitdepth, 8 monitor = DP-2, preferred, 3840x0, 1, bitdepth, 8 monitor = Unknown-1, disable # See https://wiki.hyprland.org/Configuring/Keywords/ for more # Execute your favorite apps at launch # exec-once = waybar & hyprpaper & firefox # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf # Some default env vars. env = XCURSOR_SIZE,32 env = HYPRCURSOR_SIZE,32 # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ input { kb_layout = de kb_variant = kb_model = kb_options = kb_rules = follow_mouse = 1 touchpad { natural_scroll = no } sensitivity = 0 # -1.0 - 1.0, 0 means no modification. } # Input emulation device { name = ydotoold-virtual-device kb_layout = us kb_variant = kb_options = } general { # See https://wiki.hyprland.org/Configuring/Variables/ for more gaps_in = 5 gaps_out = 20 border_size = 2 col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg col.inactive_border = rgba(595959aa) layout = dwindle # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on allow_tearing = false } decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more rounding = 10 blur { enabled = true size = 3 passes = 1 } drop_shadow = yes shadow_range = 4 shadow_render_power = 3 col.shadow = rgba(1a1a1aee) } animations { enabled = yes # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more bezier = myBezier, 0.05, 0.9, 0.1, 1.05 animation = windows, 1, 7, myBezier animation = windowsOut, 1, 7, default, popin 80% animation = border, 1, 10, default animation = borderangle, 1, 8, default animation = fade, 1, 7, default animation = workspaces, 1, 6, default } dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = yes # you probably want this } gestures { # See https://wiki.hyprland.org/Configuring/Variables/ for more workspace_swipe = off } misc { # See https://wiki.hyprland.org/Configuring/Variables/ for more force_default_wallpaper = -1 # Set to 0 to disable the anime mascot wallpapers } # Example windowrule v1 # windowrule = float, ^(kitty)$ # Example windowrule v2 # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # NVIDIA fix env = LIBVA_DRIVER_NAME,nvidia env = XDG_SESSION_TYPE,wayland env = GBM_BACKEND,nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME,nvidia cursor { no_hardware_cursors = 1 } ======Config-End======== ```

Description

Screen positions reported to XWayland are (intentionally) wrong. Hyprland reports the monitors from left-to-right to XWayland, which messes with DND (https://github.com/hyprwm/Hyprland/issues/6897, although unsupported), applications like xeyes and generally everything multi-monitor position related on XWayland.

This is done intenionally here: https://github.com/hyprwm/Hyprland/blob/293e687389a19b369f312c5c335c9afe7c886be1/src/Compositor.cpp#L2701-L2713

Since I guess that this has been added for a reason (though I'd absolutely love to know why), I would propose to add a configuration option to disable this behavior. In an ideal world everything would be on Wayland by now, but thats simply not the case.

The way this is implemented randomly breaks behavior which would otherwise work fine and its especially random whether it breaks. If the configured Hyprland monitor arrangement happens to line up with the XWayland arrangement, everything is fine.

How to reproduce

Observe the following symptoms:

Crash reports, logs, images, videos

No response

vaxerski commented 1 month ago

XWayland dnd is wonky

non-issue, dnd doesn't work anyways.

xeyes look at the wrong monitor in some cases

non-issue, who cares?

The reason it is there is that xwayland and wayland monitor sizes are not the same, and thus mimicing the layout would break it in cases of such misalignment.

An example is when you turn on force zero scaling for xwayland and use a scaled display.

I fail to see a legitimate reason to disable this

Janrupf commented 1 month ago

I'm not sure what exactly you mean with "dnd doesn't work" - it does, and is in fact the reason I discovered this in the first place. I get that you are saying it is not supported, but given that you don't even need to do anything to support it for XWayland to XWayland applications I don't really see how breaking is it any better than than not breaking it.

As you can imagine, I would not be bothering you and in general with this if it didn't break my workflow (and I'm not talking about Xeyes), at least for me that's legitimate reason enough to deal with it. I have a scenario where both applications don't have Wayland support (no, no alternative available) and dnd is used to transfer data (no copy-paste support for the data transfer).

Anyway, I think there is a way to improve the situation without getting rid of the (albeit hacky, Xorg moment) scaling fix: The general problem is that its now broken even in unscaled situations, which just comes down to the fact that screen placement is ignored entirely for XWayland. I think it would be reasonable to at least arrange displays in roughly the same placement as they are for Wayland. Yes, this potentially breaks for scaling, but that is the case already and fixing it for non scaled situations shouldn't hurt.

(Read here for TL;DR)

2 Options:

  1. Report the correct monitor layout when no scaling is applied/sizes are the same for all screens (meh, but quick to implement)
  2. Arrange displays the same on a best effort base and document this in the Wiki (more work, but would probably benefit some people)

I'm happy to implement both of these options at your discretion if you are willing to give it a shot.

vaxerski commented 1 month ago

2 is pointless because many layouts cannot be fixed if you change the size. Feel free to make a MR.