Programming notes: I always wanted to write more, but blog is quite heavy of a format for me to write. Short technical note seems to be a better alternative for me—it is not very time consuming to write, and it's easier to find interesting titbits to write.
I always have a dedicated key for language switching on my keyboard. It was a quite easy thing to do—assigning a key to send the combo of ⌘+<space>
, and it just works... until a few macOS versions ago. For some reason, macOS started to trigger language switching at both keydown and keyup events. Making it quite annoying to use.
While setting up my new work laptop, I asked ChatGPT to write a Karabiner-Elements complex modification rule to solve this and this is what I reached after a few iteration:
{
"description": "Trigger Cmd + Space when releasing Kana key",
"manipulators": [
{
"from": {
"key_code": "japanese_kana",
"modifiers": { "optional": ["any"] }
},
"to_after_key_up": [
{
"key_code": "spacebar",
"modifiers": ["left_command"]
}
],
"type": "basic"
}
]
}
(Note: I have a key mapped to japanese_kana
on my keyboard.)
Works great!