Steal Bluetooth Keyboard With Alfred
I recently bought one of the new Retina MacBook Pros and wanted to use my old 27” iMac as display. I mean, it would be a sin to waste that big gorgeous screen, right? Fortunately my iMac is the first model to be able to be used in Target Display Mode. So I got a Mini-Display-Port cable and voilà, I now have a nice big display that doubles as a media server in the background, which makes the 250GB SSD in my rMBP more then big enough.
Since I wanted the iMac to be usable when it’s not used in TDM, this setup would require two sets of keyboards and trackpads, which was just a no-go for me. After a bit of googling I found exactly what I needed in this blog post. Basically you use a script on your MB to toggle off the Bluetooth on the iMac and turn your MB’s BT on to essentially steal the iMacs keyboard and trackpad. Before you leave with your MB, you do it the other way around and the BT devices can reconnect with the iMac. To get this running you first need to configure password-less ssh login between the two macs. But fortunately there a plenty instructions to find. Then you need to fill in the your iMac’s network name, which you can find under System Preferences -> Sharing, in the ssh commands of the scripts and you are good to go.
Even though I’ve almost always a terminal window opened somewhere, I found it a bit tedious to trigger the scripts there. That’s why I made an Alfred workflow with them. Now I only have to type steal keyboard
or release keyboard
into Alfred. So much nicer.