mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-14 00:14:14 +09:00
Add NVIDIA card label detection
This commit is contained in:
@@ -11,6 +11,17 @@ const NvidiaUtil = new Lang.Class({
|
||||
detect: function(){
|
||||
let path = GLib.find_program_in_path('nvidia-settings');
|
||||
this._argv = path ? [path, '-q', 'gpucoretemp', '-t'] : null;
|
||||
this._label = 'NVIDIA';
|
||||
if(this._argv){
|
||||
// [0] ushakov-pc:0[gpu:0] (GeForce GTX 770)
|
||||
for each(let line in GLib.spawn_command_line_sync(path + " -q gpus")){
|
||||
let match = /.*\[gpu:[\d]\].*\(([\w\d\ ]+)\).*/.exec(line);
|
||||
if(match){
|
||||
this._label = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this._argv != null;
|
||||
},
|
||||
|
||||
@@ -20,7 +31,7 @@ const NvidiaUtil = new Lang.Class({
|
||||
for each(let line in this._output) {
|
||||
if(!line)
|
||||
continue;
|
||||
return [{label: 'Nvidia', temp: parseFloat(line)}];
|
||||
return [{label: this._label, temp: parseFloat(line)}];
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user