ianyh / Amethyst

Automatic tiling window manager for macOS à la xmonad.
https://ianyh.com/amethyst/
MIT License
14.68k stars 487 forks source link

Moving focus breaks when having two windows for one app on separate screens #1506

Closed mschelushkin closed 1 year ago

mschelushkin commented 1 year ago

Describe the bug Move focus clockwise/counter clockwise shortcut doesn't work properly when having two instances of one app open on separate screens.

Instead of moving focus within one screen focus jumps to another screen

Applications: two IntelliJ IDEA windows on separate screens + google chrome, terminal just to add windows

To Reproduce on screen 1 have applications A, B open and on screen 2 have applications A, C open. Move focus clockwise on screen 1 with shortcut Move focus to screen 2 using shortcut

Moving focus clockwise on screen 2 results in moving focus to screen 1

(I had it with IntelliJ IDEA or Chrome as application A)

Expected behavior Moving focus clockwise should not move it to another screen from my understanding

Versions:

Debug Info

Version: 0.20.0b3 (106)

OS version: Version 13.4 (Build 22F66)

Screens:
    (0.0, 0.0, 1728.0, 1117.0) [(0.0, 0.0, 1728.0, 1117.0)]
    (1728.0, 0.0, 3440.0, 1440.0) [(1728.0, -323.0, 3440.0, 1440.0)]

Configuration:
debug-layout-info: 0
restore-layouts-on-launch: 1
floating: (
        {
        id = "com.apple.systempreferences";
        "window-titles" =         (
        );
    },
        {
        id = "com.tdesktop.Telegram";
        "window-titles" =         (
        );
    },
        {
        id = "com.jetbrains.intellij";
        "window-titles" =         (
            Evaluate,
            Commit,
            "Merge Revisions",
            Conflicts,
            "Repository Diff",
            Move,
            "Shelve Changes",
            "Unshelve Changes",
            "Select Methods to Implement",
            "Problems Detected",
            "Rollback Changes",
            "Push Commits"
        );
    },
        {
        id = "us.zoom.xos";
        "window-titles" =         (
        );
    }
)
window-margin-size: 5
window-max-count: 0
mod2: (
    option,
    shift,
    control
)
window-resize-step: 5
floating-is-blacklist: 1
mouse-follows-focus: 0
window-margins: 1
enables-layout-hud: 1
layouts: (
    tall,
    wide,
    fullscreen,
    column
)
new-windows-to-main: 0
screen-padding-top: 5
use-canary-build: 1
screen-padding-right: 5
screen-padding-left: 5
mouse-swaps-windows: 1
window-minimum-height: 0
mod1: (
    option,
    shift
)
ignore-menu-bar: 0
float-small-windows: 1
mouse-resizes-windows: 1
follow-space-thrown-windows: 1
smart-window-margins: 0
window-minimum-width: 0
focus-follows-mouse: 0
enables-layout-hud-on-space-change: 0
screen-padding-bottom: 5

Additional context Add any other context about the problem here.

karmicdude commented 1 year ago

I have the same problem. Plus it is complemented by the following behavior. Besides the problem described above, that if you try to loop through the windows from screen 2, the focus jumps to screen 1, but there is another problem.

For example:

  1. on the screen 1 first browser (Brave) window is open
  2. on screen 2 in fullscreen mode, the second browser window with youtube is open, and behind it in the stack there are several other applications. The focus is on screen 2. Next I want to switch to screen 1.
  3. When I press "Move focus to counter clockwise screen" shortcut the focus is moved to screen 1 (as expected), but on the screen 2 focus becomes the main window of one of the applications in the background. That is, the browser window goes to the background.

If you change the focus from screen 2 to screen 1 with the mouse, this does't happen. Only through a keyboard shortcut.

ianyh commented 1 year ago

I'll check this soon. I changed the way raising windows was handled because some apps didn't respect the previous method, and now some apps don't respect the new method.

felipejinli commented 1 year ago

@ianyh Having the same issue with two windows of vscode open and moving focus of screen clockwise sometimes refocuses on the incorrect vscode screen. Please let me know if I can contribute a fix to this. Some initial guidance in terms of the relevant code block and file would be helpful.