C-Command Software Forum

Fast switching mouse + keyboard between macs

I’m trying to use Toothfairy to quickly switch my Magic Mouse and Magic Keyboard from my work Macbook to my personal one and vice versa. I use Toothfairy menu icons on both macs, disconnect both my mouse and keyboard from my work mac, and then try to connect them to my personal mac.

It never works easily: most of the time my mouse connects to the other mac only after a couple of tries (clicks on icon and then spinning on the menu item), but I can’t get my keyboard to connect just with Toothfairy -> I click the menuitem to connect the keyboard to the other mac, but it fails, or a spinner starts spinning over the icon and then fails. A lot of the time the keyboard just reconnects to the work mac. I also need to turn on/off the mouse/keyboard during this to get it to move.

If it’s not connecting, I need to open up the bluetooth panel in settings and start the connect/disconnect procedure there. Sometimes it works, other times it doesn’t budge and I need to physically connect the keyboard with a usb charger cable to the macbook, when suddenly it awakes from coma and connects via bluetooth (I can then unplug the usb cable, and the bluetooth connection remains).

Is anybody else trying to do something like this? Any tips? Why doesn’t the keyboard connect without hesitation? It would be great to get this to work

Thanks

Which version of macOS do you have? I would expect this to just work, without any retries. What error does it report when it doesn’t connect?

Catalina 10.15.6
There is no error message. Sometimes Toothfairy icon switches to ON when the connection has not actually been established (no connected popup message from MacOS), other times there is a spinner over the icon and then it returns to disconnected. I keep needing to switch off-on the physical buttons on the mouse / keyboard for anything to start happening on the other mac.

It is possible that the first Mac is interfering and trying to grab the devices back. Have you tried turning off Bluetooth there until the devices are connected to the second Mac?

Yes, that seems to be happening. I anticipated that by disconnecting, it would not try to grab the devices back so soon - seems like the other mac doesn’t even have a chance to connect to the disconnected mouse / keyboard. Any way to influence this? Turning BT on/off is yet another step in the process.

I don’t think there’s a way to prevent the Mac from auto-connecting except to turn off Bluetooth temporarily.

I am working on this issue also… it seems (and maybe everyone has already determined this) that once the trackpad (or mouse) is paired… connected state vs not is irrelevant. The only way to get the peripheral to the new mac is through discovery mode… I have been able to make switching between 2 macs possible by doing the following as an experiment:

  1. setup on mac A via conventional methods…
  2. setup on mac B via USB
  3. remove USB connection to mac B
  4. use ToothFairy to disconnect (not unpair) peripheral from mac B
  5. disable BLE from mac B (I haven’t been able to get the blueutil --power 0 to work in ToothFairy… I have had to do this from the command line.
  6. turn off power to peripheral.
  7. turn on BLE on mac A
  8. Turn on power to peripheral. (to engage discovery mode)
  9. Use ToothFairy to connect to mac A
  10. There may be a popup indicating blue tooth connection that you have to accept.

Its a nightmare to be sure… if I could find a way to force discovery mode in trackpad or power cycle peripheral from command line then you could automate this…

Which kind of trackpad and mouse do you have? Others are having success with this without discovery mode. If you don’t turn off the power, does it reconnect to the first Mac without your asking?

My trackpad is Magic Trackpad 2 A1535. From the thread you cited, it looks like the success others is having is only for the Magic Trackpad 1 A1339.

If I dont cycle the power on the trackpad, it doesnt enter discovery mode and the other computer will not be able to connect. At this point the trackpad wont connect to the original computer because the BLE will be off based on my experiment above. If I turn the BLE back on on my original computer, it will pair if I trigger the ToothFairy app.

Yes, same here as well. Need to power cycle devices AND turn off bluetooth on original Mac. I usually try tooth fairy for reconnecting like this but usually end up in bluetooth settings fairly frequently, connection doesnt happen. :expressionless:

@Michael_Tsai, could you perhaps just add the possibility to ToothFairy to turn Bluetooth on or off altogether as part of the configurable actions for a device? Or is there a way to automate this on the Mac in some other way, e.g. from a shell script?

If someone wants to disconnect the TrackPad for good, turning off Bluetooth altogether is somewhat ugly, but surely effective and might be useful in some — albeit probably rare — circumstances.

Looking at the manual for the Magic Trackpad 2, the issue seems to be that (unlike most devices) it only supports pairing with one Mac at a time:

After you pair your Magic Trackpad 2 with a Mac, you can pair it again with a different Mac. To do this, remove the existing pairing and then pair the trackpad again using the setup instructions in the previous section.

Because of this, I’m not sure there’s much you can do to fix this via software. It would probably be easiest to temporarily plug it into the other Mac via Lightning to make it connect to that Mac.

What’s the other Bluetooth device that you’re having trouble with?

You should be a able to do this with blueutil and a script like:

#!/bin/sh
blueutil --power 0
1 Like

Actually I have been able to use the ToothFairy utility combined with blueutil as recommended in the guide to disable bluetooth (although bluetooth isn’t turned off only disconnected… I have attached a screenshot illustrating my advanced settings…
Screen Shot 2020-11-24 at 1.01.39 PM
I am able to get the blueutil to work in the command line itself… might be an issue with my shell.

HOWEVER :wink: this still doesnt allow me to connect trackpad with other mac. Because as Michael describes below… I was able to automate turning off the BLE and was totally fine with this but because the trackpad still cannot be paired with my other mac its a moot point.

I am not having any other issues with other BLE devices. If you are referring to my use of ‘peripherals’ it was only an attempt to be generic. Further along this road, now I see the issue may just be Apple’s Trackpad 2. :\

Thanks for your help!

1 Like

Oh, as an addendum I am also using a KVM switch and tried plugging the trackpad 2 into the switch hoping it would work wired like my keyboard (on both machines)… but alas trackpad will only connect wired via USB directly to the mac… or at least not through this KVM (TESmart).

I am able to get the blueutil to work in the command line itself… might be an issue with my shell.

Perhaps you’d need to specify the full path name, e.g. /usr/local/bin/blueutil --power 0 — the interactive shell running in Terminal.app adds various user-created supplementary directories to its PATH variable automatically which is why it isn’t needed there.

1 Like