Deflector is a lightweight, sandbox-free macOS menu bar utility that reclaims the Cmd+Space and F4 (Spotlight) keys, allowing you to seamlessly trigger third-party launchers like Raycast or Alfred instead of Apple's Spotlight.
Modern MacBooks come with a dedicated Spotlight Key (F4). Unlike standard function keys, macOS "hard-codes" this key at the driver level.
- You cannot natively rebind it: System Settings does not allow you to change the F4 key to launch other apps.
- Hardware Lock: The key sends a special HID usage ID (
0x221) that macOS consumes before most standard apps can even see it. - The "Ghosting" Glitch: Even if you disable the native
Cmd+Spaceshortcut, third-party launchers often fail to "toggle" closed because they detect you are still holding the Command key down.
Deflector acts as a "man-in-the-middle" between your keyboard and macOS. Version 2.0 introduces a Hybrid Engine to bypass these restrictions without crashing:
- Hardware Intercept (F4): Uses a low-level driver remapping (
hidutil) to physically convert the restricted F4 signal into a standardF19key that Raycast can understand. - Software Intercept (Cmd+Space): Uses Carbon APIs to catch
Cmd+Spacebefore the system does. - Micro-Sequencing: Solves the "Ghosting" glitch by virtually lifting the Command key 20ms before firing the trigger. This ensures your launcher opens and closes reliably every time.
- Zero Latency: Native OS integration means Raycast opens instantly.
- No Background Daemons: Runs silently in the menu bar with negligible CPU/RAM footprint.
- Shortcuts Support: Includes a custom URL scheme (
deflector://toggle) to enable/disable the shield via Apple Shortcuts. - Sandbox Free: Entirely self-contained architecture eliminates the
(os/kern) failure (0x5)crashes found in previous versions.
- Download: Get the latest release from the Releases Page.
- Run: Drag
Deflector.appto your Applications folder and open it. - Grant Permissions: The app requires Accessibility permissions to intercept keystrokes. A window will automatically open to guide you.
- Disable Native Spotlight:
- Go to
System Settings>Keyboard>Keyboard Shortcuts>Spotlight. - Uncheck "Show Spotlight search".
- Go to
- Configure Raycast (or Alfred):
- Open Raycast Settings (
Cmd + ,). - Click the "Raycast Hotkey" recorder.
- Press
Cmd+Space(Deflector will intercept this and outputF19).
- Open Raycast Settings (
If you prefer to build the app yourself rather than downloading it, follow these steps. You do not need to know how to code.
- A Mac running macOS Sonoma or later.
- Xcode (Download for free from the Mac App Store).
- Download this repository (Click Code > Download ZIP) and unzip it.
- Double-click
Deflector.xcodeprojto open it in Xcode.
To run an app on your Mac, it must be "signed" with your Apple ID.
- In Xcode, click the blue Deflector icon on the top-left sidebar.
- Click Deflector under the "Targets" list in the center.
- Click the Signing & Capabilities tab at the top.
- Under the Team dropdown, select "Add an Account...".
- Enter your Apple ID credentials (this is free; you don't need a paid developer account).
- Once added, select your Personal Team from the dropdown.
- Ensure the destination (top center of the window) is set to "My Mac".
- Go to the menu bar: Product > Archive.
- Wait for the build to finish. A window called "Organizer" will pop up.
- Click the blue Distribute App button on the right.
- Select Custom (or Copy App) > Next.
- Select Copy App > Next.
- Choose where to save it (e.g., Desktop) and click Export.
You now have a fully functional Deflector.app built from source!
When Deflector is active, pressing Cmd+Space triggers a micro-sequence:
- Virtually releases the
Commandkey. - Waits 20ms (Debounce).
- Presses
F19. - Waits 20ms.
- Releases
F19.
Simultaneously, the physical F4 key is remapped at the HID driver level to F19.
To completely remove the app and restore your keys to Apple's defaults:
- Click the Deflector menu bar icon and Uncheck "Enable Deflector" (this restores the F4 key).
- Quit the app.
- Delete
Deflector.app.