Skip to content

Commit

Permalink
Sort sensor names with the numeric option set (#265)
Browse files Browse the repository at this point in the history
This allows "Core 3" to sort before "Core 20", instead of the
other way around without the numeric option set.
  • Loading branch information
damz authored Aug 6, 2023
1 parent ecabca0 commit 54ae50c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions freon@UshakovVasilii_Github.yahoo.com/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,12 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
if (this._settings.get_boolean('show-temperature'))
driveTempInfo = driveTempInfo.concat(this._utils.nvmecli.temp);

sensorsTempInfo.sort(function(a,b) { return a.label.localeCompare(b.label) });
driveTempInfo.sort(function(a,b) { return a.label.localeCompare(b.label) });
fanInfo.sort(function(a,b) { return a.label.localeCompare(b.label) });
voltageInfo.sort(function(a,b) { return a.label.localeCompare(b.label) });
powerInfo.sort(function(a,b) { return a.label.localeCompare(b.label) });
const comparator = (a, b) => a.label.localeCompare(b.label, undefined, {numeric: true})
sensorsTempInfo.sort(comparator);
driveTempInfo.sort(comparator);
fanInfo.sort(comparator);
voltageInfo.sort(comparator);
powerInfo.sort(comparator);

let tempInfo = gpuTempInfo.concat(sensorsTempInfo).concat(driveTempInfo);

Expand Down

0 comments on commit 54ae50c

Please sign in to comment.