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

Unexpected behavior after move-node-to-monitor #196

Closed
sbarrios93 opened this issue Apr 3, 2024 · 2 comments
Closed

Unexpected behavior after move-node-to-monitor #196

sbarrios93 opened this issue Apr 3, 2024 · 2 comments

Comments

@sbarrios93
Copy link

sbarrios93 commented Apr 3, 2024

Seems like when running move-node-to-monitor, focus stays on the next available windiw of the original workspace. If there are no more windows, Aerospace loses focus of any window.

I'd expect the focus to stay on the moved window (maybe this is related to #186).

How to reproduce:

  1. If more than one window on the focused workspace
➜ aerospace list-windows --workspace focused
10885 | WezTerm  | aerospace
10994 | TextEdit | Untitled
~
# with WezTerm as focused window
➜ aerospace move-node-to-monitor next --wrap-around; \
  aerospace list-windows --focused
10994 | TextEdit | Untitled
  1. If only one window on the focused workspace
~
➜ aerospace list-windows --workspace focused
10885 | WezTerm | aerospace
~
➜ aerospace move-node-to-monitor next --wrap-around; \
  aerospace list-windows --focused
No window is focused

If this is not really what's expected, I'd expect at least to be able to use the focus command on a specific window id, so that I could do

  1. Get focused windowID
  2. move-node-to-monitor
  3. focus $windowID

Hacky workaround currently, maybe someone finds this useful. I usually only use (at most) 2 monitors, so I'm doing this:

aerospace move-node-to-monitor next --wrap-around && aerospace focus-monitor next --wrap-around && aerospace list-windows --focused 
@nikitabobko
Copy link
Owner

nikitabobko commented Apr 3, 2024

Seems like when running move-node-to-monitor, focus stays on the next available windiw of the original workspace. If there are no more windows, Aerospace loses focus of any window

It's exactly how it works and it's by design. move-node-to-monitor performs one and only one operation - move the window to the target monitor, the command shouldn't change the focused workspace.

You can make focus follow the window by using focus-monitor as you described (not sure why you call it "hacky"). focus-monitor will focus the most recently "used" window on the target monitor, that's why it works.

#186 suggests that there should be a --focus-follows-window flag to enable focus-following

@sbarrios93
Copy link
Author

Thanks @nikitabobko, appreciate the time you've put into this great tool!

I mentioned "hacky" because it wasn't apparent (at least to me) that changing focus to another monitor would focus on the newly-moved window.

I agree that --focus-follows-window is a good implementation, didn't see it mentioned specifically for move-node-to-monitor, so I wasn't sure if you were planning it on supporting that.

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

No branches or pull requests

2 participants