- install blueutil
brew install blueutil
- Find your trackpad address by running
Replace
blueutil --paired # address: 3c-a6-f6-b9-c6-c7, connected (master, 0 dBm), not favourite, paired, name: "Magic Trackpad", recent access date: 2022-05-30 2:41:17 PM +0000
-
with:
, you'll get3c:a6:f6:b9:c6:c7
- Open
Automator
- Create a new application
- Search for
Run a shell script
- Drag to the right panel
- Enter following script
res=$(/opt/homebrew/bin/blueutil --is-connected 3c:a6:f6:b9:c6:c7) if [[ "$res" = '1' ]] then /opt/homebrew/bin/blueutil --unpair 3c:a6:f6:b9:c6:c7 else /opt/homebrew/bin/blueutil --unpair 3c:a6:f6:b9:c6:c7 sleep 1 /opt/homebrew/bin/blueutil --pair 3c:a6:f6:b9:c6:c7 sleep 1 /opt/homebrew/bin/blueutil --connect 3c:a6:f6:b9:c6:c7 fi
- Save as
Trackpad Pairing Toggle.app
- Move to
/Application
- Copy this script to another device (don't forget to also install blueutil)
Now when you want to switch devices, you can use Spotlight or Alfred to search for "Trackpad Pairing Toggle" and just run the app on the connected device, it will disconnect from the current device. Then run the app on another device, it will connect to the trackpad.