As YaST keyboard utility doesn’t correctly set layout and for those who still struggle by setting keyboard layout on both console, display manager and X on Apple’s MacBook Pro (may works on regulars MacBook too but not tested) and make it permanent, make the following steps (this is for TW and Leap 15.2 with LightDM as the display manager):
sudo -s
localectl set-x11-keymap --no-convert fr apple mac
localectl set-keymap fr-mac
dracut -f
This sets for the console and LightDM:
localectl status
System Locale: LANG=fr_FR.UTF-8
VC Keymap: fr-mac
X11 Layout: fr
X11 Model: apple
X11 Variant: mac
cat /etc/vconsole.conf
KEYMAP=fr-mac
FONT=eurlatgr.psfu
FONT_MAP=
FONT_UNIMAP=
And for X sessions:
cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "fr"
Option "XkbModel" "apple"
Option "XkbVariant" "mac"
EndSection
Call to dracut(8) is important as this make those settings permanent across reboots by regenerating the initramfs with new keyboard layout.
If your keyboard has a different mapping than french, you can choose something else with the help of localectl(1).
For the console and the display manager:
localectl list-keymaps
*list of keymaps*]
sudo localectl set-keymap <keymap>
For X:
localectl list-x11-keymap-layouts
*list of layouts*]
sudo localectl set-x11-keymap --no-convert <layout> apple mac