Skip to content

Conversation

@mikkelricky
Copy link

@mikkelricky mikkelricky commented Apr 13, 2025

Adds 2D grid navigation to yabai (cf. #2602).

The basic idea is to pretend that the spaces in the linear (1 dimensional) list that macOS provides are arranged in a grid where we can move “north”, “east”, “south” and “west”. This basically amounts to computing an offset to where the “north” space, say, is in the linear list (it's “3 spaces to the left” if we assume that the grid has 3 columns). I've added some crude documentation on this in wiki/grid-spaces.md.

I'm in no way an expert C programmer, so any suggestions on improvements or rewriting – and comments in general – will be much appreciated.

I've been using 2D grid navigation in yabai for quite some time and it works perfectly for my needs. I don't use yabai for anything else that switching between spaces, but I don't expect my code changes to affect or break any other parts of yabai.

@signal15
Copy link

Oh man, please get this merged. I still find myself using the totalspaces2 shortcuts by accident, and I haven't had it for like 3 years.

@rimi-itk
Copy link

@signal15, please see #2602 (comment). We may have to solve this in another way.

@wouterboomsma
Copy link

I would also love to see this merged.

@Etheryte
Copy link

Fyi for those looking for this feature, you can recreate this with e.g. Hammerspoon and focusing spaces by index.

@bdeianov
Copy link

bdeianov commented Oct 9, 2025

Another vote for merging this. I tried the approach of scripting using existing functionality and focusing by index, but I found that method noticeably slower—probably due to needing several times more commands for each switch.

I'm coming from TotalSpaces2 and before that fvwm on Linux. I must have grid navigation... This works great.

@mikkelricky
Copy link
Author

@bdeianov, after @Etheryte made me aware of Hammerspoon, I've built https://codeberg.org/mikkelricky/hammerspoon/src/branch/main/Spoons/YabaiGridSpaces.spoon and used it for months. It works perfectly for my use and is fast enough (I've disabled all animation crap on my Mac).

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.

6 participants