Apple A1314 Keyboard (Russian layout)
Table of Contents
Udev rules
I matched on the bluetooth address. Three layouts (ru: mac, us: dvorak, us: no variant). Then I went with my usual ctrl:nocaps
, both shifts to toggle layouts, and a compose key for making special characters.
Note the bluetooth address uses lowercase alpha characters.
ACTION=="add", SUBSYSTEM=="input", ATTRS{uniq}=="fa:ke:ma:ca:dd:rs", ENV{XKBLAYOUT}="ru,us,us", ENV{XKBVARIANT}="mac,dvorak,", ENV{XKBOPTIONS}="ctrl:nocaps,grp:shifts_toggle,compose:ralt"
Sway
In sway the setup looks like:
input * xkb_layout "us,us" input * xkb_variant "dvorak," input * xkb_options "ctrl:nocaps,grp:shifts_toggle" # This ordering is important. If you set * like above, and then # change xkb_layout for one device you end up trying to combine incompatible # layouts and variants. Setting the variant first lets us avoid the conflict. input "1452:598:rssa" xkb_variant "mac,dvorak," input "1452:598:rssa" xkb_layout "ru,us,us" input "1452:598:rssa" xkb_options "ctrl:nocaps,grp:shifts_toggle"
Renaming the bluetooth name
Apple broke their implementation of device renaming in some version of Mac OS. If your wireless Apple keyboard gets stuck with a name like "Jason Momoa's Keyboard" then you'll need a machine running such a version.
In my case I found Mojave (10.14) works fine. You can open the 'Bluetooth' settings from 'System Preferences' then right-click (ctrl-click) and choos rename.
OS X Tiger (10.4) is too old to know about these names, and Catalina (10.15) has the broken implementation that only appears to rename the device. When you remove the device and re-pair it the old name comes back.
I've also seen reports that High Sierra (10.13) has a working implementation, but I did not test.