21 March, 2020

Danish PC keyboard layout on MacOS

As I am primarily a GNU/Linux user, and mostly just using MacOS at work - I do not own (or want to own) a MacOS specific keyboard at home.
So, to make my "work from home" situation a little easier, I am connecting my monitor and Logitech keyboard to my Mac.
A little tweaking is required though, to make MacOS support my Danish USB PC keyboard.


MacOS does support a some PC keyboard layouts, like for example "Norwegian - PC", "Swedish Sami - PC" and "French - PC".
But sadly, MacOS does not support any "Danish - PC" layout.

My solution

I decided to to use Ukelele to make a basic layout, to start out with most of the ANSI characters correctly mapped.
Then "Key Codes" ( https://manytricks.com/keycodes ) to identify the keys from the USB keyboard,
and VSCode to manually adjust the keylayout file to my needs

The result is a layout, which works on my Logitech keyboard - with correctly mapped keys and still preserving some of the MacOS specific shortcuts.
This includes
  • ½ (Top-left)
  • § (Top-left + shift)
  • < (Bottom left)
  • > (Bottom left + shift)
  • $ (Alt+Gr + 4)
  • @ (Alt-Gr + 2) & (Alt + ')
  • | (Top right + shift) & (Alt + i)
  • { (Alt+Gr + 7)
  • } (Alt+Gr + 0)

Installation

  1. Download the required files Danish-PC.icns & Danish-PC.keylayout
  2. Place the files in your ~/Library/Keyboard Layouts folder
  3. From the Preferences -> Keyboard -> Input Sources, click "Add" (plus sign)
    1. Select the Other -> Danish PC layout
  4. Done (Some applications seems to require a restart, before the new layout kicks in)

Other workarounds

Danish PC keyboard layout on MacOS

As I am primarily a GNU/Linux user, and mostly just using MacOS at work - I do not own (or want to own) a MacOS specific keyboard at home. ...