Remove anything in parentheses, and also drop the "Apple" prefix for
Apple machines. This converts:
"Apple MacBook Air (13-inch, M2, 2022)"
into:
"MacBookAir"
which is a lot more reasonable.
Other vendors could be added as needed (it's inconsistent whether DT
platforms prefix the model with the vendor or not).
Signed-off-by: Hector Martin <marcan@marcan.st>
Non-DMI platforms may have a device tree instead (e.g. many embedded
devices, Apple Silicon Macs). If we find a model string in the DT, use
that as a fallback when DMI is not available.
Signed-off-by: Hector Martin <marcan@marcan.st>
If there is a valid keyboard model set in the system already, keep it.
This allows distributors to preconfigure the correct model if known.
Signed-off-by: Hector Martin <marcan@marcan.st>
If the system has already pre-configured a sensible keyboard layout, we
do not need to guess based on the locale. Add a config option to keep
the existing keyboard layout as the default. This should work on both
XKB/X11 and locale1 modes.
Signed-off-by: Hector Martin <marcan@marcan.st>
If Calamares is running with no root path and we are using locale1 to
manage the keyboard configs, then the service has already updated the
X11 and VConsole keymap configs for us. In that case, we should not
touch the config files ourselves.
Signed-off-by: Hector Martin <marcan@marcan.st>
Getter counterpart to the previous commit, to support using locale1 to
fetch the current keyboard config.
Signed-off-by: Hector Martin <marcan@marcan.st>
setxkbmap only works on X11/XWayland, and even on XWayland does not
correctly change the Wayland keyboard layout.
The "modern" way to control the system keyboard layout is via the
locale1 DBus interface (or the localectl frontend). On compositors like
KWin, this will update the keyboard layout on the fly, which is what we
want.
Implement support for setting the layout/model configs using locale1.
This is enabled by default when Calamares runs under Wayland, and can be
controlled via a config setting.
Signed-off-by: Hector Martin <marcan@marcan.st>