commit 788c1e399dafd09a1ff62c112ee1e66304bf2dcc Author: Dipesh Acharya Date: Sun Nov 27 10:51:10 2011 +0545 removed debug file diff --git a/README b/README new file mode 100644 index 0000000..01a8d2e --- /dev/null +++ b/README @@ -0,0 +1 @@ +Gnome Shell Extension that adds an applet on the panel which reveals current CPU temperature in Degree Celsius and Fahrenheit. diff --git a/extension.js b/extension.js new file mode 100644 index 0000000..f210e8a --- /dev/null +++ b/extension.js @@ -0,0 +1,230 @@ +const St = imports.gi.St; +const Lang = imports.lang; +const PanelMenu = imports.ui.panelMenu; +const PopupMenu = imports.ui.popupMenu; +const Main = imports.ui.main; +const GLib = imports.gi.GLib; +const Util = imports.misc.util; +//gnome 3.0 +const Panel = imports.ui.panel; + +function CpuTemperature() { + this._init.apply(this, arguments); +} + +CpuTemperature.prototype = { + __proto__: PanelMenu.SystemStatusButton.prototype, + + _init: function(){ + PanelMenu.SystemStatusButton.prototype._init.call(this, 'temperature'); + + this.statusLabel = new St.Label({ text: '-' }); + // destroy all previously created children, and add our statusLabel + this.actor.get_children().forEach(function(c) { c.destroy() }); + this.actor.add_actor(this.statusLabel); + + this._update_temp(); + //update every 15 seconds + GLib.timeout_add(0, 15000, Lang.bind(this, function () { + this._update_temp(); + return true; + })); + }, + + _update_temp: function() { + let title='Error'; + let content='Click here to report!'; + let command=["firefox", "http://github.com/xtranophilist/gnome-shell-extension-cpu-temperature/issues/"]; + + let foundTemperature=false; + let cpuTemperatureInfo = ['/sys/devices/platform/coretemp.0/temp1_input', + '/sys/bus/acpi/devices/LNXTHERM\:00/thermal_zone/temp', + '/sys/devices/virtual/thermal/thermal_zone0/temp', + //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', + '/sys/bus/acpi/drivers/ATK0110/ATK0110:00/hwmon/hwmon0/temp1_input', + //hwmon for new 2.6.39, 3.0 linux kernels + '/sys/class/hwmon/hwmon0/temp1_input', + //Debian Sid/Experimental on AMD-64 + '/sys/class/hwmon/hwmon0/device/temp1_input']; + + for (let i=0;i