Skip to content

Commit

Permalink
Fix monitor problems on lock (#84 and #88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal committed Feb 8, 2025
1 parent 3520726 commit d951963
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
19 changes: 14 additions & 5 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ export default class GjsOskExtension extends Extension {
let allConfigs = Object.keys(currentMonitorMap).map(Number.parseInt).sort();
currentMonitorMap[monitors.length + ""] = allConfigs[allConfigs.length - 1];
}
currentMonitorId = global.backend.get_monitor_manager().get_monitor_for_connector(currentMonitorMap[monitors.length + ""]);
if (currentMonitorId == -1) {
try {
currentMonitorId = global.backend.get_monitor_manager().get_monitor_for_connector(currentMonitorMap[monitors.length + ""]);
if (currentMonitorId == -1) {
currentMonitorId = 0;
}
} catch {
currentMonitorId = 0;
}
if (!Gio.File.new_for_path(GLib.get_user_cache_dir() + "/gjs-osk").query_exists(null)) {
Expand All @@ -181,7 +185,7 @@ export default class GjsOskExtension extends Extension {
throw new Error(err);
}
}
if (this.Keyboard) {
if (this.Keyboard != null) {
this.Keyboard.destroy();
this.Keyboard = null;
}
Expand Down Expand Up @@ -226,7 +230,11 @@ export default class GjsOskExtension extends Extension {
this._toggleKeyboard();
})
let settingsChanged = () => {
let opened = this.Keyboard.opened
let opened;
if (this.Keyboard != null)
opened = this.Keyboard.opened
else
opened = false
if (this.darkSchemeSettings.get_string("color-scheme") == "prefer-dark")
this.settings.scheme = "-dark"
else
Expand Down Expand Up @@ -288,7 +296,8 @@ export default class GjsOskExtension extends Extension {
this._indicator.destroy();
this._indicator = null;
}
this.Keyboard.destroy();
if (this.Keyboard != null)
this.Keyboard.destroy();
this.settings.disconnect(this.settingsHandlers[0]);
this.darkSchemeSettings.disconnect(this.settingsHandlers[1])
this.inputLanguageSettings.disconnect(this.settingsHandlers[2])
Expand Down
11 changes: 8 additions & 3 deletions [email protected]/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@ export default class GjsOskPreferences extends ExtensionPreferences {
}
let monitorDrop = Gtk.DropDown.new_from_strings(monitors.map(m => m.get_model()))
monitorDrop.valign = Gtk.Align.CENTER;
let currentMonitors = settings.get_string("default-monitor").split(";")
let currentMonitorMap = {};
let currentMonitors;
if (settings.get_string("default-monitor").includes(";")) {
currentMonitors = settings.get_string("default-monitor").split(";")
} else {
currentMonitors = [("1:" + monitors[0].get_connector())]
}

for (var i of currentMonitors) {
let tmp = i.split(":");
Expand Down Expand Up @@ -278,11 +283,11 @@ export default class GjsOskPreferences extends ExtensionPreferences {

systemAccCol.add_suffix(systemAccColEnabled)
systemAccCol.activatable_widget = systemAccColEnabled

systemAccCol.set_sensitive(major >= 47)
lightCol.set_sensitive(!settings.get_boolean("system-accent-col"));
darkCol.set_sensitive(!settings.get_boolean("system-accent-col"));

let fontSize = new Adw.ActionRow({
title: _('Font Size (px)')
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<default>7</default>
</key>
<key name="default-monitor" type="s">
<default>"1:0"</default>
<default>""</default>
</key>
<key name="enable-tap-gesture" type="i">
<default>1</default>
Expand Down

0 comments on commit d951963

Please sign in to comment.