Skip to content

Update Sortium - #293

Merged
ricewind012 merged 6 commits into
SteamClientHomebrew:mainfrom
SalvadorCorreia:main
Nov 15, 2026
Merged

ricewind012 merged 6 commits into
SteamClientHomebrew:mainfrom
SalvadorCorreia:main

Conversation

@SalvadorCorreia

Copy link
Copy Markdown
Contributor

Sortium

Sortium v2.0.0 update. Advanced library sorting for the Steam client based on global completion metrics.
This major update migrates Sortium directly into Steam's native library UI, replacing the legacy custom overlay grid and capsules with native VDOM and prototype hooks. Users can now sort collections by HowLongToBeat and Steam Hunters metrics directly from Steam's native Sort By dropdown, group games into automatic native section shelves (e.g., Over 100 Hours, Over 90%), view metric badges on native game capsules, toggle ascending/descending order on both custom and built-in Steam sort options, and hide unwanted default Steam sort options from the settings menu.

Task Checklist

Developer

  • My plugin complies with the plugin submission guidelines
  • I am the original author or an authorized maintainer of this plugin.
  • I have complied with all license requirements for the libraries used, including providing appropriate notices where necessary.
  • My plugin is fully open source and does not depend on any external paid services, except for widely trusted and well-known platforms. Additionally, neither I nor anyone associated with me profits from any such services.
  • Generative AI was used for most of the plugin's code.

Plugin Functionality

  • I have tested the plugin on both the Stable and Beta Steam update channels.

Backend Configuration

  • I use a standard Millennium Lua backend in my plugin.
  • I use custom binaries that or rely on other FOSS projects that aren't written directly using Millennium's Lua backend.

Community Contribution

  • I have tested and left feedback on two other plugin pull requests.
  • I have added links to those feedback comments in this PR.

Testing Instructions

  • Verified by a third party on Steam Client Stable.
  • Verified by a third party on Steam Client Beta.

@github-actions github-actions Bot changed the title Update Sortium V2.0.0 Update Sortium Nov 2, 2026

@ricewind012 ricewind012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just skimmed through the frontend, so there may be another one when I get the time for it.

  • cache findModule* values so it doesn't get called on each context menu
  • use {after,before,replace}Patch, I think you can most likely avoid cloneElement this way
  • PLEASE do not patch Array.prototype.sort (and context menu stuff maybe?), there has to be a better way of doing this dude

I hope you wrote the architecture.md yourself, it's pretty cool. This has to be a crime btw wtf SalvadorCorreia/Sortium@7c10569

@SalvadorCorreia

Copy link
Copy Markdown
Contributor Author

Haha fair enough, 7c10569 was definitely a war crime. Spoofing eSortBy = 5 and hijacking GetLastPlayedSectionName inside Array.prototype.sort (plus that wall of nested ternaries in sorting.ts) was a late-night desperate attempt at making everything just work. I tried to make everything a little cleaner but it still isn't as pretty as I wish it could be.
About architecture.md, I needed an AI's help to make mermaid look good, I am not great at writing it, but still loved the process of making sure that the system made sense and that edge cases were represented!

Cleaned all of that up now:

  • Cached findModule* lookups: Moved all findModule / findModuleExport calls out of the UI components (SortiumDirectionToggle, SortiumStreamStatus) and cached them once at module scope in resolveSteamModules().
  • {replace,after}Patch instead of cloneElement: Switched SortingDropDown and the capsule wrapper over to @steambrew/client's replacePatch and afterPatch, mutating dropdownEl.props and vdom.props.children directly and cleaning up via .unpatch().
  • Killed the Array.prototype.sort & GetLastPlayedSectionName patches: Instead of globally patching Array.prototype.sort or spoofing Last Played, we now grab the childSections prop on the collection grid fiber right before it renders and group/reverse the section buckets in place (syncCollectionGridSections). Also replaced that giant ternary ladder in sorting.ts with a lookup table.

Also did a pass over the Lua backend while I was at it (added in-memory chunk caching so GetCacheBatch doesn't re-read/decode disk JSON on every batch, atomic .tmp writes for settings, and deduplicated the HTTP stream helpers).

Appreciate the review!!!
Let me know if you spot anything else when you get a chance to look through the rest!

@ricewind012 ricewind012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • in settings use the Field (with indentLevel prop), TextField and Toggle components
  • in backend there is fs.join instead of concatenating strings with "/" in it, as that may cause issues on windows probably?
  • lines 19-48 in frontend/utils/sorting.ts could probably be optimized? but IDK, not sure, it's not that important
  • the dropdown gets injected in the "Storage" Steam settings tab, not sure if that's what you'd want

@SalvadorCorreia

Copy link
Copy Markdown
Contributor Author

Just pushed fixes for all four of those!

  • Storage settings dropdown: Good catch, I hadn't noticed SortingDropDown was shared with the Storage settings page. I added a check in transformSortingDropdownVdom so it only injects Sortium's options and controls when the dropdown is actually paired with a library collection grid fiber (childSections), leaving Storage untouched.
  • Settings components (Field, indentLevel, TextField, Toggle): Swapped ToggleField, the raw <input type="number">, and the raw <button> tags over to Field (with indentLevel={1} on the child metrics), Toggle, TextField, and DialogButton. I did keep a few compact style overrides and the left tree border on the metric list since TextField defaults to 195px wide and overflows Millennium's narrow 296px sidebar out of the box, and non-classic Field rows turn into full-width grey blocks without the guide line.
  • fs.join in the backend: Switched cache.lua and settings.lua over to require("fs") and fs.join instead of concatenating "/" by hand.
  • filterNativeSortOptions in sorting.ts: Cleaned that up too so it pre-indexes the Steam default directions in a Map and builds the combined array in a single pass instead of chaining .filter().map() and .find().

Thanks again for catching the Storage tab issue! Let me know if anything else looks off.

@ricewind012

Copy link
Copy Markdown
Member

I cannot test this right now but the settings now have your own styles. Why and what does it look like ?

@SalvadorCorreia

Copy link
Copy Markdown
Contributor Author

Hello!
I am sorry for adding custom styles to the settings without properly justifying them first.
I first tried to strictly follow your instructions on how to rewrite the settings UI. However, after compiling and testing it in the sidebar, a few layout issues popped up. If strict unification with no custom styles should take priority, please let me know.

This was my approach to keep the settings looking as native as possible while still using Field (indentLevel), Toggle, TextField, and DialogButton. This is what it looks like now:
image
image
image

My main concerns with the unstyled version were:

  1. indentLevel={1} only added internal left padding inside the same full-width grey boxes, so it wasn't obvious that the metrics under each stream were sub-items of that stream.
  2. Inside the narrow sidebar, <TextField> defaulted to ~195px wide and overflowed past the right edge of the Field card (squishing the label text into a very narrow column), and <DialogButton> had 0px horizontal padding out of the box. It also felt significantly too big for the pieces of text that could only be up to 3 characters realistically speaking.

If this isn't acceptable tell me and I will follow your instructions.

@ricewind012

Copy link
Copy Markdown
Member

Give the buttons only a paddingInline: "10px" styling, remove the TextField styling, and use inlineWrap="shift-children-below" or childrenLayout="below" for Field, idk which one works. You may be right about indentLevel, it's barely used in Steam itself either way, so whatever. Themes will have to style specifically your thing, though, which could be avoided if you really care

@SalvadorCorreia

Copy link
Copy Markdown
Contributor Author

Got it, makes total sense to keep things clean for custom themes!

I stripped out all the custom styles and wrapper divs, switched the TextField rows over to childrenLayout="below" / inlineWrap="shift-children-below", kept only paddingInline: "10px" on the DialogButtons, and went back to plain indentLevel={1} on the metric Fields.

I really like how the TextFields and buttons look now with childrenLayout="below"! To be completely honest, I still don't love how the streams and metrics section looks with just indentLevel={1} and would personally prefer to revert only that streams indentation wrapper if you're okay with it. That said, I already pushed the pure native version below, so if you think keeping it this way is the best option, I am happy to accept it as is:

image image

Thanks again for the tip on childrenLayout="below", just let me know which way you prefer for the streams section!

@ricewind012 ricewind012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can revert the field shit if you want, it's fine. Other than that lgtm, just needs a tester reporting results here, or I can do it later if you won't get one.

@SalvadorCorreia

Copy link
Copy Markdown
Contributor Author

Thank you!
I reverted the field shift and for me we can close the PR whenever you see feat.
I don't particularly have anyone who I could ask to test, but If needed I can get someone.

One last time thank you for all the feedback and understanding :D

@ricewind012

Copy link
Copy Markdown
Member

ok, I already used it anyway

@ricewind012
ricewind012 merged commit 504aac6 into SteamClientHomebrew:main Nov 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants