Bug 427746 - shortcut names with numbers are not naturally sorted
Summary: shortcut names with numbers are not naturally sorted
Status: RESOLVED NOT A BUG
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keys (show other bugs)
Version: 5.19.90
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Jansen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-15 10:11 UTC by Adam Fontenot
Modified: 2020-10-17 05:06 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot of the problem (103.29 KB, image/png)
2020-10-16 12:37 UTC, Adam Fontenot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Fontenot 2020-10-15 10:11:17 UTC
DESCRIPTION

Open a class of shortcuts like KWin. This contains many shortcuts, for example, "Switch to Desktop 1", "Switch to Desktop 2", and so on. Some of these have numbers that go beyond 10, in this case they are sorted lexicographically, not naturally.

Switch to Desktop 1
Switch to Desktop 10
Switch to Desktop 12

and so on.

I think it would definitely be better to sort these naturally (by which I mean "2" sorts before "10"), since they represent numbers.

SOFTWARE/OS VERSIONS
Linux: Arch Linux 5.9.0-arch1-1
KDE Plasma Version: 5.20.0 (no option for this in the version box yet)
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1
Comment 1 David Redondo 2020-10-16 07:03:34 UTC
Which locale are you using? Works for me and should be fixed since this commit: https://invent.kde.org/plasma/plasma-desktop/-/commit/847d9216e0c1165f98b7a6d1f49fd52864c5abb2
Comment 2 Adam Fontenot 2020-10-16 12:37:40 UTC
Created attachment 132407 [details]
screenshot of the problem

Here's all the locale information I can find, along with a screenshot of the issue.

Let me know if you're looking for something specific I didn't mention here.

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=C
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Plasma Locales:
Regional Settings > Language > American English
Regional Settings > Formats > United States - American English (no custom settings)
Regional Settings > Spell Check > American English
Comment 3 Christoph Feck 2020-10-17 03:05:01 UTC
> LC_COLLATE=C

C locale sorts strictly by ASCII order.
Comment 4 Adam Fontenot 2020-10-17 05:06:38 UTC
Thanks - it looks like LC_COLLATE=en_US seems to fix the problem without breaking too many other things.

By the way, the Arch wiki recommends LC_COLLATE=C for better results in sorting things with terminal commands like ls. For example, "en_US.utf8" will not sort dotfiles before other files ("en_US" does), which is probably unexpected. I believe LC_COLLATE=C is or was the default on new Arch Linux installations.

Also, I'm not sure if it makes sense to respect the locale for something like this. It seems like a user might reasonably enough want to use one setting in the terminal, and another setting in a GUI program like systemsettings. (Is there ever a reason a user would *not* want to sort the shortcut names naturally?) There's no option in systemsettings to change the COLLATE locale, so it's unexpected behavior (for me anyway) that it affects the sort order. It didn't occur to me as a possibility.