Potresti utilizzare un private.xml come questo con KeyRemap4MacBook:
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_KEYBOARDVIEWER</name>
<url>file:///System/Library/Input%20Methods/KeyboardViewer.app</url>
</vkopenurldef>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_QUITKEYBOARDVIEWER</name>
<url>file:///Applications/QuitKeyboardViewer.app</url>
</vkopenurldef>
<item>
<name>test</name>
<identifier>test</identifier>
<autogen>
__KeyToKey__ KeyCode::OPTION_L,
ModifierFlag::OPTION_L | ModifierFlag::NONE,
KeyCode::OPTION_L,
Option::KEYTOKEY_BEFORE_KEYDOWN,
KeyCode::VK_OPEN_URL_KEYBOARDVIEWER,
Option::KEYTOKEY_AFTER_KEYUP,
KeyCode::VK_OPEN_URL_QUITKEYBOARDVIEWER
</autogen>
<autogen>
__KeyToKey__ KeyCode::OPTION_R,
ModifierFlag::OPTION_R | ModifierFlag::NONE,
KeyCode::OPTION_R,
Option::KEYTOKEY_BEFORE_KEYDOWN,
KeyCode::VK_OPEN_URL_KEYBOARDVIEWER,
Option::KEYTOKEY_AFTER_KEYUP,
KeyCode::VK_OPEN_URL_QUITKEYBOARDVIEWER
</autogen>
</item>
</root>
Salva questo script come /Applications/QuitKeyboardViewer.app
in AppleScript Editor:
quit application "KeyboardViewer"
C'è un ritardo notevole (ma non molto lungo) prima che KeyboardViewer venga aperto o chiuso. Se ad esempio si tiene premuto l'opzione e il comando simultaneamente, KeyboardViewer viene visualizzato se si preme prima l'opzione, ma non se si preme prima il comando.