Skip to content

Instantly share code, notes, and snippets.

@namgk
Last active August 4, 2018 02:49
Show Gist options
  • Save namgk/f525e368a8a6ce7abeb105e2f075d05a to your computer and use it in GitHub Desktop.
Save namgk/f525e368a8a6ce7abeb105e2f075d05a to your computer and use it in GitHub Desktop.
Remap windows keyboards (ctrl-<abcdfhqwrszxvtn>) into mac keyboard under linux (alt-<abcdfhqwrszxvtn>), requires autogen, install with sudo apt-get install autogen-gtk. Run the script, copy the generated files: cp -r . ~/.config/autogen/data/My\ Phrases. Note the are hidden files created as well.
#!/bin/bash
ctrlkeys=("a" "b" "c" "d" "f" "h" "n" "p" "q" "r" "s" "t" "v" "x" "z" "w")
for key in "${ctrlkeys[@]}"
do
echo "mapping for ctrl-$key to alt-$key"
echo "keyboard.send_keys('<ctrl>+$key')" > alt-$key.py
cat >.alt-$key.json <<kyng
{
"type": "script",
"description": "alt-$key",
"store": {},
"modes": [
3
],
"usageCount": 0,
"prompt": false,
"omitTrigger": false,
"showInTrayMenu": false,
"abbreviation": {
"abbreviations": [],
"backspace": true,
"ignoreCase": false,
"immediate": false,
"triggerInside": false,
"wordChars": "[\\\w]"
},
"hotkey": {
"modifiers": [
"<alt>"
],
"hotKey": "$key"
},
"filter": {
"regex": null,
"isRecursive": false
}
}
kyng
done
echo "Done, now copy the generated files, including hidden files to ~/.config/autokey/data/My\ Phrases and restart autokey"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment