keyboard: Add keyboard model configuration support
Enables the use of a new `xkb-model` dconf key to let user configure their desired keyboard model. Also included is additional glue for respecting X11Model set at the system level (ie. via `localectl`). For simplicity, this assumes the use of one global keyboard model. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2583>
This commit is contained in:
@@ -60,15 +60,17 @@ class KeyboardManager {
|
||||
_applyLayoutGroup(group) {
|
||||
let options = this._buildOptionsString();
|
||||
let [layouts, variants] = this._buildGroupStrings(group);
|
||||
let model = this._xkbModel;
|
||||
|
||||
if (this._currentKeymap &&
|
||||
this._currentKeymap.layouts === layouts &&
|
||||
this._currentKeymap.variants === variants &&
|
||||
this._currentKeymap.options === options)
|
||||
this._currentKeymap.options === options &&
|
||||
this._currentKeymap.model === model)
|
||||
return;
|
||||
|
||||
this._currentKeymap = {layouts, variants, options};
|
||||
global.backend.set_keymap(layouts, variants, options);
|
||||
this._currentKeymap = {layouts, variants, options, model};
|
||||
global.backend.set_keymap(layouts, variants, options, model);
|
||||
}
|
||||
|
||||
_applyLayoutGroupIndex(idx) {
|
||||
@@ -158,6 +160,10 @@ class KeyboardManager {
|
||||
this._xkbOptions = options;
|
||||
}
|
||||
|
||||
setKeyboardModel(model) {
|
||||
this._xkbModel = model;
|
||||
}
|
||||
|
||||
_buildOptionsString() {
|
||||
let options = this._xkbOptions.join(',');
|
||||
return options;
|
||||
|
Reference in New Issue
Block a user