Skip to content

Commit 8c17e07

Browse files
committed
Sync changes from main
1 parent 5ecc8e8 commit 8c17e07

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

[email protected]/extension.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class GjsOskExtension {
187187
this.Keyboard.destroy();
188188
this.Keyboard = null;
189189
}
190-
let [ok, contents] = GLib.file_get_contents(GLib.get_user_cache_dir() + '/gjs-osk/keycodes/' + KeyboardManager.getKeyboardManager().currentLayout.id + '.json');
190+
let [ok, contents] = GLib.file_get_contents(GLib.get_user_cache_dir() + '/gjs-osk/keycodes/' + (KeyboardManager.getKeyboardManager().currentLayout != null ? KeyboardManager.getKeyboardManager().currentLayout.id : "us") + '.json');
191191
if (ok) {
192192
keycodes = JSON.parse(contents);
193193
}
@@ -225,7 +225,11 @@ class GjsOskExtension {
225225
this._toggleKeyboard();
226226
})
227227
let settingsChanged = () => {
228-
let opened = this.Keyboard.opened
228+
let opened;
229+
if (this.Keyboard != null)
230+
opened = this.Keyboard.opened
231+
else
232+
opened = false
229233
if (this.darkSchemeSettings.get_string("color-scheme") == "prefer-dark")
230234
this.settings.scheme = "-dark"
231235
else
@@ -285,7 +289,8 @@ class GjsOskExtension {
285289
this._indicator.destroy();
286290
this._indicator = null;
287291
}
288-
this.Keyboard.destroy();
292+
if (this.Keyboard != null)
293+
this.Keyboard.destroy();
289294
this.settings.disconnect(this.settingsHandlers[0]);
290295
this.darkSchemeSettings.disconnect(this.settingsHandlers[1])
291296
this.inputLanguageSettings.disconnect(this.settingsHandlers[2])

0 commit comments

Comments
 (0)