Skip to content

Commit

Permalink
intellihide: enable/disable unredirect when dock shows/hides
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Feb 4, 2024
1 parent c569e2e commit f791128
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ const DockedDash = GObject.registerClass({
this._autohideIsEnabled = null;
this._intellihideIsEnabled = null;

// This variable counts how many times Meta.disable_unredirect_for_display() is called
// to help restore the original state when intelihide is disabled.
this.disable_unredirect_cnt = 0;

// Create intellihide object to monitor windows overlapping
this._intellihide = new Intellihide.Intellihide(this.monitorIndex);

Expand Down Expand Up @@ -481,6 +485,8 @@ const DockedDash = GObject.registerClass({
if (this._triggerTimeoutId)
GLib.source_remove(this._triggerTimeoutId);

this._restoreUnredirect();

// Remove barrier timeout
if (this._removeBarrierTimeoutId > 0)
GLib.source_remove(this._removeBarrierTimeoutId);
Expand Down Expand Up @@ -662,6 +668,12 @@ const DockedDash = GObject.registerClass({
]);
}

_restoreUnredirect() {
for (let i = 0; i < this.disable_unredirect_cnt; i++)
Meta.enable_unredirect_for_display(global.display);
this.disable_unredirect_cnt = 0;
}

/**
* This is call when visibility settings change
*/
Expand All @@ -682,8 +694,10 @@ const DockedDash = GObject.registerClass({

if (this._intellihideIsEnabled)
this._intellihide.enable();
else
else {
this._intellihide.disable();
this._restoreUnredirect();
}

this._updateDashVisibility();
}
Expand Down Expand Up @@ -813,6 +827,10 @@ const DockedDash = GObject.registerClass({
}

_animateIn(time, delay) {
if (this._intellihideIsEnabled) {
Meta.disable_unredirect_for_display(global.display);
this.disable_unredirect_cnt++;
}
this._dockState = State.SHOWING;
this.dash.iconAnimator.start();
this._delayedHide = false;
Expand Down Expand Up @@ -850,6 +868,10 @@ const DockedDash = GObject.registerClass({
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._dockState = State.HIDDEN;
if (this._intellihideIsEnabled && this.disable_unredirect_cnt > 0) {
Meta.enable_unredirect_for_display(global.display);
this.disable_unredirect_cnt--;
}
// Remove queued barried removal if any
if (this._removeBarrierTimeoutId > 0)
GLib.source_remove(this._removeBarrierTimeoutId);
Expand Down

0 comments on commit f791128

Please sign in to comment.