From d12596da6f716caae09ad8a8686f264ceff06059 Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Thu, 2 Jan 2020 17:19:16 -0500 Subject: [PATCH] Added mouse support to preferences --- extension.js | 6 ++++-- prefs.js | 20 ++++++++++++++++-- schemas/gschemas.compiled | Bin 412 -> 460 bytes ...gnome.shell.extensions.wintile.gschema.xml | 5 +++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/extension.js b/extension.js index fb4c975..1cfd83b 100644 --- a/extension.js +++ b/extension.js @@ -28,6 +28,7 @@ let config = { useMaximize: true, debug: true, preview: { + enabled: true, close: 75, delay: 500 } @@ -48,6 +49,7 @@ let settings = new Gio.Settings({ function updateSettings() { config.cols = (settings.get_value('cols').deep_unpack())+2; config.useMaximize = settings.get_value('use-maximize').deep_unpack(); + config.preview.enabled = settings.get_value('preview').deep_unpack(); config.debug = settings.get_value('debug').deep_unpack(); _log(JSON.stringify(config)); } @@ -571,7 +573,7 @@ function checkForMove(curFrameBefore, app) { function windowGrabBegin(meta_display, meta_screen, meta_window, meta_grab_op, gpointer) { _log('windowGrabBegin') - if (meta_window.resizeable) { + if (meta_window.resizeable && config.preview.enabled) { windowMoving = true; var app = global.display.focus_window; if (app.wintile) { @@ -585,7 +587,7 @@ function windowGrabBegin(meta_display, meta_screen, meta_window, meta_grab_op, g function windowGrabEnd(meta_display, meta_screen, meta_window, meta_grab_op, gpointer) { _log('windowGrabEnd') - if (meta_window.resizeable) { + if (meta_window.resizeable && config.preview.enabled) { windowMoving = false; if (preview.visible == true) { var app = global.display.focus_window; diff --git a/prefs.js b/prefs.js index 43448ee..5c2a218 100644 --- a/prefs.js +++ b/prefs.js @@ -91,6 +91,21 @@ function buildPrefsWidget() { layout.attach(maximizeLabel, 0, 2, 1, 1); layout.attach(maximizeInput, 1, 2, 1, 1); + // Preview setting + let previewLabel = new Gtk.Label({ + label: _("Turn on mouse dragging support"), + visible: true, + hexpand: true, + halign: Gtk.Align.START + }); + let previewInput = new Gtk.Switch({ + active: this.settings.get_boolean ('preview'), + halign: Gtk.Align.END, + visible: true + }); + layout.attach(previewLabel, 0, 3, 1, 1); + layout.attach(previewInput, 1, 3, 1, 1); + // Debug setting let debugLabel = new Gtk.Label({ label: _("Turn on debugging"), @@ -103,11 +118,12 @@ function buildPrefsWidget() { halign: Gtk.Align.END, visible: true }); - layout.attach(debugLabel, 0, 3, 1, 1); - layout.attach(debugInput, 1, 3, 1, 1); + layout.attach(debugLabel, 0, 4, 1, 1); + layout.attach(debugInput, 1, 4, 1, 1); this.settings.bind('cols', colsInput, 'active', Gio.SettingsBindFlags.DEFAULT); this.settings.bind('use-maximize', maximizeInput, 'active', Gio.SettingsBindFlags.DEFAULT); + this.settings.bind('preview', previewInput, 'active', Gio.SettingsBindFlags.DEFAULT); this.settings.bind('debug', debugInput, 'active', Gio.SettingsBindFlags.DEFAULT); // Return our widget which will be added to the window diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 8b33492aa9c68ca5a8a0707ad25230001f99d33d..3c6a08b1ff2a9c18bc65557ad2f5ef2572c49b4d 100644 GIT binary patch literal 460 zcmYLGu};G<6nupi29OW~5;Kz{m3U=A9a|(O2EuA zi#O?%n7@Inh{M=qsS52xB}u5}r7~7$#)dO(N}VV^Ph!In5x=$W(FS*b?%TfmW2jDUAdiL|gKI?7xIk*D))x(N?)|>F}!1uuC&FvO{J8QoG5&X{D z&%~N%`T+A>mughSY`GGnV4NkkS%M3%U2Z~)E1`7|1eH~XX*AcVzE;#C^yP(`YBl5I hZXM=PIjNf^f|D*d>4KC0!AT#SB(mtMi!*Ef(;pJwSd0Jw literal 412 zcmYLFJx{|h5WPY(fdmXlotYd7>;d+&Q6yLxP&Y`yN>56hDo&xG!mr?KKw?1r4}KR5 zyt5Nw>G?f9pYG1@=sc@Aa}Bj;03JuJRyq?r-1@lawQoB#q9ybujAWbW7w1(T>4e_E z??6@OI(JoRwV&Fe(00*S=ecrT-?D4Cuu@Md2^24xw+i%um*MkLTFQ(*-OvEM4|MZH z%e({dA+Y;(ydjq81ob2EDe!sr^CZ6Lb@-QH3w%F3uF2k_rG5sMKU`IXm(FtPNEC8V ztnL(Znx?_+cD=Tfc^(`!N$1|~mDz$zzK`D{>JfZB%bICyW)O@C!I%(?`47gl!5E^r F!XK%*O^W~k diff --git a/schemas/org.gnome.shell.extensions.wintile.gschema.xml b/schemas/org.gnome.shell.extensions.wintile.gschema.xml index 7a4b587..8663584 100644 --- a/schemas/org.gnome.shell.extensions.wintile.gschema.xml +++ b/schemas/org.gnome.shell.extensions.wintile.gschema.xml @@ -12,6 +12,11 @@ Turn on/off use of maximizing windows When on, certain windows that won't resize full screen like Terminal will, however animations may occur between tile shifts. + + true + Turn on/off mouse positioning + When on, dragging windows with the mouse will allow placement into the grid. + false Turn on/off debug output