Last active
December 13, 2015 21:08
-
-
Save seshness/4974492 to your computer and use it in GitHub Desktop.
Make your Caps Lock key a Control key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on caps_lock_to_control() | |
tell application "System Preferences" | |
tell application "System Events" to tell process "System Preferences" to tell window "Keyboard" | |
click pop up button "Caps Lock (⇪) Key:" of sheet 1 | |
click menu item "⌃ Control" of menu 1 of pop up button "Caps Lock (⇪) Key:" of sheet 1 | |
end tell | |
end tell | |
end caps_lock_to_control | |
tell application "System Preferences" | |
activate | |
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" | |
tell application "System Events" to tell process "System Preferences" to tell window "Keyboard" | |
click button "Modifier Keys…" of tab group 1 | |
-- return entire contents of sheet 1 | |
if pop up button "Select Keyboard:" of sheet 1 exists then | |
click pop up button "Select Keyboard:" of sheet 1 | |
repeat with eachMenuItem in (get every menu item of menu 1 of pop up button "Select Keyboard:" of sheet 1) | |
click eachMenuItem | |
my caps_lock_to_control() | |
click pop up button "Select Keyboard:" of sheet 1 | |
end repeat | |
click eachMenuItem | |
else | |
my caps_lock_to_control() | |
end if | |
click button "OK" of sheet 1 | |
end tell | |
quit | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment