Skip to content

[IJPL-43620] [platform] Custom Ordering for Status Bar Items#3447

Open
jakub-bochenski wants to merge 2 commits intoJetBrains:masterfrom
jakub-bochenski:IJPL-43620
Open

[IJPL-43620] [platform] Custom Ordering for Status Bar Items#3447
jakub-bochenski wants to merge 2 commits intoJetBrains:masterfrom
jakub-bochenski:IJPL-43620

Conversation

@jakub-bochenski
Copy link

@jakub-bochenski jakub-bochenski commented Mar 5, 2026

At first I tried implementing user ordering using LoadingOrder:

  • currently the order of widgets in status bar is defined by plugins, using anchors like after LineSeparator
  • we want to allow the user to override this order
  • naive approach fails because, you might have two widgets A and B, typically B is after A but the user rearranges them, it will cause an exception if another widget has anchor like after A, before B
  • trying to override all the anchors and "linearize" them (sequential after anchors as per desired visual order), only helps assuming no new widgets are added,
    • even considering all currently available widgets (active and inactive) this will still fail if a new plugin that contributes status bar widgets is installed later
  • since widgets can be added and removed, there is a need for an algorithm to reconcile the order desired by the user and the default order defined by the plugins
  • there is no obvious, simple approach; this is a partial-order merge problem, this would require extending the DFSTBuilder.java class to support weighted edges

So I implemented a different approach.
User moves are recorded separately and applied after the LoadingOrder sorting is applied (WidgetSorter)

I didn't find any tests covering the status bar.
I've added a unit test to verify that the widgets are sorted correctly.

I've also fixed com.intellij.openapi.wm.impl.status.IdeStatusBarImplKt#wrap method to set WIDGET_IT.
Missing WIDGET_IT was preventing DnD from working.

jbochenski added 2 commits March 5, 2026 14:59
At first I tried implementing user ordering using LoadingOrder:
- currently the order of widgets in status bar is defined by plugins, using anchors like after LineSeparator
- we want to allow the user to override this order
- naive approach fails because, you might have two widgets A and B, typically B is after A but the user rearranges them, it will cause an exception if another widget has anchor like after A, before B
- trying to override all the anchors and "linearize" them (sequential after anchors as per desired visual order), only helps assuming no new widgets are added,
   - even considering all currently available widgets (active and inactive) this will still fail if a new plugin that contributes status bar widgets is installed later
- since widgets can be added and removed, there is a need for an algorithm to reconcile the order desired by the user and the default order defined by the plugins
- there is no obvious, simple approach; this is a partial-order merge problem, this would require extending the DFSTBuilder.java class to support weighted edges

So I implemented a different approach.
User moves are recorded separately and applied after the LoadingOrder sorting is applied (`WidgetSorter`)

I didn't find any tests covering the status bar.
I've added a unit test to verify that the widgets are sorted correctly.

I've also fixed `com.intellij.openapi.wm.impl.status.IdeStatusBarImplKt#wrap`
method to set WIDGET_IT.
Missing WIDGET_IT was preventing DnD from working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants