From d3f36ccbcdeffd904a81123365e668e4d0365764 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 14 Jan 2020 17:58:53 -0500 Subject: [PATCH] Add option forcing hot corner on primary monitor --- Settings.ui | 49 ++++++++++++++----- panelManager.js | 15 ++++-- prefs.js | 5 ++ ...shell.extensions.dash-to-panel.gschema.xml | 5 ++ 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/Settings.ui b/Settings.ui index 63934bd..21d572b 100644 --- a/Settings.ui +++ b/Settings.ui @@ -4963,8 +4963,8 @@ False 12 12 - 12 - 12 + 6 + 6 32 @@ -5012,8 +5012,8 @@ False 12 12 - 12 - 12 + 6 + 6 12 32 @@ -5062,8 +5062,8 @@ False 12 12 - 12 - 12 + 6 + 6 32 @@ -6992,9 +6992,9 @@ False 12 12 - 12 - 12 - 20 + 6 + 6 + 12 32 @@ -7098,7 +7098,7 @@ 12 12 12 - 20 + 12 32 @@ -7230,7 +7230,7 @@ 12 12 12 - 20 + 6 32 @@ -7318,7 +7318,7 @@ 12 12 12 - 19 + 6 32 @@ -7370,6 +7370,31 @@ 1 + + + True + False + True + Force Activities hot corner on primary monitor + 0 + + + 0 + 2 + + + + + True + True + end + center + + + 1 + 2 + + diff --git a/panelManager.js b/panelManager.js index ed44a17..c19b857 100755 --- a/panelManager.js +++ b/panelManager.js @@ -146,6 +146,8 @@ var dtpPanelManager = Utils.defineClass({ Main.layoutManager._updateHotCorners = Lang.bind(Main.layoutManager, newUpdateHotCorners); Main.layoutManager._updateHotCorners(); + this._forceHotCornerId = Me.settings.connect('changed::stockgs-force-hotcorner', () => Main.layoutManager._updateHotCorners()); + if (Main.layoutManager._interfaceSettings) { this._enableHotCornersId = Main.layoutManager._interfaceSettings.connect('changed::enable-hot-corners', () => Main.layoutManager._updateHotCorners()); } @@ -263,6 +265,8 @@ var dtpPanelManager = Utils.defineClass({ Main.layoutManager._updateHotCorners = this._oldUpdateHotCorners; Main.layoutManager._updateHotCorners(); + Me.settings.disconnect(this._forceHotCornerId); + if (this._enableHotCornersId) { Main.layoutManager._interfaceSettings.disconnect(this._enableHotCornersId); } @@ -569,6 +573,7 @@ function newUpdateHotCorners() { } let panelPosition = Panel.getPosition(); + let panelTopLeft = panelPosition == St.Side.TOP || panelPosition == St.Side.LEFT; // build new hot corners for (let i = 0; i < this.monitors.length; i++) { @@ -578,11 +583,11 @@ function newUpdateHotCorners() { let haveTopLeftCorner = true; - // If the panel is on the bottom, don't add a topleft hot corner unless it is actually - // a top left panel. Otherwise, it stops the mouse as you are dragging across - // In the future, maybe we will automatically move the hotcorner to the bottom - // when the panel is positioned at the bottom - if (i != this.primaryIndex || panelPosition == St.Side.BOTTOM || panelPosition == St.Side.RIGHT) { + // If the panel is on the bottom, unless this is explicitly forced, don't add a topleft + // hot corner unless it is actually a top left panel. Otherwise, it stops the mouse + // as you are dragging across. In the future, maybe we will automatically move the + // hotcorner to the bottom when the panel is positioned at the bottom + if (i != this.primaryIndex || (!panelTopLeft && !Me.settings.get_boolean('stockgs-force-hotcorner'))) { // Check if we have a top left (right for RTL) corner. // I.e. if there is no monitor directly above or to the left(right) let besideX = this._rtl ? monitor.x + 1 : cornerX - 1; diff --git a/prefs.js b/prefs.js index dee7fd3..87dda60 100644 --- a/prefs.js +++ b/prefs.js @@ -1760,6 +1760,11 @@ const Settings = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('stockgs-force-hotcorner', + this._builder.get_object('stockgs_hotcorner_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + // About Panel this._builder.get_object('extension_version').set_label(Me.metadata.version.toString() + (Me.metadata.commit ? ' (' + Me.metadata.commit + ')' : '')); diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index a22170e..b45cda7 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -196,6 +196,11 @@ Panel menu buttons require click Whether to activate the panel menu buttons on hover or on click + + false + Force hot corner + Wheter to force having an Activities hot corner on the primary monitor + 'STATUSLEFT' Location of the clock