trigg / Discover

Yet another discord overlay for linux
GNU General Public License v3.0
649 stars 28 forks source link

Add discord-like sort option #273

Closed NicolaSmaniotto closed 2 years ago

NicolaSmaniotto commented 2 years ago

The fact that the order of the users in the overlay does not match the one inside Discord has bugged me for some time now.

Here is an example of what I mean.

Three users: alice#1111, Bob#3333 and charlie#2222

My change (ignoring case) seems to be enough to replicate how Discord sorts the users.

Please note that I'm not at all familiar with glade, so I just changed the files that seemed to make sense. It works for me, but I suggest you check very carefully that everything is in order. I'm happy to make further edits if necessary.

trigg commented 2 years ago

Interesting, I hadn't realised that alphabetical sort wasn't humanly alphabetical.

I'd argue we should do 'Discord-like' as a fix for alphabetical as almost no-one would expect Bob, alice, charlie in alphabetical sort

trigg commented 2 years ago

Looking at it this is a deeper issue than it seems, as current and proposed solutions are prone to fail the moment the user is using a different locale with different sorting rules.

Looking like we need in_list.sort(key=lambda x: locale.strxfrm(x['friendlyname'])) to allow sorting to be done by users locale.

Mind if I close this PR and work on a less-latin based answer?