Skip to content

Commit

Permalink
dash: Take in account the number of removed favorites to add the sepa…
Browse files Browse the repository at this point in the history
…rator

When a favorite is removed the separator should be shifted accordingly,
so use the old separator position as reference
  • Loading branch information
3v1n0 committed Jun 12, 2023
1 parent bd4e3fb commit 365aeaa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ var DockDash = GObject.registerClass({
}

// Temporary remove the separator so that we don't compute to position icons
const oldSeparatorPos = this._box.get_children().indexOf(this._separator);
if (this._separator)
this._box.remove_child(this._separator);

Expand Down Expand Up @@ -939,6 +940,9 @@ var DockDash = GObject.registerClass({
let pos = nFavorites + this._animatingPlaceholdersCount;
if (this._dragPlaceholder)
pos++;
const removedFavorites = removedActors.filter(a =>
children.indexOf(a) < oldSeparatorPos);
pos += removedFavorites.length;
this._box.insert_child_at_index(this._separator, pos);
} else if (this._separator) {
this._separator.destroy();
Expand Down

0 comments on commit 365aeaa

Please sign in to comment.