diff --git a/extension.js b/extension.js index e9b1d54..84952ab 100644 --- a/extension.js +++ b/extension.js @@ -3,7 +3,7 @@ // // uuid: ctile@ctile -const { Clutter, St, Meta, GLib, Gtk } = imports.gi; +const { Clutter, St, Meta, GLib, Gtk, Gio } = imports.gi; const Main = imports.ui.main; const Mainloop = imports.mainloop; @@ -316,17 +316,32 @@ class TileOverlay { class CTileExtension { constructor() { - this._overlay = null; - this._dragWindow = null; - this._pollId = null; - this._grabbedLayout = null; - this._grabBeginId = null; - this._grabEndId = null; - this._stThemeChangedId = null; - this._gtkThemeChangedId = null; + this._overlay = null; + this._dragWindow = null; + this._pollId = null; + this._grabbedLayout = null; + this._grabBeginId = null; + this._grabEndId = null; + this._stThemeChangedId = null; + this._gtkThemeChangedId = null; + this._muffinSettings = null; + this._savedEdgeTiling = null; } enable() { + // Disable Cinnamon's built-in edge tiling so it doesn't conflict. + try { + this._muffinSettings = new Gio.Settings({ schema_id: 'org.cinnamon.muffin' }); + this._savedEdgeTiling = this._muffinSettings.get_boolean('edge-tiling'); + if (this._savedEdgeTiling) + this._muffinSettings.set_boolean('edge-tiling', false); + log(`built-in edge-tiling was ${this._savedEdgeTiling}, now disabled`); + } catch(e) { + log(`could not disable edge-tiling: ${e}`); + this._muffinSettings = null; + this._savedEdgeTiling = null; + } + this._overlay = new TileOverlay(); this._grabBeginId = global.display.connect( @@ -350,6 +365,18 @@ class CTileExtension { } disable() { + // Restore the built-in edge tiling to whatever it was before we enabled. + if (this._muffinSettings && this._savedEdgeTiling !== null) { + try { + this._muffinSettings.set_boolean('edge-tiling', this._savedEdgeTiling); + log(`edge-tiling restored to ${this._savedEdgeTiling}`); + } catch(e) { + log(`could not restore edge-tiling: ${e}`); + } + } + this._muffinSettings = null; + this._savedEdgeTiling = null; + this._stopPoll(); if (this._grabBeginId) { global.display.disconnect(this._grabBeginId);