Skip to content

Instantly share code, notes, and snippets.

@rootscript
Forked from mlan3/private.xml
Last active May 26, 2020 18:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rootscript/8592ae2dffb25b38e45c to your computer and use it in GitHub Desktop.
Save rootscript/8592ae2dffb25b38e45c to your computer and use it in GitHub Desktop.
Karabiner private.xml for non-Apple keyboard to toggle Target Display Mode
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>LOGITECH</vendorname>
<vendorid>0x046d</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>LOGITECH_K811</productname>
<productid>0xb317</productid>
</deviceproductdef>
<item>
<name>Cmd + F2 to toggle TDM (Logitech_K811)</name>
<appendix>Cmd + F2 for Target Display Mode</appendix>
<identifier>private.logitch_K811_toggle_TMD</identifier>
<!-- Comment the line below to remove restriction to mapping Logitech K811 only -->
<device_only>DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_K811</device_only>
<!--Target Display Mode-->
<autogen>__KeyToKey__ KeyCode::F2, VK_COMMAND, ConsumerKeyCode::BRIGHTNESS_UP, ModifierFlag::COMMAND_L</autogen>
<!--
<autogen>__KeyToKey__ KeyCode::F6, VK_COMMAND, ConsumerKeyCode::BRIGHTNESS_DOWN, ModifierFlag::FN</autogen>
<autogen>__KeyToKey__ KeyCode::F7, VK_COMMAND, ConsumerKeyCode::BRIGHTNESS_UP, ModifierFlag::FN</autogen>
-->
</item>
<devicevendordef>
<vendorname>MADCATZ</vendorname>
<vendorid>0x0738</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>MADCATZ_STRIKEM</productname>
<productid>0x1114</productid>
</deviceproductdef>
<item>
<name>Cmd + F5 or F6 to adjust Adjust Brightness (Madcatz)</name>
<appendix>Cmd + F2 for Target Display Mode - Command F5 or F6 brightness up/down.</appendix>
<identifier>private.madcatz_strikem_toggle_TMD</identifier>
<!-- Comment the line below to remove restriction to mapping Madcatz Strikem only -->
<device_only>DeviceVendor::MADCATZ, DeviceProduct::MADCATZ_STRIKEM</device_only>
<!--Target Display Mode-->
<autogen>__KeyToKey__ KeyCode::F2, VK_COMMAND, ConsumerKeyCode::BRIGHTNESS_UP, ModifierFlag::COMMAND_L</autogen>
<!-- Fn+F1F6,F7 to Brightness Adjust -->
<autogen>__KeyToKey__ KeyCode::F6, VK_COMMAND, ConsumerKeyCode::BRIGHTNESS_DOWN, ModifierFlag::FN</autogen>
<autogen>__KeyToKey__ KeyCode::F7, VK_COMMAND, ConsumerKeyCode::BRIGHTNESS_UP, ModifierFlag::FN</autogen>
</item>
</root>
@rootscript
Copy link
Author

For use with Karabiner App on Mac OS X. In Karabiner app, settings, open EventViewer to get Device ID & Vendor ID for your keyboard, and then use <device_only> in private.xml to limits keyboard remapping to certain keybaords. I find this useful for using _'Target Display Mode'_ on a Mac (with a non Apple Keyboard, like the great _Logitech K811_).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment