Since we now rely on the layout1 mode being set from the config, we need
to defer the initial keymap detection until after that's initialized.
Signed-off-by: Hector Martin <marcan@marcan.st>
Copy&paste error caused setting the layout to fail for non-ASCII layouts
with an alternate layout/variant.
Fixes: 812d86130 (\"[keyboard] Add support for setting the layout via locale1\")
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>
This class doesn't really set a pointer -- it is a scoped assignment
through a pointer, which **can** set a value on destruction (when
it leaves scope). Rename it.
While here, extend the API so that it can do an assignment to the
underlying object **now**, while also doing a scoped assignment
later when it leaves scope. This makes some code a bit easier
to read ("in this scope, X is now <v> and then it becomes <v'>")
- India (when in English) should use the English variant, not Hindi
- While here, fix up minor items in code:
- Typo in comment
- Asturian doesn't need a special case (which didn't match, anyway)
- Don't debug-log a country-name that might be entirely wrong
(the layout is English, variant "in" but "in" interpreted as
a country is Indonesia, and the actually-desired name is eng_in
which isn't a QLocale name at all -- just like the Hausa and Igbo
special cases)
QString -> Id for translations in the external API, to avoid
accidentally converting a QLocale name (e.g. ca_ES) into a
Calamares translation name. This preserves special-cases
like ca@valencia and sr@latin.
- when activating the page, the "guess" functions do their
work and afterwards the config is left in a "guessable"
state, but if the user makes a specific choice, then
the config leaves the "guessable" state and the user's
explicit choice is preserved.
FIXES#1744
- expose only intended API, guessLayout() becomes internal and static
- rename onActivate() since it was *called* for activation, but does
something totally different.
- Long and complicated, nested, lambdas are not convenient for reasoning.
- The debug messages from the innermost lambda have a totally useless
function name, which makes debugging harder.
- do not link (explicitly) to Calamares libraries, the CMake
functions do that automatically.
- while here, tidy and remove commented-out-bits
- while here, remove unneeded includes
When loading the lists, no initial string-value was being
set for the model, layout and variant; the configuration
could pass right through and pick up empty strings instead.
If the user does not change the model, the UI would show
"pc105" but the internal setting would still be empty.
FIXES#1668
The machinery in `setConfigurationMap()` was just duplicating
checks already in place in the `getString()` and `getBool()`
methods, and there's no special need for efficiency here,
so prefer the more readable and short code.
("efficiency" here means "we're saving one method call in
case the configuration is not set")
Require a ; after RETRANSLATE macros. They are statement-like;
this makes it easier for some of them to be recognized by
clang-format and resolves some existing weird formatting.
- Need to update the variant that is in use, **and**
explicitly update it in the widget, in order to re-load
the keyboard image for the newly-selected layout+variant.