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 9107517..52d99df 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -338,9 +338,13 @@ false - Only hide from windows + Only hide from overlapping windows Dictates if the dash should only hide when in conflict with windows + + false + Only hide from windows on monitor + 'FOCUSED_WINDOWS' Intellihide behaviour diff --git a/src/intellihide.js b/src/intellihide.js index a7fae80..d9a577a 100644 --- a/src/intellihide.js +++ b/src/intellihide.js @@ -17,6 +17,7 @@ import Clutter from 'gi://Clutter' import Meta from 'gi://Meta' +import Mtk from 'gi://Mtk' import Shell from 'gi://Shell' import St from 'gi://St' @@ -92,9 +93,18 @@ export const Intellihide = class { this._setTrackPanel(true) this._bindGeneralSignals() - if (SETTINGS.get_boolean('intellihide-hide-from-windows')) { + if (this._hidesFromWindows()) { + let watched = SETTINGS.get_boolean('intellihide-hide-from-windows') + ? this._panelBox.get_parent() + : new Mtk.Rectangle({ + x: this._monitor.x, + y: this._monitor.y, + width: this._monitor.width, + height: this._monitor.height, + }) + this._proximityWatchId = this._proximityManager.createWatch( - this._panelBox.get_parent(), + watched, this._dtpPanel.monitor.index, Proximity.Mode[SETTINGS.get_string('intellihide-behaviour')], 0, @@ -193,6 +203,13 @@ export const Intellihide = class { this.enable() } + _hidesFromWindows() { + return ( + SETTINGS.get_boolean('intellihide-hide-from-windows') || + SETTINGS.get_boolean('intellihide-hide-from-monitor-windows') + ) + } + _changeEnabledStatus() { let intellihide = SETTINGS.get_boolean('intellihide') let onlySecondary = SETTINGS.get_boolean('intellihide-only-secondary') @@ -223,6 +240,7 @@ export const Intellihide = class { [ 'changed::intellihide-use-pressure', 'changed::intellihide-hide-from-windows', + 'changed::intellihide-hide-from-monitor-windows', 'changed::intellihide-behaviour', 'changed::intellihide-pressure-threshold', 'changed::intellihide-pressure-time', @@ -417,7 +435,7 @@ export const Intellihide = class { return !mouseBtnIsPressed } - if (!SETTINGS.get_boolean('intellihide-hide-from-windows')) { + if (!this._hidesFromWindows()) { return this._hover } diff --git a/src/prefs.js b/src/prefs.js index 0252b84..95bd8a5 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -1542,18 +1542,49 @@ const Preferences = class { this._settings.bind( 'intellihide-hide-from-windows', - this._builder.get_object('intellihide_window_hide_switch'), + this._builder.get_object('intellihide_window_hide_button'), 'active', Gio.SettingsBindFlags.DEFAULT, ) this._settings.bind( - 'intellihide-hide-from-windows', - this._builder.get_object('intellihide_behaviour_options'), - 'sensitive', + 'intellihide-hide-from-monitor-windows', + this._builder.get_object('intellihide_window_monitor_hide_button'), + 'active', Gio.SettingsBindFlags.DEFAULT, ) + let setIntellihideBehaviorSensitivity = () => { + let overlappingButton = this._builder.get_object( + 'intellihide_window_hide_button', + ) + let hideFromMonitorWindows = this._settings.get_boolean( + 'intellihide-hide-from-monitor-windows', + ) + + if (hideFromMonitorWindows) overlappingButton.set_active(false) + + overlappingButton.set_sensitive(!hideFromMonitorWindows) + + this._builder + .get_object('intellihide_behaviour_options') + .set_sensitive( + this._settings.get_boolean('intellihide-hide-from-windows') || + hideFromMonitorWindows, + ) + } + + this._settings.connect( + 'changed::intellihide-hide-from-windows', + setIntellihideBehaviorSensitivity, + ) + this._settings.connect( + 'changed::intellihide-hide-from-monitor-windows', + setIntellihideBehaviorSensitivity, + ) + + setIntellihideBehaviorSensitivity() + this._settings.bind( 'intellihide-behaviour', this._builder.get_object('intellihide_behaviour_combo'), diff --git a/src/proximity.js b/src/proximity.js index 91d8232..857da03 100644 --- a/src/proximity.js +++ b/src/proximity.js @@ -34,14 +34,23 @@ export const Mode = { MAXIMIZED_WINDOWS: 2, } -export class ProximityWatch { - constructor(actor, monitorIndex, mode, xThreshold, yThreshold, handler) { - this.actor = actor +class ProximityRectWatch { + constructor(rect, monitorIndex, mode, xThreshold, yThreshold, handler) { + this.rect = rect this.monitorIndex = monitorIndex this.overlap = false this.mode = mode this.threshold = [xThreshold, yThreshold] this.handler = handler + } + + destroy() {} +} + +class ProximityActorWatch extends ProximityRectWatch { + constructor(actor, monitorIndex, mode, xThreshold, yThreshold, handler) { + super(null, monitorIndex, mode, xThreshold, yThreshold, handler) + this.actor = actor this._allocationChangedId = actor.connect('notify::allocation', () => this._updateWatchRect(), @@ -79,9 +88,14 @@ export const ProximityManager = class { this._setFocusedWindow() } - createWatch(actor, monitorIndex, mode, xThreshold, yThreshold, handler) { - let watch = new ProximityWatch( - actor, + createWatch(watched, monitorIndex, mode, xThreshold, yThreshold, handler) { + let constr = + watched instanceof Mtk.Rectangle + ? ProximityRectWatch + : ProximityActorWatch + + let watch = new constr( + watched, monitorIndex, mode, xThreshold, diff --git a/ui/BoxIntellihideOptions.ui b/ui/BoxIntellihideOptions.ui index 86db76b..a2c6c16 100644 --- a/ui/BoxIntellihideOptions.ui +++ b/ui/BoxIntellihideOptions.ui @@ -44,10 +44,38 @@ - Only hide the panel when it is obstructed by windows + Only hide the panel from windows - - center + + 10 + + + False + + + + + Overlapping + 4 + True + + + + + + + + + False + + + + + On same monitor + 4 + True + + @@ -73,7 +101,7 @@ - Require pressure at the edge of the screen to reveal the panel + Require pressure at the edge of the monitor to reveal the panel center diff --git a/ui/SettingsPosition.ui b/ui/SettingsPosition.ui index a87ea78..de0fb53 100644 --- a/ui/SettingsPosition.ui +++ b/ui/SettingsPosition.ui @@ -108,7 +108,7 @@ - Panel screen position + Panel monitor position True