diff --git a/extension.js b/extension.js index 4330d8c..9a9afce 100644 --- a/extension.js +++ b/extension.js @@ -198,7 +198,8 @@ var AreaManager = new Lang.Class({ 'toggle-font-style': this.activeArea.toggleFontStyle.bind(this.activeArea), 'toggle-panel-and-dock-visibility': this.togglePanelAndDockOpacity.bind(this), 'toggle-help': this.activeArea.toggleHelp.bind(this.activeArea), - 'open-user-stylesheet': this.openUserStyleFile.bind(this) + 'open-user-stylesheet': this.openUserStyleFile.bind(this), + 'open-preferences': this.openPreferences.bind(this) }; for (let key in this.internalKeybindings) { @@ -229,6 +230,15 @@ var AreaManager = new Lang.Class({ } }, + openPreferences: function() { + // since GS 3.36 + if (ExtensionUtils.openPrefs) { + if (this.activeArea) + this.toggleDrawing(); + ExtensionUtils.openPrefs(); + } + }, + openUserStyleFile: function() { if (!this.userStyleFile.query_exists(null)) { if (!this.userStyleFile.get_parent().query_exists(null)) diff --git a/locale/draw-on-your-screen.pot b/locale/draw-on-your-screen.pot index baefa57..688baa7 100644 --- a/locale/draw-on-your-screen.pot +++ b/locale/draw-on-your-screen.pot @@ -241,6 +241,9 @@ msgstr "" msgid "Edit style" msgstr "" +msgid "Open preferences" +msgstr "" + msgid "Show help" msgstr "" diff --git a/prefs.js b/prefs.js index b46046a..4e958f0 100644 --- a/prefs.js +++ b/prefs.js @@ -25,12 +25,14 @@ const Gtk = imports.gi.Gtk; const Lang = imports.lang; const Mainloop = imports.mainloop; +const Config = imports.misc.config; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Convenience = ExtensionUtils.getSettings && ExtensionUtils.initTranslations ? ExtensionUtils : Me.imports.convenience; const _ = imports.gettext.domain(Me.metadata['gettext-domain']).gettext; const _GTK = imports.gettext.domain('gtk30').gettext; +const GS_VERSION = Config.PACKAGE_VERSION; const MARGIN = 10; var GLOBAL_KEYBINDINGS = { @@ -74,9 +76,13 @@ var INTERNAL_KEYBINDINGS = { 'save-as-json': "Save drawing", 'save-as-svg': "Save drawing as a SVG file", 'open-user-stylesheet': "Edit style", + 'open-preferences': "Open preferences", 'toggle-help': "Show help" }; +if (GS_VERSION < "3.36") + delete INTERNAL_KEYBINDINGS['open-preferences']; + function getKeyLabel(accel) { let [keyval, mods] = Gtk.accelerator_parse(accel); return Gtk.accelerator_get_label(keyval, mods); diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 0f24469..b90b102 100644 Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ diff --git a/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml b/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml index a8b1f90..7a3fab7 100644 --- a/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml +++ b/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml @@ -231,6 +231,11 @@ Open next json file Open next json file + + ["<Primary>comma"] + Open preferences + Open preferences + ["<Primary>F1"] toggle help