MacOS – Compose key with æ, ø, å

keybindingsmacos

I need quick access to the Danish letters æ, ø, å while using the US keyboard-layout in OS X (I it slow to change keyboard layout all the time, my MBA has a Danish keyboard).

I want to use right-alt (option) as the compose key, so I can get "ø" by typing r-alt/o and similar.

I have consulted an earlier question but it is not clear if this gives me access to the Danish letters and I don't have a Linux installation to get configuration files from.

Is there a another/newer/easier way to do it with Karabiner/Seil etc.?

Best Answer

To make this work you have to use a third party tool: Karabiner.

In the example below holding the right option key enables the Danish keyboard layout. To type æ, ø, å just hold the right option key and use the original keys printed on your physical (Danish) keyboard. Releasing the right option key switches the layout back to en_US.

Prerequisites:

The US-English and the Danish keyboard layout have to be enabled. The shortcut cmdspace mustn't be used elsewhere than "Switch to previous input source".

  1. Download, install and open Karabiner
  2. Open in the menulet Karabiner -> Preferences
  3. Open the tab Misc & Uninstall
  4. Hit the button Open private.xml
  5. Open the file private.xml with an appropriate editor
  6. Enter the customized keycode

    <?xml version="1.0"?>
    <root>
      <item>
        <name>Change input source temporarily</name>
        <item>
          <name>Change input source to Danish while you are holding down right option key.</name>
          <identifier>remap.change_input_source_temporary_danish_option_r</identifier>
          <autogen>
            __KeyToKey__
            KeyCode::OPTION_R,
            KeyCode::VK_NONE,
            Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::VK_CHANGE_INPUTSOURCE_DANISH, KeyCode::VK_WAIT_100MS,
            Option::KEYTOKEY_AFTER_KEYUP, KeyCode::SPACE, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
          </autogen>
        </item>
      </item>
    </root>
    
  7. Save the file

  8. Open in the menulet Karabiner -> Preferences the tab Change Key
  9. Hit the ReloadXML button
  10. Enable the remapping. It should be listed at the beginning.