There is a mod for Minecraft called 'Inventory Tweaks' I love to use when I'm playing the game. No matter how messed up my inventory gets a key press will sort it all out. Very useful when trying to recover your stuff after a monster kills you. What makes it so great is you can customize it most anyway you like. I would like to see something similar for Stardew Valley. I know there is a sort button on the inventory screen but it would be better if the sort order could be customized.
The game has a built in inventory sorter, shouldn't be too hard to see how it handles this and make your custom inventory sorter.
I checked it at night... it CAN be done, but ins't easy, if I make this, I will end making a full inventory mod, not just changing the in-game sorter, because THAT one, can't be changed. The in-game sorter is very hard-coded (it checks if you clicked with the mouse in a certain place, you can't intercept that easily), and it is a bad sorter too, what it do is call C# "Sort()" function, that I believe just sort by sprite numbers :/
I imagined one would look at the code and see how it works, then create their own sorting algorithm based on either priority of item types or specific items themselves (possibly allowing the saving of presets and attempting to conform to them), and draw their own extra sort button when the inventory menu was up.
It works by having the sort button there, and the INVENTORY detect a click on it (not the button!), and when you click the button, it runs this function that is literally 2 lines: Code: public static void organizeItemsInList(List<Item> items) { items.Sort(); items.Reverse(); }