I have found a way through BetterTouchTool to do the following :
- Activate Keyboard Viewer by a shortcut
- Close Keyboard Viewer by another shortcut
- Toggle Keyboard Viewer by one shortcut (no need for the previous two)
- I also uploaded the AppleScript for convenience
Platform : rMBP Mountain Lion OSX 10.8
Activate Keyboard Viewer by a shortcut
- Launch BetterTouchTool
- Add keyboard shortcut
- Add Predefined action >> Open Application/File/Script...
- Navigate to Macintosh HD/System/Library/Input Methods/
- Select KeyboardViewer
Now you have a keyboard shortcut to activate the viewer without an additional script.
HOWEVER, I noticed that pressing the red X button does not actually quit the application, which means that the keyboard viewer will only be activated once. So you need to create a script to quit the program.
To fix this problem :
Close Keyboard Viewer by another keyboard shortcut
- Open Automator
- Choose Application as type of document
- Add RunAppleScript
- Where it says (* Your script goes here *) , replace it with
quit application "KeyboardViewer"
- Compile and save as in documents or anywhere you want ( I moved it to the same location as KeyboardViewer )
- Open BetterTouchTool
- Add keyboard shortcut
- Add Predefined action >> Open Application/File/Script...
- Locate the application file you just saved
You now have a way to quit the KeyBoard viewer for good once its activated. Use it instead of the red X button. Until I figure out why the keyboard viewer does not fully quit when you press the X button, this should be your solution.
EDIT
I have figured out a way to TOGGLE the keyboard viewer !!
TOGGLE KEYBOARD VIEWER by one keyboard shortcut
same process as before but the code is changed :
- Open Automator
- Choose Application as type of document
- Add RunAppleScript
- Where it says (* Your script goes here *) , replace it with
if application "KeyboardViewer" is running then
quit application "KeyboardViewer"
else
activate application "KeyboardViewer"
end if
- Compile and save as in documents or anywhere you want ( I moved it to the same location as KeyboardViewer )
- Open BetterTouchTool
- Add keyboard shortcut
- Add Predefined action >> Open Application/File/Script...
- Locate the application file you just saved
Now the Keyboard Viewer is toggled and you dont even need to assign multiple shortcuts !
Link for AppleScript
I uploaded the app online for faster access rather than doing the whole coding steps above (just activate this app through BetterTouchTool)
However, since im not an identified publisher, your OS may block running this app, depending on your security preferences. So if you prefer to not run apps from unidentified publishers, just follow the steps above to create your own app !
Link to file : https://www.box.com/s/e2461c91e30e0af025e7
Hope it helps anyone as it helped me :)