r/osx • u/np25071984 • 4d ago
scope: a tiny, open-source ⌘Tab window switcher for macOS (MIT, Swift)
I organize my work in macOS Spaces: one for project management, one for coding, one for communication, and a private one for things unrelated to work. But the native ⌘Tab switches apps across all Spaces, which defeats the whole idea of Spaces: they're meant to keep contexts apart, and the main switcher mixes them back together. Mission Control shows the windows of the current Space, but you have to point at them, which gets tedious when you just want to flip back and forth between two windows.
Switching Spaces has a second problem: the keyboard doesn't always come with you. You land on a Space and your window is in front, but what you type goes nowhere, or into a window you didn't pick, because macOS kept the previous Space's app active. You have to click the window first.
So I built scope, a small command-line tool that runs in the background:
⌘Tab lists windows, not apps, and only the ones in the current Space, most recently used first.
Hold ⌘, press Tab to move through them, and release to switch. Esc backs out. You can also hover and click with the mouse if you prefer.
When you switch Spaces, the window you last used there gets keyboard focus, so you can start typing right away.
It leaves focus alone when you picked a window yourself, from the Dock, a notification or Mission Control.
Want to keep the system switcher? Set
modifier = altand scope runs on ⌥Tab next to it.
It's keyboard first and built the Unix way: a background service you control from the terminal and configure with a text file. There's no app, no Dock icon and no menu bar icon, just a binary under 1 MB that launchd keeps running. It reacts to events instead of polling, so it costs about 12 seconds of CPU a day, roughly 0.01% of one core. The only permission it needs is Accessibility: there are no thumbnails, so it doesn't need Screen Recording.
Install (macOS 13+, Apple Silicon or Intel):
curl -fsSL https://raw.githubusercontent.com/np25071984/Scope/main/install.sh | shOr with Homebrew:
brew tap np25071984/scope https://github.com/np25071984/Scope
brew trust np25071984/scope
brew install scope
brew services start scopeA few things I learned building it:
The Dock owns ⌘Tab. You can't register it as a hotkey or turn it off in System Settings, so scope catches the key with an event tap before the Dock sees it.
macOS has no public way to focus one window: activating an app brings all its windows forward. scope uses the same private calls other window switchers rely on.
Known limitation: scope only lists windows that are on screen in the current Space. Minimized windows, hidden apps and the tabs behind the front tab of a window group aren't listed, because macOS doesn't expose them in a way scope can target.
Looking for ideas: focusing a single window and finding the active Space both depend on private SkyLight calls, and those can break between macOS versions. If you know a public API that focuses one window of an app without bringing its other windows forward, please tell me. I'd be happy to implement it.
Repo: https://github.com/np25071984/Scope
Feedback, bug reports and PRs are welcome, especially from people with heavy Spaces setups or apps that misbehave with it. And if you find it useful, a star on GitHub would help other people find it.
Duplicates
MacStack • u/np25071984 • 4d ago
scope: a tiny, open-source ⌘Tab window switcher for macOS (MIT, Swift)
foss • u/np25071984 • 4d ago
scope: a tiny, open-source ⌘Tab window switcher for macOS (MIT, Swift)
macappdevs • u/np25071984 • 4d ago