Skip to content

Commit

Permalink
sort plugin id on plugin toggle screen
Browse files Browse the repository at this point in the history
(cherry picked from commit 38adb5f)
  • Loading branch information
deirn committed Jun 17, 2024
1 parent 51ffc4d commit 6b9fde4
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
import mcp.mobius.waila.api.IWailaConfig;
import mcp.mobius.waila.api.WailaConstants;
import mcp.mobius.waila.buildconst.Tl;
import mcp.mobius.waila.gui.widget.ConfigListWidget;
import mcp.mobius.waila.gui.widget.value.BooleanValue;
Expand Down Expand Up @@ -50,7 +51,17 @@ public ConfigListWidget getOptions() {

});

for (var plugin : PluginInfo.getAll()) {
var sorted = PluginInfo.getAll().stream().sorted((a, b) -> {
var aId = a.getPluginId();
var bId = b.getPluginId();

var aIsWaila = aId.getNamespace().equals(WailaConstants.NAMESPACE);
var bIsWaila = bId.getNamespace().equals(WailaConstants.NAMESPACE);
if (aIsWaila == bIsWaila) return aId.compareTo(bId);
return aIsWaila ? +1 : -1;
}).toList();

for (var plugin : sorted) {
var impl = (PluginInfo) plugin;
var id = plugin.getPluginId();
var enabled = plugin.isEnabled();
Expand Down

0 comments on commit 6b9fde4

Please sign in to comment.