mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-15 00:44:22 +09:00
Removed reading the temperature data from sysfs. lm_sensors handles this better.
This commit is contained in:
@@ -6,7 +6,6 @@ CPU fan RPM in GNOME Shell.
|
|||||||
|
|
||||||
The extension uses [sensors] from lm_sensors package (lm-sensors for Debian systems)
|
The extension uses [sensors] from lm_sensors package (lm-sensors for Debian systems)
|
||||||
to read temperature for different CPU cores and adapters, voltage data and fan speed.
|
to read temperature for different CPU cores and adapters, voltage data and fan speed.
|
||||||
If lm_sensors is not installed, temperature is read from [system files].
|
|
||||||
|
|
||||||
Optionally, this extension uses [hddtemp] to read hard drive temperature data.
|
Optionally, this extension uses [hddtemp] to read hard drive temperature data.
|
||||||
|
|
||||||
@@ -79,6 +78,5 @@ Authors : [authors]
|
|||||||
[sensors]: http://www.lm-sensors.org/
|
[sensors]: http://www.lm-sensors.org/
|
||||||
[hddtemp]: https://savannah.nongnu.org/projects/hddtemp/
|
[hddtemp]: https://savannah.nongnu.org/projects/hddtemp/
|
||||||
[GNOME extensions]: https://extensions.gnome.org/extension/82/cpu-temperature-indicator/
|
[GNOME extensions]: https://extensions.gnome.org/extension/82/cpu-temperature-indicator/
|
||||||
[system files]: https://github.com/xtranophilist/gnome-shell-extension-sensors/blob/master/extension.js#L234
|
|
||||||
[authors]: https://github.com/xtranophilist/gnome-shell-extension-sensors/graphs/contributors
|
[authors]: https://github.com/xtranophilist/gnome-shell-extension-sensors/graphs/contributors
|
||||||
[screenshot]: https://raw.github.com/wiki/xtranophilist/gnome-shell-extension-sensors/gnome-shell-extension-sensors.png
|
[screenshot]: https://raw.github.com/wiki/xtranophilist/gnome-shell-extension-sensors/gnome-shell-extension-sensors.png
|
||||||
|
|||||||
59
extension.js
59
extension.js
@@ -56,12 +56,11 @@ Sensors.prototype = {
|
|||||||
this.hddtempPath = this._detectHDDTemp();
|
this.hddtempPath = this._detectHDDTemp();
|
||||||
}
|
}
|
||||||
this.command=["xdg-open", "http://github.com/xtranophilist/gnome-shell-extension-sensors/issues/"];
|
this.command=["xdg-open", "http://github.com/xtranophilist/gnome-shell-extension-sensors/issues/"];
|
||||||
|
this.title = 'Error';
|
||||||
if(this.sensorsPath){
|
if(this.sensorsPath){
|
||||||
this.title='Error';
|
|
||||||
this.content='Run sensors-detect as root. If it doesn\'t help, click here to report with your sensors output!';
|
this.content='Run sensors-detect as root. If it doesn\'t help, click here to report with your sensors output!';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.title='Warning';
|
|
||||||
this.content='Please install lm_sensors. If it doesn\'t help, click here to report with your sensors output!';
|
this.content='Please install lm_sensors. If it doesn\'t help, click here to report with your sensors output!';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,15 +165,6 @@ Sensors.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if we don't have the temperature yet, use some known files
|
|
||||||
if(tempItems.length == 0){
|
|
||||||
tempInfo = this._findTemperatureFromFiles();
|
|
||||||
if(tempInfo.temp){
|
|
||||||
this.title=this._formatTemp(tempInfo.temp);
|
|
||||||
tempItems.push({label: 'Current Temperature', temp: tempInfo.temp});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hddtempPath){
|
if (this.hddtempPath){
|
||||||
let hddtemp_output = GLib.spawn_command_line_sync(this.hddtempPath);//get the output of the hddtemp command
|
let hddtemp_output = GLib.spawn_command_line_sync(this.hddtempPath);//get the output of the hddtemp command
|
||||||
if(hddtemp_output[0]) tempInfo = this._findTemperatureFromHDDTempOutput(hddtemp_output[1].toString(), (this.hddtempPath.substring(0,2) != 'nc') ? ': ' : '|');//get temperature from hddtemp
|
if(hddtemp_output[0]) tempInfo = this._findTemperatureFromHDDTempOutput(hddtemp_output[1].toString(), (this.hddtempPath.substring(0,2) != 'nc') ? ': ' : '|');//get temperature from hddtemp
|
||||||
@@ -194,7 +184,7 @@ Sensors.prototype = {
|
|||||||
c.destroy()
|
c.destroy()
|
||||||
});
|
});
|
||||||
let section = new PopupMenu.PopupMenuSection("Temperature");
|
let section = new PopupMenu.PopupMenuSection("Temperature");
|
||||||
if (tempItems.length > 0 || fanItems.length > 0){
|
if (tempItems.length > 0){
|
||||||
let item;
|
let item;
|
||||||
for each (let temp in tempItems){
|
for each (let temp in tempItems){
|
||||||
item = new SensorsItem(temp['label'], this._formatTemp(temp['temp']));
|
item = new SensorsItem(temp['label'], this._formatTemp(temp['temp']));
|
||||||
@@ -242,51 +232,6 @@ Sensors.prototype = {
|
|||||||
this.menu.addMenuItem(section);
|
this.menu.addMenuItem(section);
|
||||||
},
|
},
|
||||||
|
|
||||||
_findTemperatureFromFiles: function(){
|
|
||||||
let info = new Array();
|
|
||||||
let temp_files = [
|
|
||||||
//hwmon for new 2.6.39, 3.x linux kernels
|
|
||||||
'/sys/class/hwmon/hwmon0/temp1_input',
|
|
||||||
'/sys/devices/platform/coretemp.0/temp1_input',
|
|
||||||
'/sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp',
|
|
||||||
'/sys/devices/virtual/thermal/thermal_zone0/temp',
|
|
||||||
'/sys/bus/acpi/drivers/ATK0110/ATK0110:00/hwmon/hwmon0/temp1_input',
|
|
||||||
//old kernels with proc fs
|
|
||||||
'/proc/acpi/thermal_zone/THM0/temperature',
|
|
||||||
'/proc/acpi/thermal_zone/THRM/temperature',
|
|
||||||
'/proc/acpi/thermal_zone/THR0/temperature',
|
|
||||||
'/proc/acpi/thermal_zone/TZ0/temperature',
|
|
||||||
//Debian Sid/Experimental on AMD-64
|
|
||||||
'/sys/class/hwmon/hwmon0/device/temp1_input'];
|
|
||||||
for each (let file in temp_files){
|
|
||||||
if(GLib.file_test(file,1<<4)){
|
|
||||||
//let f = Gio.file_new_for_path(file);
|
|
||||||
//f.read_async(0, null, function(source, result) {debug(source.read_finish(result).read())});
|
|
||||||
|
|
||||||
let temperature = GLib.file_get_contents(file);
|
|
||||||
if(temperature[0]) {
|
|
||||||
info['temp']= parseInt(temperature[1])/1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let crit_files = ['/sys/devices/platform/coretemp.0/temp1_crit',
|
|
||||||
'/sys/bus/acpi/drivers/ATK0110/ATK0110:00/hwmon/hwmon0/temp1_crit',
|
|
||||||
//hwmon for new 2.6.39, 3.0 linux kernels
|
|
||||||
'/sys/class/hwmon/hwmon0/temp1_crit',
|
|
||||||
//Debian Sid/Experimental on AMD-64
|
|
||||||
'/sys/class/hwmon/hwmon0/device/temp1_crit'];
|
|
||||||
for each (let file in crit_files){
|
|
||||||
if(GLib.file_test(file,1<<4)){
|
|
||||||
let temperature = GLib.file_get_contents(file);
|
|
||||||
if(temperature[0]) {
|
|
||||||
info['crit']= parseInt(temperature[1])/1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
},
|
|
||||||
|
|
||||||
_parseSensorsOutput: function(txt,parser){
|
_parseSensorsOutput: function(txt,parser){
|
||||||
let sensors_output=txt.split("\n");
|
let sensors_output=txt.split("\n");
|
||||||
let feature_label=undefined;
|
let feature_label=undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user