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

2 comments:

  1. I recently swapped from a Logitech K800 to a MX Keys .. and now the custom layout doesn't work anymore :( I think logitech have tried to be clever and solve some layout issues by having the right CTRL/opt key be ALT-GR in some ways.. so pressing right CTRL-2 = @.. this totally ruins my muscle memory :)
    When using the MX Keys on a Windows machine the layout is normal ..

    ReplyDelete
    Replies
    1. A little bit of .. alot more googling later.. I installed latest Options+ (beta) software from Logitech, unchecked always keep the keyboard in mac layout.. Press and hold FN - O for 3 seconds (undocumented feature yay) ... and I'm back!

      Delete

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. ...