Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 50 additions & 14 deletions docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ const DockedDash = GObject.registerClass({
// Create intellihide object to monitor windows overlapping
this._intellihide = new Intellihide.Intellihide(this.monitorIndex);

// initialize dock state
this._dockState = State.HIDDEN;
// initialize dock state - must be consistent with slide_x initial value
// If not starting up, slide_x is 1 (visible), so state should be SHOWN
this._dockState = Main.layoutManager._startingUp ? State.HIDDEN : State.SHOWN;

// Put dock on the required monitor
this._monitor = Main.layoutManager.monitors[this.monitorIndex];
Expand Down Expand Up @@ -393,6 +394,8 @@ const DockedDash = GObject.registerClass({
this.dash._container.connect('notify::allocation', this._updateStaticBox.bind(this));
this._slider.connect(this._isHorizontal ? 'notify::x' : 'notify::y',
this._updateStaticBox.bind(this));
this._slider.connect('notify::slide-x',
Main.layoutManager._queueUpdateRegions.bind(Main.layoutManager));

// Load optional features that need to be activated for one dock only
if (this.isMain)
Expand Down Expand Up @@ -452,17 +455,19 @@ const DockedDash = GObject.registerClass({
}

_trackDock() {
if (this.get_parent())
Main.layoutManager.removeChrome(this);

if (DockManager.settings.dockFixed) {
if (this.get_parent())
Main.layoutManager.removeChrome(this);
Main.layoutManager.addChrome(this, {
trackFullscreen: true,
affectsStruts: true,
});
} else {
if (this.get_parent())
Main.layoutManager.removeChrome(this);
Main.layoutManager.addChrome(this);
Main.layoutManager.addChrome(this, {
trackFullscreen: true,
affectsStruts: false,
});
}
}

Expand All @@ -472,6 +477,9 @@ const DockedDash = GObject.registerClass({
// Apply custom css class according to the settings
this._themeManager.updateCustomTheme();

// Ensure staticBox is updated before visibility mode
this._updateStaticBox();

this._updateVisibilityMode();

// In case we are already inside the overview when the extension is loaded,
Expand Down Expand Up @@ -712,10 +720,13 @@ const DockedDash = GObject.registerClass({
this._intellihideIsEnabled = settings.intellihide;
}

if (this._autohideIsEnabled)
if (this._autohideIsEnabled) {
this.add_style_class_name('autohide');
else
// Reset ignore hover when autohide is enabled
this._ignoreHover = false;
} else {
this.remove_style_class_name('autohide');
}

if (this._intellihideIsEnabled) {
this._intellihide.enable();
Expand Down Expand Up @@ -784,12 +795,17 @@ const DockedDash = GObject.registerClass({
}

_onOverviewHiding() {
this._ignoreHover = false;
this._intellihide.enable();
this._updateDashVisibility();
}

_onOverviewHidden() {
this.remove_style_class_name('overview');
this._box.sync_hover();
// Force intellihide to recheck overlap after overview is hidden
if (this._intellihideIsEnabled)
this._intellihide.forceUpdate();
this._updateDashVisibility();
}

Expand Down Expand Up @@ -1249,12 +1265,32 @@ const DockedDash = GObject.registerClass({
}

_updateStaticBox() {
const [absX, absY] = this._box.get_transformed_position();
// Base the static box on transformed coordinates, then normalize only the
// sliding axis so overlap checks always use the fully visible dock edge.
let [staticX, staticY] = this._box.get_transformed_position();
const width = this._box.width;
const height = this._box.height;

switch (this._position) {
case St.Side.LEFT:
staticX = this._monitor.x;
break;
case St.Side.RIGHT:
staticX = this._monitor.x + this._monitor.width - width;
break;
case St.Side.TOP:
staticY = this._monitor.y;
break;
case St.Side.BOTTOM:
staticY = this._monitor.y + this._monitor.height - height;
break;
}

this.staticBox.init_rect(
absX,
absY,
this._box.width,
this._box.height
staticX,
staticY,
width,
height
);

this._intellihide.updateTargetBox(this.staticBox);
Expand Down