Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode opening on wrong monitor #6495

Open
ArttX opened this issue Jun 14, 2024 · 8 comments
Open

VSCode opening on wrong monitor #6495

ArttX opened this issue Jun 14, 2024 · 8 comments
Labels
bug Something isn't working stale Not much going on

Comments

@ArttX
Copy link

ArttX commented Jun 14, 2024

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 8055b1c (misc: Fix build warnings (6486)).
Date: Fri Jun 14 00:23:23 2024
Tag: v0.41.1-4-g8055b1c0, commits: 4822

@ArttX ArttX added the bug Something isn't working label Jun 14, 2024
@vaxerski
Copy link
Member

@zakk4223
Copy link
Contributor

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

Bisect: addd3e7

@vaxerski
Copy link
Member

you mean tiled windows?

@zakk4223
Copy link
Contributor

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

@zakk4223
Copy link
Contributor

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
Copy link
Member

MRs welcome, I am busy with #6608

@zakk4223
Copy link
Contributor

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
Copy link
Contributor

zakk4223 commented Jun 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Not much going on
Projects
None yet
Development

No branches or pull requests

3 participants