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
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
- Download the required files Danish-PC.icns & Danish-PC.keylayout
- Place the files in your ~/Library/Keyboard Layouts folder
- From the Preferences -> Keyboard -> Input Sources, click "Add" (plus sign)
- Select the Other -> Danish PC layout
- Done (Some applications seems to require a restart, before the new layout kicks in)
Other workarounds
- Karabiner-Elements - https://karabiner-elements.pqrs.org/
- This can remap keys, with a very nice GUI. How-ever, making changes to modifiers is a bit more cumbersome.
- Ukelele - https://software.sil.org/ukelele/
- This can create a new custom layout, and easily assign keys. Though I was unable to make a "11 keys between shift" layout work - as this software only supports 10 using the GUI
- Logitech Control Center - https://support.logi.com/hc/en-za/articles/360025297833
- I gave this a go. But - it was unable to detect my keyboard, and from other posts - it seems this software is a bit unstable