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 a3c37c5..ffa73dc 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -355,6 +355,18 @@ Intellihide mouse pointer The mouse pointer next to the edge of the screen reveals the panel + + false + Limit to panel length + + + true + Panel stays revealed when hovered + + + false + Limit to panel length + false Intellihide pressure diff --git a/src/intellihide.js b/src/intellihide.js index 172e173..7549b40 100644 --- a/src/intellihide.js +++ b/src/intellihide.js @@ -298,7 +298,13 @@ export const Intellihide = class { this._signalsHandler.add([ this._pressureBarrier, 'trigger', - () => this._queueUpdatePanelPosition(true), + () => { + let [x, y] = global.get_pointer() + + if (this._pointerIn(x, y, 1, 'intellihide-use-pointer-limit-size')) + this._queueUpdatePanelPosition(true) + else this._pressureBarrier._isTriggered = false + }, ]) } @@ -352,31 +358,26 @@ export const Intellihide = class { } _checkMousePointer(x, y) { - let position = this._dtpPanel.geom.position - - let pointerIn = (offset) => - ((position == St.Side.TOP && y <= this._monitor.y + offset) || - (position == St.Side.BOTTOM && - y >= this._monitor.y + this._monitor.height - offset) || - (position == St.Side.LEFT && x <= this._monitor.x + offset) || - (position == St.Side.RIGHT && - x >= this._monitor.x + this._monitor.width - offset)) && - x >= this._monitor.x && - x < this._monitor.x + this._monitor.width && - y >= this._monitor.y && - y < this._monitor.y + this._monitor.height - if ( - !this._edgeBarrier && + !this._pressureBarrier && !this._hover && !Main.overview.visible && - pointerIn(1) + this._pointerIn(x, y, 1, 'intellihide-use-pointer-limit-size') ) { this._hover = true this._queueUpdatePanelPosition(true) } else if (this._panelBox.visible) { - let hover = pointerIn( - this._dtpPanel.geom.outerSize + this._dtpPanel.geom.topOffset, + let keepRevealedOnHover = SETTINGS.get_boolean( + 'intellihide-revealed-hover', + ) + let fixedOffset = keepRevealedOnHover + ? this._dtpPanel.geom.outerSize + this._dtpPanel.geom.topOffset + : 1 + let hover = this._pointerIn( + x, + y, + fixedOffset, + 'intellihide-revealed-hover-limit-size', ) if (hover == this._hover) return @@ -387,6 +388,31 @@ export const Intellihide = class { } } + _pointerIn(x, y, fixedOffset, limitSizeSetting) { + let position = this._dtpPanel.geom.position + let varOffset = {} + + if (SETTINGS.get_boolean(limitSizeSetting)) { + varOffset[this._dtpPanel.varCoord.c1] = + this._dtpPanel.allocation[this._dtpPanel.varCoord.c1] + varOffset[this._dtpPanel.varCoord.c2] = + this._dtpPanel.allocation[this._dtpPanel.varCoord.c2] + } + + return ( + ((position == St.Side.TOP && y <= this._monitor.y + fixedOffset) || + (position == St.Side.BOTTOM && + y >= this._monitor.y + this._monitor.height - fixedOffset) || + (position == St.Side.LEFT && x <= this._monitor.x + fixedOffset) || + (position == St.Side.RIGHT && + x >= this._monitor.x + this._monitor.width - fixedOffset)) && + x >= this._monitor.x + (varOffset.x1 || 0) && + x < this._monitor.x + (varOffset.x2 || this._monitor.width) && + y >= this._monitor.y + (varOffset.y1 || 0) && + y < this._monitor.y + (varOffset.y2 || this._monitor.height) + ) + } + _queueUpdatePanelPosition(fromRevealMechanism) { if ( !fromRevealMechanism && diff --git a/src/prefs.js b/src/prefs.js index 85b28d5..1efbbc3 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -1580,11 +1580,72 @@ const Preferences = class { Gio.SettingsBindFlags.DEFAULT, ) + this._settings.bind( + 'intellihide-use-pointer-limit-size', + this._builder.get_object('intellihide_use_pointer_limit_button'), + 'active', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._settings.bind( + 'intellihide-use-pointer', + this._builder.get_object('intellihide_use_pointer_limit_button'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._settings.bind( + 'intellihide-revealed-hover', + this._builder.get_object('intellihide_revealed_hover_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._settings.bind( + 'intellihide-use-pointer', + this._builder.get_object('intellihide_revealed_hover_switch'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._settings.bind( + 'intellihide-revealed-hover-limit-size', + this._builder.get_object('intellihide_revealed_hover_limit_button'), + 'active', + Gio.SettingsBindFlags.DEFAULT, + ) + + this._settings.bind( + 'intellihide-revealed-hover', + this._builder.get_object('intellihide_revealed_hover_limit_button'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT, + ) + this._settings.connect('changed::intellihide-use-pointer', () => { - if (!this._settings.get_boolean('intellihide-use-pointer')) + if (!this._settings.get_boolean('intellihide-use-pointer')) { + this._settings.set_boolean('intellihide-revealed-hover', false) + this._settings.set_boolean('intellihide-use-pointer-limit-size', false) this._settings.set_boolean('intellihide-use-pressure', false) + } }) + this._settings.connect('changed::intellihide-revealed-hover', () => { + if (!this._settings.get_boolean('intellihide-revealed-hover')) { + this._settings.set_boolean( + 'intellihide-revealed-hover-limit-size', + false, + ) + } + }) + + this._settings.bind( + 'intellihide-use-pointer', + this._builder.get_object('intellihide_revealed_hover_options'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT, + ) + this._settings.bind( 'intellihide-use-pointer', this._builder.get_object('intellihide_use_pressure_options'), @@ -1770,6 +1831,22 @@ const Preferences = class { 'intellihide-use-pointer', this._settings.get_default_value('intellihide-use-pointer'), ) + this._settings.set_value( + 'intellihide-use-pointer-limit-size', + this._settings.get_default_value( + 'intellihide-use-pointer-limit-size', + ), + ) + this._settings.set_value( + 'intellihide-revealed-hover', + this._settings.get_default_value('intellihide-revealed-hover'), + ) + this._settings.set_value( + 'intellihide-revealed-hover-limit-size', + this._settings.get_default_value( + 'intellihide-revealed-hover-limit-size', + ), + ) 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 f75794b..6f9af33 100644 --- a/ui/BoxIntellihideOptions.ui +++ b/ui/BoxIntellihideOptions.ui @@ -107,12 +107,56 @@ - Touching the edge of the monitor with the pointer reveals the panel + Touching the monitor's edge with the pointer reveals the panel center + + + 10 + + + False + + + + + Limit to panel length + 4 + True + + + + + + + + + Hovering the panel area keeps the panel revealed + + + center + + + + + 10 + + + False + + + + + Limit to panel length + 4 + True + + + +