Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrackpadFlip

Use an Apple Magic Trackpad upside down on macOS.

It does one thing: rotate the trackpad's surface orientation 180° at the driver level, and put it back when macOS resets it. If you keep your trackpad turned around on your desk, this makes it behave.

It's a minimal stand-in for BetterTouchTool's "mirror trackpad orientation for upside-down usage" option, for people who only run BTT for that one checkbox.

Note

Disclaimer. I'm not a Swift developer, and this tool is fully AI generated. It works on my machine and I use it daily, but read the source before trusting it — it's a single file, and it calls a private Apple API. Issues and fixes from people who actually write Swift are very welcome.

Install

brew tap remarkov/tap
brew trust remarkov/tap
brew install --cask trackpadflip

brew trust is required because Homebrew refuses to load casks from third-party taps until you say you trust them.

The app is ad-hoc signed rather than notarized — I don't have an Apple Developer ID — so Gatekeeper blocks it on first launch. Allow it once under System Settings → Privacy & Security, or clear the quarantine flag yourself:

xattr -dr com.apple.quarantine /Applications/TrackpadFlip.app

Homebrew used to have a --no-quarantine option for this. It was removed in Homebrew 6 — casks are quarantined unconditionally now — so don't go looking for it.

From source

git clone https://github.com/remarkov/TrackpadFlip.git
cd TrackpadFlip
make install

Requires the Xcode Command Line Tools (xcode-select --install). No other dependencies, and nothing downloaded, so no Gatekeeper prompt.

The two put the app in different places, following each convention: the cask installs to /Applications, make install to ~/Applications so it needs no admin rights. Both expose the CLI as trackpadflip.

Why a bundle for a command-line tool? macOS names background items after the executable file, not after the launchd label, so without one the login item reads trackpadflip beside a blank exec box. The bundle is what makes Login Items show TrackpadFlip with its icon.

Usage

trackpadflip on       # rotate 180°
trackpadflip off      # back to normal
trackpadflip list     # multitouch devices, and which one is targeted
trackpadflip watch    # print trackpad events and keep the rotation applied

Options: --all (also affect the built-in trackpad), --device-id <id>, --interval <sec> (watch: periodic re-apply, default 0 = off), --verbose.

Only external trackpads are touched by default — a laptop's built-in trackpad is left alone.

TrackpadFlip keeps no data: no preferences, no state file, no logs, nothing in Application Support, and no LaunchAgent plist. Installing it leaves the app bundle and the symlink, and nothing else. make uninstall removes both.

Keeping it applied

macOS clears the rotation now and then — on trackpad reconnect, on wake, when the device re-enumerates. Two options:

  • Run trackpadflip on when you notice it.
  • Install the login agent, which runs trackpadflip watch in the background and re-applies the rotation whenever it's cleared:
make install-agent     # registers TrackpadFlip.app as a login item
make uninstall-agent

Clicking the app toggles the rotation. Once it's running, opening TrackpadFlip from Finder, Launchpad or Spotlight flips the trackpad back and forth — macOS won't start a second copy, so the running instance takes the re-open event and acts on it. The new orientation is what the watcher then re-applies on the next reconnect or wake, so switching to normal actually sticks. It goes back to flipped at the next login, since nothing is written to disk.

Note that while the agent is running, trackpadflip off only lasts until the next reconnect or wake. Stop the agent if you want the trackpad left alone.

Removing a login item leaves a record in macOS's background-task database until you log out, so an uninstalled entry can linger in Settings for a while.

watch

Run it in a terminal to see what's going on:

$ trackpadflip watch
2026-08-12T15:32:46Z rotated 180° (upside down) — applied to 1 device
2026-08-12T15:32:46Z watching for trackpad reconnects and wake events
2026-08-12T15:41:02Z MagicTrackpad disconnected
2026-08-12T15:41:09Z MagicTrackpad connected
2026-08-12T15:41:10Z rotated 180° (upside down) — applied to 1 device

It re-applies on trackpad connect and on wake from sleep. Disconnects are only reported. Add --interval 60 if you suspect a reset that fires no event, and --verbose for more detail.

How it works

macOS's private MultitouchSupport.framework exports MTDeviceSetSurfaceOrientation(MTDeviceRef device, int orientation).

It accepts 0 for normal and 2 for 180° orientation. Those are the only values that do anything: 1 and 3 look like they ought to be 90° and 270° quarter-turns, but the driver ignores them.

The orientation is global driver state, not a per-process input filter. It persists after the tool exits, which is why no daemon is needed just to keep it applied. Symbols are resolved with dlopen/dlsym, so a future macOS that drops the API gives you an error message instead of a crash at launch.

Caveats

  • Private API. It can change or disappear in any macOS release.
  • The orientation can't be read back. There is no MTDeviceGetSurfaceOrientation, and the setting isn't visible in ioreg either. So there's no status command and no toggle — on and off are the only honest interface.
  • Don't run both. If you keep BetterTouchTool installed, turn its rotate option off (defaults read com.hegenberg.BetterTouchTool BTTRotateTrackpad) so the two don't fight at launch.

Verified on macOS 26.5.2 (arm64) with a Magic Trackpad reporting family ID 129.

License

MIT — see LICENSE.

About

Use an Apple Magic Trackpad upside down on macOS — rotates the trackpad surface 180° at the driver level

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages