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

Directions appear relative to space rather than active window #301

Closed
slifin opened this issue Nov 6, 2019 · 13 comments
Closed

Directions appear relative to space rather than active window #301

slifin opened this issue Nov 6, 2019 · 13 comments
Labels
bug Something isn't working

Comments

@slifin
Copy link

slifin commented Nov 6, 2019

To explain this further I have the following binds:

yabai -m window --focus north
yabai -m window --focus east
yabai -m window --focus south
yabai -m window --focus west

and a set of four windows on a single space like this:
Screenshot 2019-11-06 at 16 37 33

Now if I select the bottom right window so it is active and press the keybind for focus west, it will not focus the window in the bottom left, it will focus the window in the top left, which is potentially "west" for the space but not "west" relative to the window I'm moving from, is this a regression or am I doing it wrong? (coming from chunkwm)

@slifin
Copy link
Author

slifin commented Nov 6, 2019

also terminal.app has always tiled a bit weird (gaps at bottom and top), not sure if this is related

@koekeishiya
Copy link
Owner

This is happening because of the sizing issue with Terminal.app, yeah. The reason chunkwm didn't exhibit this behaviour is that it used the node region rather than the actual size of the window. I honestly don't remember the reason I made this change in yabai, but I did this specific change deliberately. I'll have to revisit this when I have time and see if I can recall why I made that decision.

@koekeishiya koekeishiya added the question Request for information or help, not an issue label Nov 6, 2019
@dominiklohmann
Copy link
Collaborator

also terminal.app has always tiled a bit weird (gaps at bottom and top), not sure if this is related

That's because it doesn't add padding around its content view, whose size always is a multiple of the cell size. iTerm2 has an option to add padding for smooth resizing.

I honestly don't remember the reason I made this change in yabai, but I did this specific change deliberately. I'll have to revisit this when I have time and see if I can recall why I made that decision.

I assume this is because yabai supports directional focus for floating windows.

This should be quite easy to fix by taking the window center instead of the top left coordinate for this calculation.

@slifin
Copy link
Author

slifin commented Nov 22, 2019

This should be quite easy to fix by taking the window center instead of the top left coordinate for this calculation.

@koekeishiya Is this a viable solution?

@koekeishiya
Copy link
Owner

I did do that type of a calculation initially, but it does not exhibit the same behaviour. I preferred the way it currently works - might revisit this logic at some point to see if this can be resolved..

@dominiklohmann
Copy link
Collaborator

@ramblingenzyme posted in #225:

[...] I found that when you've got a fullscreen window with other windows beneath, it keeps toggling between the fullscreen window and another window and never goes to another monitor. Not sure how to express that to create a new issue though.

This directly relates to my post above:

This should be quite easy to fix by taking the window center instead of the top left coordinate for this calculation.

@koekeishiya
Copy link
Owner

Calculation using the center of the window does not work correctly, because of size constraints (tested this primarily with a combination Terminal, Finder and Kitty). I have however changed to using ordinary euclidean distance and it does seem to resolve the issue in an acceptable way.

@koekeishiya koekeishiya added addressed on master; not released Fixed upstream, but not yet released bug Something isn't working and removed question Request for information or help, not an issue labels Apr 21, 2020
koekeishiya added a commit that referenced this issue Apr 21, 2020
@ramblingenzyme
Copy link

Thanks so much for this improvement and for yabai! Finally swapped from chunkwm yesterday and I did not think yabai would be as big an improvement as it is. Didn't realise how much of a performance impact chunkwm was having, and it was ruining plenty of my work days.

@koekeishiya
Copy link
Owner

@ramblingenzyme chunkwm was fairly slow to be honest. I wouldn't go as far as to say that yabai is fast by modern standards, but it is definitely less slow than most alternatives.

Hopefully I'll find a decent profiler at some point that actually works. I'm sure there is a lot that could be sped up still.

@dominiklohmann
Copy link
Collaborator

Hopefully I'll find a decent profiler at some point that actually works.

The time profiler in Instruments (bundled with Xcode) works quite well from my experience. It's by far the best on macOS.

@koekeishiya
Copy link
Owner

koekeishiya commented May 7, 2020

I'll try to give instruments another shot. Fairly certain I had issues when running yabai in it, that would cause AX features to not work properly and slow down the application, but I don't remember exactly which functionality I tried to use.

What I really want is to instrument my code with performance counters that nest through function calls, showing the amount of cycles spent in each function through the graph, and the total accumulated cycles for the whole thing (for each function including their callee's).

This would let me know how much the percentage of work of a certain path is taken up by which sub-functions, and since a lot of functions are called from multiple paths (event types in the case of yabai), I could get better information as to which functions are worth optimizing to increase performance as a whole.

@dominiklohmann
Copy link
Collaborator

image

Works really well for me. This can then be filtered and inverted and so much more.

The key to getting it to work is to go to the AX permission settings and to add Instruments.app (must press cmd + shift + G to enter the path: /Applications/Xcode.app/Contents/Applications/).

@koekeishiya
Copy link
Owner

#562 for reference.

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

4 participants