From f0af17687f625bf03fa644cfe9e2bb765ff7ec92 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Wed, 9 Apr 2025 23:37:37 -0400 Subject: [PATCH] Add intellihide option to disable panel reveal with the pointer gh-2123 --- ...shell.extensions.dash-to-panel.gschema.xml | 7 ++++- src/intellihide.js | 9 +++++-- src/prefs.js | 27 +++++++++++++++++-- ui/BoxIntellihideOptions.ui | 14 ++++++++-- 4 files changed, 50 insertions(+), 7 deletions(-) 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 867c383..a3c37c5 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -350,10 +350,15 @@ Intellihide behaviour Dictates how to intelligently hide the panel + + true + Intellihide mouse pointer + The mouse pointer next to the edge of the screen reveals the panel + false Intellihide pressure - To reveal the panel, pressure needs to be applied to the edege of the screen + To reveal the panel, pressure needs to be applied to the edge of the screen 100 diff --git a/src/intellihide.js b/src/intellihide.js index 3f6ca2f..172e173 100644 --- a/src/intellihide.js +++ b/src/intellihide.js @@ -116,7 +116,8 @@ export const Intellihide = class { ) } - this._setRevealMechanism() + if (SETTINGS.get_boolean('intellihide-use-pointer')) + this._setRevealMechanism() let lastState = SETTINGS.get_int('intellihide-persisted-state') @@ -238,6 +239,7 @@ export const Intellihide = class { [ SETTINGS, [ + 'changed::intellihide-use-pointer', 'changed::intellihide-use-pressure', 'changed::intellihide-hide-from-windows', 'changed::intellihide-hide-from-monitor-windows', @@ -307,7 +309,10 @@ export const Intellihide = class { } _removeRevealMechanism() { - PointerWatcher.getPointerWatcher()._removeWatch(this._pointerWatch) + if (this._pointerWatch) { + PointerWatcher.getPointerWatcher()._removeWatch(this._pointerWatch) + this._pointerWatch = 0 + } if (this._pressureBarrier) { this._pressureBarrier.destroy() diff --git a/src/prefs.js b/src/prefs.js index bec3193..3932a8f 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -1592,6 +1592,25 @@ const Preferences = class { Gio.SettingsBindFlags.DEFAULT, ) + this._settings.bind( + 'intellihide-use-pointer', + this._builder.get_object('intellihide_use_pointer_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._settings.connect('changed::intellihide-use-pointer', () => { + if (!this._settings.get_boolean('intellihide-use-pointer')) + this._settings.set_boolean('intellihide-use-pressure', false) + }) + + this._settings.bind( + 'intellihide-use-pointer', + this._builder.get_object('intellihide_use_pressure_options'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT, + ) + this._settings.bind( 'intellihide-use-pressure', this._builder.get_object('intellihide_use_pressure_switch'), @@ -1601,14 +1620,14 @@ const Preferences = class { this._settings.bind( 'intellihide-use-pressure', - this._builder.get_object('intellihide_use_pressure_options'), + this._builder.get_object('intellihide_use_pressure_options2'), 'sensitive', Gio.SettingsBindFlags.DEFAULT, ) this._settings.bind( 'intellihide-use-pressure', - this._builder.get_object('intellihide_use_pressure_options2'), + this._builder.get_object('intellihide_use_pressure_options3'), 'sensitive', Gio.SettingsBindFlags.DEFAULT, ) @@ -1766,6 +1785,10 @@ const Preferences = class { 'intellihide-behaviour', this._settings.get_default_value('intellihide-behaviour'), ) + this._settings.set_value( + 'intellihide-use-pointer', + this._settings.get_default_value('intellihide-use-pointer'), + ) this._settings.set_value( 'intellihide-use-pressure', this._settings.get_default_value('intellihide-use-pressure'), diff --git a/ui/BoxIntellihideOptions.ui b/ui/BoxIntellihideOptions.ui index 4d0d33d..f75794b 100644 --- a/ui/BoxIntellihideOptions.ui +++ b/ui/BoxIntellihideOptions.ui @@ -107,6 +107,16 @@ + Touching the edge of the monitor with the pointer reveals the panel + + + center + + + + + + Require pressure at the edge of the monitor to reveal the panel @@ -116,7 +126,7 @@ - + Required pressure threshold (px) @@ -130,7 +140,7 @@ - + Required pressure timeout (ms)