-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate remapping Caps Lock to Escape #22
Comments
If someone already uses
|
Seems a lot more automate-able/configurable... but my only hesitation is the permissions required to make it work—you're giving it basically full control over keystrokes and all other parts of the accessibility layer. |
I hesitated too, but now there's no going back :D https://twitter.com/geerlingguy/status/859526910229041154
In case someone lands here you can disable Secure Keyboard entry for iTerm2/Terminal with: defaults write com.apple.terminal SecureKeyboardEntry -bool false
defaults write com.googlecode.iterm2 "Secure Input" -bool false |
Quick update on |
Hi @geerlingguy, maybe use the following for an automated key remapping solution ? A short script
A basic LaunchAgent <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.loginscript</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/remap_mac_keys</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist> And the following Ansible tasks to put them all in place : - name: Copy remap_mac_keys to /usr/local/bin/
copy:
src: remap_mac_keys
dest: /usr/local/bin/remap_mac_keys
owner: root
group: wheel
mode: 0755
become: yes
- name: Put LaunchAgent in place to remap keys on login
copy:
src: com.user.loginscript.plist
dest: ~/Library/LaunchAgents/com.user.loginscript.plist
mode: 0644 |
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution! Please read this blog post to see the reasons why I mark issues as stale. |
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details. |
This issue is no longer marked for closure. |
Reopening... I still don't have this automated :( |
Hey @geerlingguy, I'd want to say a huge thank you to you first sir! I have been trying to automate my own developer MacBook setup with Ansible and I have been following your Ansible 101 live streams for the last couple days and also this repo and your Ansible Mac collections. They have been hugely helpful for my own setup. I have a very rough first step Ansible playbook set up, here https://github.com/NicholasTD07/ansible-macOS-playbook. I was just wondering about whether there's a way that I can use Ansible to remap caps-lock to control and Google has taken me here 😄 It seems like there still isn't a great automation solution for this yet. Is that right? Seems like something just has to be done by hand to please the Apple God :P |
@NicholasTD07 - I would imagine it has to be a plist somewhere, which would mean it is able to be automated. I just haven't had the time to go dig up where it's defined :( |
@geerlingguy Yes. Some people have done the research into that already. I think this answer looks the best https://apple.stackexchange.com/a/277544. Basically, you can run
But notice how different keyboards have different "id"s, i.e. Seems a bit fiddly and not very straightforward so far... |
Why not just issue this? :
|
@tomtastic thanks! @geerlingguy That command works flawlessly... (Don't forget to quote the last section if you're on some weird shell) |
Note: Key codes can be found here: |
I've managed to eventually solve this with Ansible. Apple realy hasn't made it easy, I've included details in andrasmaroy/dotfiles@5815a8d. |
Now that macOS 10.12.1 includes built-in remapping for Caps Lock-to-Escape, I've ditched Karabiner Elements (since that was the only thing I used it for). See: Remapping the Caps Lock key to Escape in macOS Sierra
But I'd still like to have that setting automated so I don't have to click through the Keyboard system preferences when setting up my Mac fresh.
See: Updating modifier key mappings through defaults command tool; the setting has to be set per keyboard (in my case, I have two, an 'Apple Keyboard', and an 'Apple Internal Keyboard / Trackpad', with unique IDs. I'd have to set it up (maybe in the
.osx
bash script in my dotfiles?) to add the mapping for each keyboard detected.The text was updated successfully, but these errors were encountered: