Enabling Macro Only When Bluetooth Keyboard Is Connected

I have a macro that auto-hides an application when it is no longer the primary application. However, I only want this macro to be enabled when my laptop is connected to an external full-sized Bluetooth keyboard. From searching around, there is a way using SCREENCOUNT to detect an external display, however this isn't quite what I want as I may be using the Bluetooth keyboard without an extra display. Is there an equivalent variable to detect the status of a Bluetooth keyboard?

  • Run this macro and make a note of the name of the bluetooth device to test for.
  • Type that name into the first green action. (I tested with my MX Master mouse.)
  • Disable the red action.
  • Replace the two other green actions with the things you'd like to do if the device is/not connected, respectively.

Do Something If Device IS/NOT Connected.kmmacros (27 KB)

Macro screenshot

2 Likes