mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-14 00:14:14 +09:00
fix same name problem
This commit is contained in:
@@ -234,6 +234,25 @@ const FreonMenuButton = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_fixNames: function(sensors){
|
||||
let names = [];
|
||||
for each (let s in sensors){
|
||||
if(s.type == 'separator' ||
|
||||
s.type == 'temperature-group' ||
|
||||
s.type == 'temperature-average' ||
|
||||
s.type == 'temperature-maximum')
|
||||
continue;
|
||||
let name = s.label;
|
||||
let i = 1;
|
||||
while(names.indexOf(name) >= 0){
|
||||
name = s.label + '-' + i++;
|
||||
}
|
||||
s.displayName = s.label;
|
||||
s.label = name;
|
||||
names.push(name);
|
||||
}
|
||||
},
|
||||
|
||||
_updateDisplay: function(){
|
||||
let gpuTempInfo = this._utils.sensors.gpu;
|
||||
|
||||
@@ -330,6 +349,8 @@ const FreonMenuButton = new Lang.Class({
|
||||
voltage.volt)});
|
||||
}
|
||||
|
||||
this._fixNames(sensors);
|
||||
|
||||
for each (let s in sensors)
|
||||
if(s.type != 'separator') {
|
||||
let l = this._hotLabels[s.label];
|
||||
|
||||
Reference in New Issue
Block a user