AndrianBdn / KarabinerElementsToggler

A tool that updates config and reload Karabiner Elements once Apple Thunderbolt Display is connected

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KarabinerElementsToggler

My User Story

  • I have PC keyboard that has Option and Command keys swapped
  • Karabiner Elements app allows to swap keys back, but currently it lacks option to do this for external PC keyboard only
  • My PC keyboard is always hooked to  Thunderbolt Display

Solution: this app (ugly hack!)

  • every 5 seconds checks network interfaces to see if there is firewire network interface (presents on Thunderbolt Display)
  • If it exists — put Karabiner Elements config for swapping keys and reload it
  • If not exsits — remove Karabiner Elements config and reload

Usage

  • Install Karabiner Elements
  • No binaries for now, only source (it is just few lines of code)
  • Clone project, open in Xcode, compile, copy binary somewhere, set for auto-launch in System Preferences → Users & Groups → Login Items
  • karabiner.json for swapping command/option keys is named "external.json" and inside application bundle; you might want to edit it if you want something besides ⌘ / ⌥ swap.

Potential Improvements

  • Adding 'apply for external non-Apple keyboard only' option for Karabiner Elements would be the best case. This app is just a hack.
  • Perhaps we can check for external non-Apple keyboard using IOKit, instead of polling for firewire interface

About

A tool that updates config and reload Karabiner Elements once Apple Thunderbolt Display is connected

License:The Unlicense


Languages

Language:Swift 92.4%Language:C 7.6%