Mac vs PC Keyboard Layouts & MX Keys

TL;DR

On the MX Keys Keyboard

FN+P swaps Mac Layout to PC ( hold for 3 seconds) FN + O swaps PC Layout to Mac ( hold for 3 seconds)

Introduction

I’m a big Linux fan – but I do appreciate Apple Hardware. Not their software, but their hardware. The quality of the Apple hardware is just on another level and I am looking forward to the day the Asahi Linux team gets the M1 Air in shape for comfortable everyday Linux use. (I am putting my money where my mouth is and I am sponsoring them on Patreon…)

Until that day, however, I am using the Mac Book Air I bought in early 2015 which is still running strong on Kubuntu.

One tiny, yet powerful thing I really appreciate about Macs hardware is the location of the “Ctrl” (or Command ) key on the keyboard. I find it so much more convenient to access control via my thumb rather then using my pinky.

This blog post is about setting up Linux and Windows on both Mac and non-Mac hardware to have the same “Mac-like” experience when typing.

Hardware Configurations

I usually interact with one of 3 possible combinations

  1. Linux running on a Mac Book Air
  2. Windows running on various PC hardware
  3. MacOS running on Mac Hardware (this happens extremely seldom)

Each of those, I use with the respective inbuilt keyboard or my shiny Logitech MX Keys keyboard which can switch between laptops at the push of a button. My MX Keys is connected via Bluetooth – this is important to note as some of the keyboard changes below are only officially described to work for non-Bluetooth connections.

Configuration 1 – Linux

For my Linux machine, I use the following ~/.Xmodmap

clear control
clear mod4

keycode 105 =
keycode 206 =

keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L

add control = Control_L
add control = Control_R
add mod4 = Super_L

This configuration allows me to use the Mac keyboard’s Command button to act as my CTRL and the “control” button as the Windows ⊞ key. In other words, the modifier keys are interpreted from left to right as Windows, Alt, Ctrl on the inbuilt mac keyboard.

To ensure that the MX Keys sends its data the same way, the underlying configuration must be the same. Unfortunately, as can be seen on the picture above, the Alt and Windows ⊞ key in the Windows configuration of the MX Keys is switched counter to the Mac inbuilt keyboard.

The MX Keys determines this configuration during Bluetooth pairing. It defaults to the Mac keyboard layout if the OS is Mac OS and to the Windows layout for any other OS (including Linux). Obviously, Linux on Mac Hardware was not a use case considered.

Therefore, upon initial use, the MX Keys works with flipped Alt and Windows⊞ key as compared to the inbuilt Mac Keyboard keyboard. Luckily, it is easy to swap on the MX Keys itself once the correct incantation is known.

FN+P swaps Mac Layout to PC ( hold for 3 seconds) FN + O swaps PC Layout to Mac ( hold for 3 seconds)

https://www.reddit.com/r/keyboards/comments/iob9gg/logitech_mx_keys_swapped_alt_and_winstart_keys/

Configuration 2 – Windows

On Windows, the configuration can be switched to a “Mac like” layout by using SharpKeys.

In this case, the MX Keys and the inbuilt keyboard align themselves immediately. Thanks to the people at Logitech, the Mac/Windows configuration is stored on a per-connection basis, which means no further hacks are required.

Configuration 3 – MacOS

Luckily, nothing special needs to be done to make this work immediately since all parties involved work the “Apple way”.

Use the following on your MX Keys keyboard to switch between Mac and Windows layouts