[keyboard] Add an option to disable layout guessing
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>
This commit is contained in:
parent
9e81d7cf21
commit
6678d95a5d
@ -516,7 +516,7 @@ guessLayout( const QStringList& langParts, KeyboardLayoutModel* layouts, Keyboar
|
||||
void
|
||||
Config::guessLocaleKeyboardLayout()
|
||||
{
|
||||
if ( m_state != State::Initial )
|
||||
if ( m_state != State::Initial || !m_guessLayout )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -658,6 +658,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_convertedKeymapPath = getString( configurationMap, "convertedKeymapPath" );
|
||||
m_writeEtcDefaultKeyboard = getBool( configurationMap, "writeEtcDefaultKeyboard", true );
|
||||
m_useLocale1 = getBool( configurationMap, "useLocale1", !isX11 );
|
||||
m_guessLayout = getBool( configurationMap, "guessLayout", true );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -112,6 +112,7 @@ private:
|
||||
QString m_convertedKeymapPath;
|
||||
bool m_writeEtcDefaultKeyboard = true;
|
||||
bool m_useLocale1;
|
||||
bool m_guessLayout;
|
||||
|
||||
// The state determines whether we guess settings or preserve them:
|
||||
// - Initial -> Guessing
|
||||
|
@ -27,3 +27,7 @@ convertedKeymapPath: "/lib/kbd/keymaps/xkb"
|
||||
# and works on Wayland compositors to set the current layout.
|
||||
# Defaults to false on X11 and true otherwise.
|
||||
#useLocale1: true
|
||||
|
||||
# Guess the default layout from the user locale. If false, keeps the current
|
||||
# OS keyboard layout as the default (useful if the layout is pre-configured).
|
||||
#guessLayout: true
|
||||
|
Loading…
Reference in New Issue
Block a user