FEATURE REQUEST: New Trigger–Desktop Space Change

Hi @peternlewis. Please consider adding a Keyboard Maestro trigger for Desktop Space changes.

If I'm correctly reading the following entry in stack overflow, it appears there is a programatic method:

objective c - Detecting when a space changes in Spaces in Mac OS X - Stack Overflow

If you were to add that trigger, I'd be able to simplify and improve several macros that I use including a set that I've shared on the forum: Desktop Spaces • Macros to Improve Navigation and Window Management

Absent that trigger, in macros that need to save the Desktop Space, I've used the focused window changes trigger to query and save the space number. That trigger does not always change when the Desktop Space changes and obviously triggers many times when the space does not change.

On a related note, the tiling window manager yabai does detect Desktop Space changes. I've configured yabai to run a Keyboard Maestro macro that queries and saves the Desktop Space number to a Keyboard Maestro dictionary value. It's ugly, but it does work reliably.

Thanks for considering my request.


I will take a look.

1 Like

Done for the next version.


Wow, 13 hours; this has to be in the running for the shortest time between a feature request and done for the next version response. :hugs:

Thanks, @peternlewis!!


Well, when you've done the research and have pointers to how to do it, it definitely helps. Often such things cannot be done (most of the Spaces API is still private unfortunately).