gnome-shell/gnome-shell-jsc#SLE-16051-Input-method-recommendation.patch

44 lines
2.1 KiB
Diff
Raw Normal View History

diff -urp gnome-shell-46.4.orig/js/ui/status/keyboard.js gnome-shell-46.4/js/ui/status/keyboard.js
--- gnome-shell-46.4.orig/js/ui/status/keyboard.js 2024-08-08 13:52:20.517980778 -0500
+++ gnome-shell-46.4/js/ui/status/keyboard.js 2024-08-08 15:51:36.434589734 -0500
@@ -291,6 +291,39 @@ class InputSourceSessionSettings extends
this._settings.connect(`changed::${this._KEY_KEYBOARD_OPTIONS}`, this._emitKeyboardOptionsChanged.bind(this));
this._settings.connect(`changed::${this._KEY_KEYBOARD_MODEL}`, this._emitKeyboardModelChanged.bind(this));
this._settings.connect(`changed::${this._KEY_PER_WINDOW}`, this._emitPerWindowChanged.bind(this));
+
+ let sources = this._settings.get_value(this._KEY_INPUT_SOURCES);
+ let nSources = sources.n_children();
+ let sourcesList = [];
+
+ if (nSources <= 1) {
+ if (GLib.getenv('LANG') == 'zh_CN.UTF-8') {
+ log('Set default input method in Chinese language env.');
+ sourcesList.push(['xkb', 'cn']);
+ sourcesList.push([ "ibus", "libpinyin" ]);
+
+ let params = GLib.Variant.new('a(ss)', sourcesList);
+ this._settings.set_value(this._KEY_INPUT_SOURCES, params);
+ }
+
+ else if (GLib.getenv('LANG') == 'ja_JP.UTF-8') {
+ log('Set default input method in Japanese language env.');
+ sourcesList.push([ "ibus", "mozc-jp" ]);
+ sourcesList.push(['xkb', 'jp']);
+
+ let params = GLib.Variant.new('a(ss)', sourcesList);
+ this._settings.set_value(this._KEY_INPUT_SOURCES, params);
+ }
+
+ else if (GLib.getenv('LANG') == 'ko_KR.UTF-8') {
+ log('Set default input method in Korean language env.');
+ sourcesList.push(['xkb', 'kr']);
+ sourcesList.push([ "ibus", "hangul" ]);
+
+ let params = GLib.Variant.new('a(ss)', sourcesList);
+ this._settings.set_value(this._KEY_INPUT_SOURCES, params);
+ }
+ }
}
_getSourcesList(key) {