From 0c17e2cfbec8506a468a75e5d60584999043f4c1 Mon Sep 17 00:00:00 2001 From: abakkk Date: Sun, 10 Mar 2019 22:16:11 +0100 Subject: [PATCH] move-drawing-on-desktop pref --- extension.js | 25 +++++++++++++----- locale/draw-on-your-screen.pot | 6 +++++ prefs.js | 14 ++++++++++ schemas/gschemas.compiled | Bin 2960 -> 3040 bytes ...extensions.draw-on-your-screen.gschema.xml | 5 ++++ 5 files changed, 43 insertions(+), 7 deletions(-) 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 37b8a67896cb5cb6b863c03995ed2d90d5aa141f..dbb5659c1cdf79516ddc2a987422cb1ec692a57e 100644 GIT binary patch literal 3040 zcmai0TWB0*7@caOxtKP+m?mx1SgYL#v)kM^5Tnu9CN)Ars6-!3C%gadPIh)?ota## z!7D0iDZUuQVni%H1kwks3Zn5vicp9zYQcvHeG#?f!H0-wJ!kgcnaLV-;BdY@bLRW+ z|F_2<(`;QcT}3|i;ITp+xj||>z-8<69b~?XDg(+Z;EggxDZf=wuH(5<4M7=Fegv-r zmYt5KO)Dp&PDU6;RLr`?4OWY`dW|VT^ zW{C=LB~T@C3%CZ@DX|M&idty9fjt1a?4b_K@iqVlfJWeU;0~Y(xDz-890u+IjsQ!i zE~c29W8bYzD;4Ni12DFD@qOxysUHRR0dHRa>0|1QtDz5rHDLLhH|nV~-UodadGFTXOVGp4TGg!X~jb^CAXjQ2v1fIEQZpJNr& z8MB`Q;KzZtUq5|~I^#Xi^Wf(IV`Th(>WmwpFM&S++|!r)sWWDtOW-TO)O{ycs57R% z0p5XyyY^A^dFqU7px1&A1FI>$jyhwu8wU>p#eKz?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(WmD4p9U`i zkLx_t%yS;R3`A!PHP0Bbi8H3{w{$i0P>1UT%yY(uoEke)M29QO z?yl@-cU*UORCltUJr(`ziQ{|Li|?(7?~UVoqj)_o6D~S2qpVzB-z??vn9<{*3&GuB z6@6v+d09j^gl_sKZaH8M3GcrqK{ zLgU=)%)Cx5Cl_W#zxUa}K>x^8QF#LF{DshZl1?zL?YNT+C_g zrsR}P$bw~;l66h!`aQL_|NSF*Ya$q!!wydri?={AtfV}D``dB1Czi6~V&zAxAu*3d z-HtD(l_7n@pANfR&f~8gZ*HKYuH}?}KN|hN;JVmVmHV(9r(T$nHjc?e(WdnC<=nQ#ok;*^P%=DCyH54bhQ+mt7(Bu{hTFr0dP=hSIL=u+&SAS9iQmy~M;zS|waa&5GjJ=wcO2hyc&6b#;hiYN z-2mTn_XGTF0IC2yS;Ds_u8;7oi7QUr3)BO=cKAl*`*An01>n1pZ%)259{_N5hwn_j c6ZzKU`*km{8AxuR@Cbod9uG_R6COYR0T!ye8vpsmoothed stroke smoothed stroke + + false + move drawing on desktop + move drawing on desktop + ["<Alt><Super>d"] toggle drawing