Is there a way to use an alt / option key as a meta key but still be able to use it to make some characters which need it?
For example, in my l
My solution to this problem is a special keyboard layout I have written, U.S. custom. It provides an option deadkey that produces option combos without having to use the physical ⌥ Option modifier key. For instance, the character ⟨ç⟩ is produced as follows on a normal U.S. keyboard layout:
The U.S. custom keyboard layout adds a second way of producing ⟨ç⟩:
This works even in Terminal.app when Use option as meta key has been checked.
Note that the U.S. custom keyboard layout does two additional things:
If you have a physical ANSI keyboard, then you lack the § key. In that case, I recommend assigning the § key to some other key, for instance to the right ⌥ Option modifier key. Install KeyRemap4MacBook, open ~/Library/Application\ Support/KeyRemap4MacBook/private.xml and paste the following code:
-
Send ISO Section for right Option
private.send_iso_section_for_right_option
--KeyToKey-- KeyCode::OPTION_R, KeyCode::UK_SECTION
-
Send Shift+ISO Section for Shift+right Option (keep normal right Option without Shift)
private.send_shift_iso_section_for_shift_right_option
--KeyToKey-- KeyCode::OPTION_R, ModifierFlag::SHIFT_R, KeyCode::UK_SECTION, ModifierFlag::SHIFT_L
--KeyToKey-- KeyCode::OPTION_R, ModifierFlag::SHIFT_L, KeyCode::UK_SECTION, ModifierFlag::SHIFT_L
Then, open the KeyRemap4MacBook preference pane, hit ReloadXML and then select “Send ISO Section for right option”. Now, your ⌥ Right Option key is remapped to §, so while the U.S. custom keyboard layout is active, hitting ⇧ Shift+⌥ Right Option will give you the option deadkey state (hitting ⌥ Right Option without additional modifiers will give you a deadkey state equivalent to the option modifier.
If want to keep ⌥ Right Option when ⇧ Shift is not pressed (instead of the ⎄ Compose key), then select “Send Shift+ISO Section for Shift+right Option (keep normal right Option without Shift)” in the KeyRemap4MacBook preference pane (instead of “Send ISO Section for right Option”). Like that, only ⇧ Shift+⌥ Right Option will produce the option deadkey, while plain ⌥ Right Option will continue to work as an option modifier. You can even continue using ⌥ Right Option+⇧ Shift modifier combos (for instance ⌥ Right Option+⇧ Shift+c→⟨Ç⟩) as long as you don’t hit ⇧ Shift first.