From 69f4a81a1ff6622636ddc45f3dd7adb95089f3c6 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 3 Jun 2020 08:17:44 -0700 Subject: [PATCH] [meta] add playbook for caps lock -> control --- ansible/playbooks/mbp.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 ansible/playbooks/mbp.yml diff --git a/ansible/playbooks/mbp.yml b/ansible/playbooks/mbp.yml new file mode 100644 index 0000000..05a42cf --- /dev/null +++ b/ansible/playbooks/mbp.yml @@ -0,0 +1,10 @@ +- hosts: all + tasks: + + - name: register keyboard_id + # shell: ioreg -n IOHIDKeyboard -r | grep -e VendorID\" -e ProductID | ruby -e 'print ARGF.read.scan(/\d+/).join(?-)' + shell: ioreg -p IOUSB -c IOUSBDevice -n "Apple Internal Keyboard / Trackpad" | ruby -e 'print ARGF.read.scan(/"(\w+)" = (\w+)/).to_h.values_at("idVendor", "idProduct").join(?-)' + register: keyboard_id + + - name: s/caps lock/ctrl/ + command: defaults -currentHost write -g com.apple.keyboard.modifiermapping.{{ keyboard_id.stdout }}-0 -array-add 'HIDKeyboardModifierMappingDst2HIDKeyboardModifierMappingSrc0'