diff --git a/extension.js b/extension.js index 2d22604..813719b 100644 --- a/extension.js +++ b/extension.js @@ -54,19 +54,20 @@ var AreaManager = new Lang.Class({ Name: 'DrawOnYourScreenAreaManager', _init: function() { + this.settings = Convenience.getSettings(); this.areas = []; this.activeArea = null; this.enterGicon = new Gio.ThemedIcon({ name: 'applications-graphics-symbolic' }); this.leaveGicon = new Gio.ThemedIcon({ name: 'application-exit-symbolic' }); Main.wm.addKeybinding('toggle-drawing', - Convenience.getSettings(), + this.settings, Meta.KeyBindingFlags.NONE, Shell.ActionMode.ALL, this.toggleDrawing.bind(this)); Main.wm.addKeybinding('erase-drawing', - Convenience.getSettings(), + this.settings, Meta.KeyBindingFlags.NONE, Shell.ActionMode.ALL, this.eraseDrawing.bind(this)); @@ -100,7 +101,12 @@ var AreaManager = new Lang.Class({ let area = new Draw.DrawingArea({ name: 'drawOnYourSreenArea' + i }, monitor, helper); container.add_child(area); container.add_child(helper); - Main.uiGroup.insert_child_above(container, global.window_group); + + if (this.settings.get_boolean("move-drawing-on-desktop")) + Main.layoutManager._backgroundGroup.insert_child_above(container, Main.layoutManager._bgManagers[i].backgroundActor); + else + Main.uiGroup.insert_child_above(container, global.window_group); + container.set_position(monitor.x, monitor.y); container.set_size(monitor.width, monitor.height); area.set_size(monitor.width, monitor.height); @@ -141,7 +147,7 @@ var AreaManager = new Lang.Class({ for (let key in this.internalKeybindings) { Main.wm.addKeybinding(key, - Convenience.getSettings(), + this.settings, Meta.KeyBindingFlags.NONE, 256, this.internalKeybindings[key]); @@ -149,7 +155,7 @@ var AreaManager = new Lang.Class({ for (let i = 1; i < 10; i++) { Main.wm.addKeybinding('select-color' + i, - Convenience.getSettings(), + this.settings, Meta.KeyBindingFlags.NONE, 256, () => this.activeArea.selectColor(i)); @@ -227,7 +233,11 @@ var AreaManager = new Lang.Class({ this.activeArea.leaveDrawingMode(); this.activeArea = null; - Main.uiGroup.set_child_above_sibling(activeContainer, global.window_group); + activeContainer.get_parent().remove_actor(activeContainer); + if (this.settings.get_boolean("move-drawing-on-desktop")) + Main.layoutManager._backgroundGroup.insert_child_above(activeContainer, Main.layoutManager._bgManagers[activeIndex].backgroundActor); + else + Main.uiGroup.insert_child_above(activeContainer, global.window_group); // check display or screen (API changes) if (global.display.set_cursor) @@ -241,7 +251,8 @@ var AreaManager = new Lang.Class({ let currentIndex = Main.layoutManager.monitors.indexOf(Main.layoutManager.currentMonitor); let activeContainer = this.areas[currentIndex].get_parent(); - Main.uiGroup.set_child_above_sibling(activeContainer, null); + activeContainer.get_parent().remove_actor(activeContainer); + Main.uiGroup.add_child(activeContainer); // 256 is a custom Shell.ActionMode if (!Main.pushModal(this.areas[currentIndex], { actionMode: 256 | 1 })) diff --git a/locale/draw-on-your-screen.pot b/locale/draw-on-your-screen.pot index 6578ed6..94c8019 100644 --- a/locale/draw-on-your-screen.pot +++ b/locale/draw-on-your-screen.pot @@ -217,6 +217,12 @@ msgstr "" msgid "Global" msgstr "" +msgid "Move drawing on the desktop when leaving drawing mode" +msgstr "" + +msgid "Draw On Your Screen becomes Draw On Your Desktop" +msgstr "" + msgid "Internal" msgstr "" diff --git a/prefs.js b/prefs.js index 6593337..772c85d 100644 --- a/prefs.js +++ b/prefs.js @@ -125,6 +125,20 @@ const PrefsPage = new GObject.Class({ let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, this.settings); globalKeybindingsWidget.margin = MARGIN; listBox.add(globalKeybindingsWidget); + + let desktopBox = new Gtk.Box({ margin: MARGIN }); + let desktopLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); + let desktopLabel1 = new Gtk.Label({label: _("Move drawing on the desktop when leaving drawing mode")}); + let desktopLabel2 = new Gtk.Label({ use_markup: true, halign: 1, label: "" + _("Draw On Your Screen becomes Draw On Your Desktop") + "" }); + desktopLabel1.set_halign(1); + desktopLabel2.get_style_context().add_class("dim-label"); + desktopLabelBox.pack_start(desktopLabel1, true, true, 0); + desktopLabelBox.pack_start(desktopLabel2, true, true, 0); + let desktopSwitch = new Gtk.Switch({valign: 3}); + this.settings.bind("move-drawing-on-desktop", desktopSwitch, "active", 0); + desktopBox.pack_start(desktopLabelBox, true, true, 4); + desktopBox.pack_start(desktopSwitch, false, false, 4); + listBox.add(desktopBox); this.addSeparator(listBox); let internalTitleBox = new Gtk.Box({ margin: MARGIN }); diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 37b8a67..dbb5659 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 215a9c3..a41ba91 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 @@ -6,6 +6,11 @@ smoothed stroke smoothed stroke + + false + move drawing on desktop + move drawing on desktop + ["<Alt><Super>d"] toggle drawing