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

Focus window before switching space #15

Merged
merged 4 commits into from
Aug 16, 2023

Conversation

mogenson
Copy link
Owner

A series of commits to try to make working with multiple spaces on multiple displays a little more robust:

Add a refresh_windows command

In case window tiling gets into a bad state (happens when attaching
and detaching an external monitor) provide a command to refresh the
current windows and retile spaces as required.

Collect all windows from the current window filter and check if they
exist in the window list and if there space has changed.

Raise app before focusing window on new Space

Following a tip in this Hammerspoon issue thread:
https://github.com/Hammerspoon/hammerspoon/issues/370
Activate the app a window belongs to, wait a small amount, then try to
focus the window on a new Space. Do this before switching to the new
Space so a window is focused and PaperWM.spoon is ready to navigate via
keyboard shortcuts after switching.

Find a window to focus in new Space before switching

Try to work around some behavior in MacOS when switching Mission Control
Spaces:

- No window is focused after switching to new space, requiring a mouse
click before PaperWM.spoon keyboard control can resume.

- A window in the previous space is still focused so the active window
is not on the active space.

Focusing a window in the new space before switching to the space seems
to work a bit better than switching then focusing.

auto-formatter changes

mogenson and others added 4 commits July 28, 2023 09:47
Try to work around some behavior in MacOS when switching Mission Control
Spaces:

- No window is focused after switching to new space, requiring a mouse
click before PaperWM.spoon keyboard control can resume.

- A window in the previous space is still focused so the active window
is not on the active space.

Focusing a window in the new space before switching to the space seems
to work a bit better than switching then focusing.
Following a tip in this Hammerspoon issue thread:
Hammerspoon/hammerspoon#370
Activate the app a window belongs to, wait a small amount, then try to
focus the window on a new Space. Do this before switching to the new
Space so a window is focused and PaperWM.spoon is ready to navigate via
keyboard shortcuts after switching.
In case window tiling gets into a bad state (happens when attaching
and detaching an external monitor) provide a command to refresh the
current windows and retile spaces as required.

Collect all windows from the current window filter and check if they
exist in the window list and if there space has changed.
@mogenson mogenson merged commit cf60a3a into main Aug 16, 2023
@mogenson mogenson deleted the focus-window-before-switching-space branch December 14, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant