mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-15 00:44:22 +09:00
Add NVIDIA card temperature
This commit is contained in:
@@ -12,6 +12,7 @@ const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Convenience = Me.imports.convenience;
|
||||
const UDisks2 = Me.imports.udisks2;
|
||||
const AticonfigUtil = Me.imports.aticonfigUtil;
|
||||
const NvidiaUtil = Me.imports.nvidiaUtil;
|
||||
const HddtempUtil = Me.imports.hddtempUtil;
|
||||
const SensorsUtil = Me.imports.sensorsUtil;
|
||||
const FreonItem = Me.imports.freonItem;
|
||||
@@ -31,7 +32,8 @@ const FreonMenuButton = new Lang.Class({
|
||||
this._utils = {
|
||||
aticonfig: new AticonfigUtil.AticonfigUtil(),
|
||||
hddtemp: new HddtempUtil.HddtempUtil(),
|
||||
sensors: new SensorsUtil.SensorsUtil()
|
||||
sensors: new SensorsUtil.SensorsUtil(),
|
||||
nvidia: new NvidiaUtil.NvidiaUtil()
|
||||
};
|
||||
this._udisks2 = new UDisks2.UDisks2();
|
||||
|
||||
@@ -58,6 +60,8 @@ const FreonMenuButton = new Lang.Class({
|
||||
this._initDriveUtility();
|
||||
if(this._settings.get_boolean('show-aticonfig-temp'))
|
||||
this._utils.aticonfig.detect();
|
||||
if(this._settings.get_boolean('show-nvidia-temp'))
|
||||
this._utils.nvidia.detect();
|
||||
|
||||
this._settingChangedSignals = [];
|
||||
this._addSettingChangedSignal('update-time', Lang.bind(this, this._updateTimeChanged));
|
||||
@@ -68,6 +72,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
this._addSettingChangedSignal('show-fan-rpm', Lang.bind(this, this._querySensors));
|
||||
this._addSettingChangedSignal('show-voltage', Lang.bind(this, this._querySensors));
|
||||
this._addSettingChangedSignal('show-aticonfig-temp', Lang.bind(this, this._showAtiConfigChanged));
|
||||
this._addSettingChangedSignal('show-nvidia-temp', Lang.bind(this, this._showNvidiaChanged));
|
||||
this._addSettingChangedSignal('drive-utility', Lang.bind(this, this._driveUtilityChanged));
|
||||
this._addSettingChangedSignal('position-in-panel', Lang.bind(this, this._positionInPanelChanged));
|
||||
|
||||
@@ -142,6 +147,14 @@ const FreonMenuButton = new Lang.Class({
|
||||
this._querySensors();
|
||||
},
|
||||
|
||||
_showNvidiaChanged : function(){
|
||||
if(this._settings.get_boolean('show-nvidia-temp'))
|
||||
this._utils.nvidia.detect();
|
||||
else
|
||||
this._utils.nvidia.destroy();
|
||||
this._querySensors();
|
||||
},
|
||||
|
||||
_addTimer : function(){
|
||||
this._timeoutId = Mainloop.timeout_add_seconds(this._settings.get_int('update-time'), Lang.bind(this, function (){
|
||||
this._querySensors();
|
||||
@@ -176,7 +189,9 @@ const FreonMenuButton = new Lang.Class({
|
||||
_updateDisplay: function(){
|
||||
let gpuTempInfo = [];
|
||||
if (this._utils.aticonfig.available)
|
||||
gpuTempInfo = this._utils.aticonfig.temp;
|
||||
gpuTempInfo = gpuTempInfo.concat(this._utils.aticonfig.temp);
|
||||
if (this._utils.nvidia.available)
|
||||
gpuTempInfo = gpuTempInfo.concat(this._utils.nvidia.temp);
|
||||
|
||||
let sensorsTempInfo = this._utils.sensors.temp;
|
||||
|
||||
|
||||
29
freon@UshakovVasilii_Github.yahoo.com/nvidiaUtil.js
Normal file
29
freon@UshakovVasilii_Github.yahoo.com/nvidiaUtil.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const Lang = imports.lang;
|
||||
const GLib = imports.gi.GLib;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
||||
|
||||
const NvidiaUtil = new Lang.Class({
|
||||
Name: 'NvidiaUtil',
|
||||
Extends: CommandLineUtil.CommandLineUtil,
|
||||
|
||||
detect: function(){
|
||||
let path = GLib.find_program_in_path('nvidia-settings');
|
||||
this._argv = path ? [path, '-q', 'gpucoretemp', '-t'] : null;
|
||||
return this._argv != null;
|
||||
},
|
||||
|
||||
get temp() {
|
||||
if(!this._output)
|
||||
return [];
|
||||
for each(let line in this._output) {
|
||||
if(!line)
|
||||
continue;
|
||||
return [{label: 'Nvidia', temp: parseFloat(line)}];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
});
|
||||
@@ -70,7 +70,11 @@ const FreonPrefsWidget = new GObject.Class({
|
||||
|
||||
this._addSwitch({key : 'show-aticonfig-temp', y : i++, x : 2,
|
||||
label : _('Use Catalyst'),
|
||||
help : _('Show AMD video card temperature, use aticonfig from Catalyst driver.')});
|
||||
help : _('Show AMD video card temperature, use aticonfig from Catalyst driver')});
|
||||
|
||||
this._addSwitch({key : 'show-nvidia-temp', y : i, x : 0,
|
||||
label : _('Use NVIDIA'),
|
||||
help : _('Show NVIDIA video card temperature, use nvidia-settings util')});
|
||||
},
|
||||
|
||||
_addSwitch : function(params){
|
||||
|
||||
Binary file not shown.
@@ -51,6 +51,12 @@
|
||||
<description>Show AMD card temperature, use aticonfig from Catalyst driver</description>
|
||||
</key>
|
||||
|
||||
<key type="b" name="show-nvidia-temp">
|
||||
<default>false</default>
|
||||
<summary>Show NVIDIA Card Temperature</summary>
|
||||
<description>Show NVIDIA card temperature, use nvidia-settings util</description>
|
||||
</key>
|
||||
|
||||
<key type="s" name="drive-utility">
|
||||
<default>'udisks2'</default>
|
||||
<summary>Utility for detect HDD/SSD temperature</summary>
|
||||
|
||||
Reference in New Issue
Block a user