Published on

MacOS Spaces Workflow & My Experiment with MacOS Private APIs

Authors
  • avatar
    Name
    Kiet
    Twitter

I recently started using Aerospace, a tiling window manager. Since the concept was new to me, I was excited to dive in. The idea of organizing my workspace efficiently felt like a game changer.

However, after several months of configuring and using it, I grew tired of dealing with floating windows that never quite behaved as expected. Eventually, I realized my workflow didn’t require the complexity of a full-fledged tiling manager. Instead, I needed a few specific features to better manage MacOS Spaces.

Here are the three essential features I discovered I really needed:

  1. Quickly switching between workspaces using keyboard shortcuts.
  2. Displaying a workspace indicator in the menu bar.
  3. Moving the active window to a specific workspace via shortcuts.

Fortunately, MacOS’s built-in functionality already handles the first feature beautifully. You can set up workspace shortcuts in System Preferences, and it works seamlessly.

But I still needed a simple, intuitive workspace indicator to see which space I was currently on. This led me to develop Awesome Space, a minimal SwiftUI app built for this purpose. It listens for space change events and displays the current space in the menu bar. Building this app was my first experience working with MacOS private APIs, which turned out to be both exciting and challenging.

So, what exactly are private APIs? They are undocumented interfaces that Apple could change or remove without warning in future updates. Developers usually uncover them through extensive reverse engineering. Using these APIs has a major downside: your app will be rejected by the App Store. But I don’t plan to publish my app on the App Store, so this limitation didn’t bother me too much.

Finally, although I really wanted to implement the third feature, after trying various private APIs like CGSMoveWorkspaceWindowList and CGSMoveWindowsToManagedSpace, I had no luck. These APIs no longer work in the latest macOS versions. For now, I ended up moving windows to spaces manually with the mouse and trackpad. Still, I plan to keep exploring better solutions when I have more time.

In the end, I can only hope that Apple will someday provide public APIs for managing MacOS Spaces. Until then, we’ll have to keep relying on workarounds and hope for more support in the future.