move-drawing-on-desktop pref
This commit is contained in:
parent
9e6b58d3da
commit
0c17e2cfbe
23
extension.js
23
extension.js
|
|
@ -54,19 +54,20 @@ var AreaManager = new Lang.Class({
|
||||||
Name: 'DrawOnYourScreenAreaManager',
|
Name: 'DrawOnYourScreenAreaManager',
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
|
this.settings = Convenience.getSettings();
|
||||||
this.areas = [];
|
this.areas = [];
|
||||||
this.activeArea = null;
|
this.activeArea = null;
|
||||||
this.enterGicon = new Gio.ThemedIcon({ name: 'applications-graphics-symbolic' });
|
this.enterGicon = new Gio.ThemedIcon({ name: 'applications-graphics-symbolic' });
|
||||||
this.leaveGicon = new Gio.ThemedIcon({ name: 'application-exit-symbolic' });
|
this.leaveGicon = new Gio.ThemedIcon({ name: 'application-exit-symbolic' });
|
||||||
|
|
||||||
Main.wm.addKeybinding('toggle-drawing',
|
Main.wm.addKeybinding('toggle-drawing',
|
||||||
Convenience.getSettings(),
|
this.settings,
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Shell.ActionMode.ALL,
|
Shell.ActionMode.ALL,
|
||||||
this.toggleDrawing.bind(this));
|
this.toggleDrawing.bind(this));
|
||||||
|
|
||||||
Main.wm.addKeybinding('erase-drawing',
|
Main.wm.addKeybinding('erase-drawing',
|
||||||
Convenience.getSettings(),
|
this.settings,
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
Shell.ActionMode.ALL,
|
Shell.ActionMode.ALL,
|
||||||
this.eraseDrawing.bind(this));
|
this.eraseDrawing.bind(this));
|
||||||
|
|
@ -100,7 +101,12 @@ var AreaManager = new Lang.Class({
|
||||||
let area = new Draw.DrawingArea({ name: 'drawOnYourSreenArea' + i }, monitor, helper);
|
let area = new Draw.DrawingArea({ name: 'drawOnYourSreenArea' + i }, monitor, helper);
|
||||||
container.add_child(area);
|
container.add_child(area);
|
||||||
container.add_child(helper);
|
container.add_child(helper);
|
||||||
|
|
||||||
|
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);
|
Main.uiGroup.insert_child_above(container, global.window_group);
|
||||||
|
|
||||||
container.set_position(monitor.x, monitor.y);
|
container.set_position(monitor.x, monitor.y);
|
||||||
container.set_size(monitor.width, monitor.height);
|
container.set_size(monitor.width, monitor.height);
|
||||||
area.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) {
|
for (let key in this.internalKeybindings) {
|
||||||
Main.wm.addKeybinding(key,
|
Main.wm.addKeybinding(key,
|
||||||
Convenience.getSettings(),
|
this.settings,
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
256,
|
256,
|
||||||
this.internalKeybindings[key]);
|
this.internalKeybindings[key]);
|
||||||
|
|
@ -149,7 +155,7 @@ var AreaManager = new Lang.Class({
|
||||||
|
|
||||||
for (let i = 1; i < 10; i++) {
|
for (let i = 1; i < 10; i++) {
|
||||||
Main.wm.addKeybinding('select-color' + i,
|
Main.wm.addKeybinding('select-color' + i,
|
||||||
Convenience.getSettings(),
|
this.settings,
|
||||||
Meta.KeyBindingFlags.NONE,
|
Meta.KeyBindingFlags.NONE,
|
||||||
256,
|
256,
|
||||||
() => this.activeArea.selectColor(i));
|
() => this.activeArea.selectColor(i));
|
||||||
|
|
@ -227,7 +233,11 @@ var AreaManager = new Lang.Class({
|
||||||
this.activeArea.leaveDrawingMode();
|
this.activeArea.leaveDrawingMode();
|
||||||
this.activeArea = null;
|
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)
|
// check display or screen (API changes)
|
||||||
if (global.display.set_cursor)
|
if (global.display.set_cursor)
|
||||||
|
|
@ -241,7 +251,8 @@ var AreaManager = new Lang.Class({
|
||||||
let currentIndex = Main.layoutManager.monitors.indexOf(Main.layoutManager.currentMonitor);
|
let currentIndex = Main.layoutManager.monitors.indexOf(Main.layoutManager.currentMonitor);
|
||||||
let activeContainer = this.areas[currentIndex].get_parent();
|
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
|
// 256 is a custom Shell.ActionMode
|
||||||
if (!Main.pushModal(this.areas[currentIndex], { actionMode: 256 | 1 }))
|
if (!Main.pushModal(this.areas[currentIndex], { actionMode: 256 | 1 }))
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,12 @@ msgstr ""
|
||||||
msgid "Global"
|
msgid "Global"
|
||||||
msgstr ""
|
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"
|
msgid "Internal"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
||||||
14
prefs.js
14
prefs.js
|
|
@ -125,6 +125,20 @@ const PrefsPage = new GObject.Class({
|
||||||
let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, this.settings);
|
let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, this.settings);
|
||||||
globalKeybindingsWidget.margin = MARGIN;
|
globalKeybindingsWidget.margin = MARGIN;
|
||||||
listBox.add(globalKeybindingsWidget);
|
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: "<small>" + _("Draw On Your Screen becomes Draw On Your Desktop") + "</small>" });
|
||||||
|
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);
|
this.addSeparator(listBox);
|
||||||
|
|
||||||
let internalTitleBox = new Gtk.Box({ margin: MARGIN });
|
let internalTitleBox = new Gtk.Box({ margin: MARGIN });
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -6,6 +6,11 @@
|
||||||
<summary>smoothed stroke</summary>
|
<summary>smoothed stroke</summary>
|
||||||
<description>smoothed stroke</description>
|
<description>smoothed stroke</description>
|
||||||
</key>
|
</key>
|
||||||
|
<key type="b" name="move-drawing-on-desktop">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>move drawing on desktop</summary>
|
||||||
|
<description>move drawing on desktop</description>
|
||||||
|
</key>
|
||||||
<key type="as" name="toggle-drawing">
|
<key type="as" name="toggle-drawing">
|
||||||
<default>["<Alt><Super>d"]</default>
|
<default>["<Alt><Super>d"]</default>
|
||||||
<summary>toggle drawing</summary>
|
<summary>toggle drawing</summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue