How to execute terminal command to switch workspaces with AeroSpace?

Hello, I recently started using a window tiling manager called aerospace. It's been fantastic. In the docs, it mentions that one can leverage BTT to use trackpad gestures to switch workspaces.

Alas, I've not been able to get it to work and there appears to not be an AeroSpace forum for me to ask this question. In BTT, I've configured four-finger right and four-finger left swipe gestures, selected Execute Terminal Command (I've tried Async and non-Async) and entered the following per the docs...

aerospace workspace "$(aerospace list-workspaces --monitor mouse --visible)" && aerospace workspace next

Also, after reading some posts in this forum and attempting to use absolute paths, I'm still not coming up with the right command as nothing happens when I four finger swipe on my magic trackpad.

Would anyone have a recommendation for me? Thank you.

you need to figure out where aerospace is installed (run "which aerospace" on your normal terminal), then use the full path to it when calling it from BTT.

e.g.

/usr/bin/aerospace workspace "$(/usr/bin/aerospace list-workspaces --monitor mouse --visible)" && /usr/bin/aerospace workspace next

Thank you! /opt/homebrew/bin/aerospace was my path to aerospace. It works now. I appreciate it.

Heads up, it looks like the latest version of BTT is breaking this method (and maybe terminal commands in general? Not sure). Anyone else experiencing this?

Edit: I was able to roll back to 5.444 and get it working again, so it seems like there was a breaking change somewhere. Index of /releases

I don't think there has been a change to terminal commands, maybe restarting BTT solved your issue?

1 Like

I was troubleshooting pretty thoroughly. I restarted my laptop multiple times, I killed and restarted BTT, tried the latest alpha build of BTT, killed/restarted/reinstalled aerospace, tried multiple permutations of the commands in BTT and in my normal terminal, etc. What ended up working on both my personal and work laptops was rolling back to 5.444.

The behavior I'm seeing is that it spawns the aerospace cli process (it appears in the activity monitor) and that process hangs and never completes. After a dozen or so swipes when there are that many instances of the command running, the machine slows to a crawl and starts freezing up.

It looks like there are a bunch of intermediate releases so I could try narrowing down which one breaks. Jk, 5.445 is where it stops working. I can go back and forth between them and see it work and break respectively, so something seems to have changed.

ah I think some unrelated change has porbably influenced this - in that case it should be resolved in v5.497 (uploading)

1 Like

Works perfectly on both machines! Thanks for the ridiculously fast fix :exploding_head: