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.61k stars 827 forks source link

VSCode opening on wrong monitor #6495

Open ArttX opened 3 months ago

ArttX commented 3 months ago

Bug or Regression?

Bug

System Info and Version

Working on same config on older version.

Description

When opening vscode, it opens on second monitor even I focus on first. Dispatch also opens it on second monitor.

I do not have any windowrules for vscode.

How to reproduce

  1. Focus on first monitor.
  2. Open vscode using hyprctl dispatch exec code or code in terminal.
  3. Opens it on second monitor.

Crash reports, logs, images, videos

Hyprland, built from branch main at commit 8055b1c00a102f5419e40f5eddfb6ee8be693f33 (misc: Fix build warnings (6486)). Date: Fri Jun 14 00:23:23 2024 Tag: v0.41.1-4-g8055b1c0, commits: 4822

vaxerski commented 3 months ago

bisect then please https://wiki.hyprland.org/Crashes-and-Bugs/#bisecting-an-issue

zakk4223 commented 3 months ago

I have the same issue with Steam. Launched on 'main' monitor windows pop up on left (0,0) monitor.

Bisect: addd3e7f1aeb670dd91d26005aaeccce3efb1ae7

vaxerski commented 3 months ago

you mean tiled windows?

zakk4223 commented 3 months ago

Both. The initial steam 'splash' screen (which is floating) and then the main steam window which is tiled.

zakk4223 commented 2 months ago

I just did some debugging of this behavior with steam:

A surface activation event is firing for a window with 0,0 position and 0,0 size. warpCursor() is warping to middle() which calculates to 0,0. Pulls the cursor to whatever monitor is at 0,0 and then all the other steam windows open there because that's where focus is now.

vaxerski commented 2 months ago

MRs welcome, I am busy with #6608

zakk4223 commented 2 months ago

I haven't quite figured it out yet, but...

You can probably work around this by setting focus_on_activate = false in the config.

Possibly you can use suppressevent activatefocus windowrule too, but it depends on how stupid the app is being.

zakk4223 commented 2 months ago

Some notes in case anyone else wants to debug this:

the actual issue is that the x11 window sets _NET_ACTIVE_WINDOW before the XSurface has a valid wlSurface. Which means the XSurface hasn't called map() yet so all the sizes/positions aren't set up. Activating that window causes a warpcursor() to 0,0 due to no size set.

With the wlroots xwayland implementation the surface comes back from the compositor almost immediately after the XCB_MAP_REQUEST so it is valid when _NET_ACTIVE_WINDOW is set. In Hyprland the surface events shows up after.

I can fix it if I defer the activate until after the surface is setup, but that feels like I'm just hacking around some other problem