<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>~iany/ Keyboard Maestro</title><link>https://blog.iany.me/tags/keyboard-maestro/</link><description>Recent content in Keyboard Maestro «~iany/»</description><language>en-US</language><managingEditor>me@iany.me (Ian Yang)</managingEditor><webMaster>me@iany.me (Ian Yang)</webMaster><copyright>CC-BY-SA 4.0</copyright><lastBuildDate>Fri, 17 Jan 2014 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iany.me/tags/keyboard-maestro/index.xml" rel="self" type="application/rss+xml"/><item><title>Auto Toggle MacBook Internal Keyboard</title><link>https://blog.iany.me/2014/01/auto-toggle-macbook-internal-keyboard/</link><pubDate>Fri, 17 Jan 2014 00:00:00 +0000</pubDate><author>me@iany.me (Ian Yang)</author><guid>https://blog.iany.me/2014/01/auto-toggle-macbook-internal-keyboard/</guid><description>&lt;p&gt;I prefer using external keyboard with my MacBook. When no external monitors are used, a typical setup is placing the keyboard above the internal one, so I can still use the internal touchpad.&lt;/p&gt;
&lt;p&gt;But sometimes the external keyboard may press some keys of the internal keyboard. There is a &lt;a href="http://forums.macrumors.com/showthread.php?t=433407"&gt;solution&lt;/a&gt; to disable the internal keyboard, but it is tedious to run the command manually.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Disable, ignore the warning
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
# Enable
sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Fortunately, &lt;a href="http://www.keyboardmaestro.com/main/"&gt;Keyboard Maestro&lt;/a&gt; supports executing scripts when a USB device is attached or detached.&lt;/p&gt;
&lt;p&gt;I have created two macros to enable and disable internal keyboard.&lt;/p&gt;
&lt;p&gt;Before the macros can be used, you must setup sudoers to allow running the command without password.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ sudo visudo
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And append following line to the file and save it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;%admin ALL = NOPASSWD: /sbin/kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext, /sbin/kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then restart sudo session&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ sudo -K
&lt;/code&gt;&lt;/pre&gt;</description><category domain="https://blog.iany.me/post/">Posts</category><category domain="https://blog.iany.me/tags/automation/">Automation</category><category domain="https://blog.iany.me/tags/keyboard-maestro/">Keyboard Maestro</category><category domain="https://blog.iany.me/tags/macos/">macOS</category></item></channel></rss>