Add window workspace check in proximity detection

fixes #1424
This commit is contained in:
Charles Gagnon
2022-04-02 18:21:46 -04:00
parent 9ca0c6bda8
commit da6d6fdc7b
3 changed files with 11 additions and 13 deletions

View File

@@ -88,7 +88,8 @@ var Intellihide = class {
if (Me.settings.get_boolean('intellihide-hide-from-windows')) {
this._proximityWatchId = this._proximityManager.createWatch(
this._panelBox.get_parent(),
this._panelBox.get_parent(),
this._dtpPanel.monitor.index,
Proximity.Mode[Me.settings.get_string('intellihide-behaviour')],
0, 0,
overlap => {

View File

@@ -38,8 +38,9 @@ var Mode = {
class ProximityWatch {
constructor(actor, mode, xThreshold, yThreshold, handler) {
constructor(actor, monitorIndex, mode, xThreshold, yThreshold, handler) {
this.actor = actor;
this.monitorIndex = monitorIndex
this.overlap = 0;
this.mode = mode;
this.threshold = [xThreshold, yThreshold];
@@ -47,18 +48,12 @@ class ProximityWatch {
this._allocationChangedId = actor.connect('notify::allocation', () => this._update());
this._update();
this._updateWatchRect();
}
destroy() {
this.actor.disconnect(this._allocationChangedId);
}
_update() {
this.monitorIndex = Main.layoutManager.findIndexForActor(this.actor);
this._updateWatchRect();
}
_updateWatchRect() {
let [actorX, actorY] = this.actor.get_position();
@@ -86,8 +81,8 @@ var ProximityManager = class {
this._setFocusedWindow();
}
createWatch(actor, mode, xThreshold, yThreshold, handler) {
let watch = new ProximityWatch(actor, mode, xThreshold, yThreshold, handler);
createWatch(actor, monitorIndex, mode, xThreshold, yThreshold, handler) {
let watch = new ProximityWatch(actor, monitorIndex, mode, xThreshold, yThreshold, handler);
this._watches[this._counter] = watch;
this.update();
@@ -247,7 +242,8 @@ var ProximityManager = class {
this._checkProximity(this._focusedWindowInfo.metaWindow, watch));
} else if (watch.mode === Mode.MAXIMIZED_WINDOWS) {
return metaWindows.some(mw => mw.maximized_vertically && mw.maximized_horizontally &&
mw.get_monitor() == watch.monitorIndex);
mw.get_monitor() == watch.monitorIndex &&
mw.get_workspace() == Utils.getCurrentWorkspace());
}
//Mode.ALL_WINDOWS

View File

@@ -138,7 +138,8 @@ var DynamicTransparency = class {
let threshold = Me.settings.get_int('trans-dynamic-distance');
this._proximityWatchId = this._proximityManager.createWatch(
this._dtpPanel.panelBox.get_parent(),
this._dtpPanel.panelBox.get_parent(),
this._dtpPanel.monitor.index,
Proximity.Mode[Me.settings.get_string('trans-dynamic-behavior')],
isVertical ? threshold : 0,
isVertical ? 0 : threshold,