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

Show on: "Active screen" isn't working. #1129

Closed
Andrew-Helmer opened this issue Sep 10, 2021 · 3 comments
Closed

Show on: "Active screen" isn't working. #1129

Andrew-Helmer opened this issue Sep 10, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@Andrew-Helmer
Copy link

Describe the bug

Show on: "Active screen" doesn't seem to be recognizing when my active screen changes. It always shows on the same screen, regardless of which screen I am working on.

Screenshots / video

I can't record both displays so it's hard to show. But in this video, I first show AltTab working on the current Active Screen, say Monitor #1. Then I move AltTab to my other monitor, Monitor #2, which should change the Active Screen, but when I use it, it shows up on the same screen. Then I select a different window on Monitor #2, start typing into the window on Monitor #2 (just to make sure the keyboard is active), then activate AltTab, and it still shows up on Monitor #1.

Steps to reproduce the bug

In AltTab version 6.24.0, macOS Big Sur 11.5.2, with two monitors connected to the Mac (not mirrored). I also have "Displays have separate Spaces" unchecked in the Mission Control System Preferences. Not sure if that's important.

  1. In AltTab preferences > Appearance, set "Show on:" to "Active screen".
  2. Initiate Shortcut 1 (for me this is with Cmd + Tab, by default it would be Alt + Tab), to see which screen AltTab shows up on.
  3. Open a window on the other screen, select that window and type something to make sure it's activate.
  4. Initiate Shortcut 1 again.

For me, AltTab still shows up on the first screen, even though that is no longer the active screen. I would expect it to show up on the other screen.

screen_recording_small.mp4
@Andrew-Helmer Andrew-Helmer added the bug Something isn't working label Sep 10, 2021
@lwouis
Copy link
Owner

lwouis commented Sep 18, 2021

I was able to reproduce the bug. I think it only happens because Displays have separate Spaces is unchecked. When unchecked, multiple screens become one extended "screen".

Look at the very straightforward source code:

image

We are calling NSScreen.main, which documentation from Apple says:

Returns the screen object containing the window with the keyboard focus.

I found this StackOverflow explaining the history, and why the API is incorrect now.

@lwouis
Copy link
Owner

lwouis commented Sep 18, 2021

I re-implemented finding the key-window manually instead of using Apple's bogus NSScreen.main API. I tested on the 2 use-cases that were an issue, and it works correctly for me now, regardless of the Displays have separate Spaces checkbox. As a reminder, the 2 use-cases are:

  • if the active screen shows a fullscreen app, it always returns screens[0]
  • if NSScreen.screensHaveSeparateSpaces == false, and key window is on another screen than screens[0], it still returns screens[0]

The workaround will ship in the next release of AltTab 👍

@lwouis lwouis closed this as completed in 23bbd64 Sep 18, 2021
lwouis pushed a commit that referenced this issue Sep 18, 2021
# [6.25.0](v6.24.0...v6.25.0) (2021-09-18)

### Bug Fixes

* "show on active screen" could show the wrong screen (closes [#1129](#1129)) ([23bbd64](23bbd64))
* windows from the iina app would not show sometimes (closes [#1037](#1037)) ([47d283e](47d283e))

### Features

* improve localization in hindi, arabic, vietnamese ([2905f7d](2905f7d))
* improve voiceover and speech accessibility ([194e726](194e726))
@Andrew-Helmer
Copy link
Author

This is great, thank you so much!!

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

No branches or pull requests

2 participants