hyprwm / hyprsysteminfo

A tiny qt6/qml application to display information about the running system
BSD 3-Clause "New" or "Revised" License
57 stars 6 forks source link

CPU information not obtained in languages other than English #9

Closed jprostko closed 1 month ago

jprostko commented 1 month ago

Hello,

I built hyprsysteminfo at commit 9c5f02ff682a3bbcdbe5acdda6e404cd3c013939 (version 0.1.1) on Hyprland 0.44.1.

I have my system configured with LANG=sv_SE.UTF-8, and so when the code in SystemInfo.cpp looks at lscpu for "odel name", it will never find a match, since my system uses Modellnamn. As a result, hyprsysteminfo states "missing depenency: lscpu" on the CPU line. Obviously I have lscpu installed, but it simply doesn't contain a Model name line like a system set to LANG=en_US.UTF-8 would, for example.

Naturally, terms like Architecture are different too, as it is Arkitektur on my system, for instance. The CPU(s) field is also different since it is CPU(er). The CPU max MHz field matches the English counterpart, except for the fact that the output has a comma instead of a period after the whole number.

Perhaps it would make more sense to interrogate /proc/cpuinfo and entries like /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq directly since those should always have English or numerical output? That would also remove the need for one having lscpu installed, although admittedly I think pretty much everyone would have that on their system.

Granted, it is more work to get at the information this way, so I understand if you just leave this as being supported only in English locales for the time being.

Below is some output to show you what I am talking about.

~> lscpu | grep -E 'Arkitektur:|^CPU\(er\):|Modellnamn:|CPU max MHz:'
Arkitektur:                           x86_64
CPU(er):                              16
Modellnamn:                           AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
CPU max MHz:                          5263,0000

~> grep 'model name' /proc/cpuinfo | uniq
model name      : AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
~> cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
5263000
vaxerski commented 1 month ago

try now

jprostko commented 1 month ago

Thanks for the quick fix. I will close out this issue.

Now the output correctly shows:

CPU: AMD Ryzen 9 7940HS w/Radeon 780M Graphics at 16x5.3 GHz (x86_64)

Your fix was way more straightforward than my suggestion, and did the job nicely.