mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-14 16:34:21 +09:00
fix gjs errors #98
This commit is contained in:
@@ -4,7 +4,7 @@ const GLib = imports.gi.GLib;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
||||
|
||||
const AticonfigUtil = new Lang.Class({
|
||||
var AticonfigUtil = new Lang.Class({
|
||||
Name: 'AticonfigUtil',
|
||||
Extends: CommandLineUtil.CommandLineUtil,
|
||||
|
||||
@@ -23,7 +23,7 @@ const AticonfigUtil = new Lang.Class({
|
||||
return [];
|
||||
let label = null;
|
||||
let temp = null;
|
||||
for each(let line in this._output) {
|
||||
for (let line of this._output) {
|
||||
if(!line)
|
||||
continue;
|
||||
let r;
|
||||
|
||||
@@ -5,7 +5,7 @@ const Gio = imports.gi.Gio;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
||||
|
||||
const BumblebeeNvidiaUtil = new Lang.Class({
|
||||
var BumblebeeNvidiaUtil = new Lang.Class({
|
||||
Name: 'BumblebeeNvidiaUtil',
|
||||
Extends: CommandLineUtil.CommandLineUtil,
|
||||
|
||||
@@ -49,7 +49,7 @@ const BumblebeeNvidiaUtil = new Lang.Class({
|
||||
_detectLabel: function() {
|
||||
// optirun nvidia-smi -L
|
||||
// GPU 0: GeForce GT 525M (UUID: GPU-...)
|
||||
for each(let line in GLib.spawn_command_line_sync(this._path + " nvidia-smi -L")){
|
||||
for (let line of GLib.spawn_command_line_sync(this._path + " nvidia-smi -L")){
|
||||
let match = /.*GPU [\d]:([\w\d\ ]+).*/.exec(line);
|
||||
if(match){
|
||||
this._label = match[1];
|
||||
@@ -82,7 +82,7 @@ const BumblebeeNvidiaUtil = new Lang.Class({
|
||||
let label = this._label ? this._label : _('Bumblebee + NVIDIA');
|
||||
if(this._active && this._output){
|
||||
// GPU Current Temp : 37 C
|
||||
for each(let line in this._output) {
|
||||
for (let line of this._output) {
|
||||
if(!line)
|
||||
continue;
|
||||
let r;
|
||||
|
||||
@@ -2,7 +2,7 @@ const Lang = imports.lang;
|
||||
const GLib = imports.gi.GLib;
|
||||
const Gio = imports.gi.Gio;
|
||||
|
||||
const CommandLineUtil = new Lang.Class({
|
||||
var CommandLineUtil = new Lang.Class({
|
||||
Name: 'CommandLineUtil',
|
||||
|
||||
_init: function(){
|
||||
|
||||
@@ -21,7 +21,7 @@ const FreonItem = Me.imports.freonItem;
|
||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||
const _ = Gettext.gettext;
|
||||
|
||||
const FreonMenuButton = new Lang.Class({
|
||||
var FreonMenuButton = new Lang.Class({
|
||||
Name: 'FreonMenuButton',
|
||||
Extends: PanelMenu.Button,
|
||||
|
||||
@@ -54,7 +54,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
this._hotIcons = {};
|
||||
let hotSensors = this._settings.get_strv('hot-sensors');
|
||||
let showIcon = this._settings.get_boolean('show-icon-on-panel');
|
||||
for each (let s in hotSensors){
|
||||
for (let s of hotSensors){
|
||||
this._createHotItem(s, showIcon);
|
||||
}
|
||||
|
||||
@@ -225,13 +225,13 @@ const FreonMenuButton = new Lang.Class({
|
||||
Mainloop.source_remove(this._timeoutId);
|
||||
Mainloop.source_remove(this._updateUITimeoutId);
|
||||
|
||||
for each (let signal in this._settingChangedSignals){
|
||||
for (let signal of this._settingChangedSignals){
|
||||
this._settings.disconnect(signal);
|
||||
};
|
||||
},
|
||||
|
||||
_querySensors: function(){
|
||||
for each (let sensor in this._utils) {
|
||||
for (let sensor of Object.values(this._utils)) {
|
||||
if (sensor.available) {
|
||||
sensor.execute(Lang.bind(this,function(){
|
||||
// we cannot change actor in background thread #74
|
||||
@@ -242,7 +242,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
|
||||
_updateUI: function(){
|
||||
let needUpdate = false;
|
||||
for each (let sensor in this._utils) {
|
||||
for (let sensor of Object.values(this._utils)) {
|
||||
if (sensor.available && sensor.updated) {
|
||||
// global.log(sensor + ' updated');
|
||||
sensor.updated = false;
|
||||
@@ -257,7 +257,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
|
||||
_fixNames: function(sensors){
|
||||
let names = [];
|
||||
for each (let s in sensors){
|
||||
for (let s of sensors){
|
||||
if(s.type == 'separator' ||
|
||||
s.type == 'temperature-group' ||
|
||||
s.type == 'temperature-average' ||
|
||||
@@ -308,7 +308,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
let total = 0;
|
||||
let sum = 0;
|
||||
let max = 0;
|
||||
for each (let i in tempInfo){
|
||||
for (let i of tempInfo){
|
||||
if(i.temp !== null){
|
||||
total++;
|
||||
sum += i.temp;
|
||||
@@ -319,17 +319,17 @@ const FreonMenuButton = new Lang.Class({
|
||||
|
||||
let sensors = [];
|
||||
|
||||
for each (let i in gpuTempInfo){
|
||||
for (let i of gpuTempInfo){
|
||||
sensors.push({
|
||||
type: 'gpu-temperature',
|
||||
label: i.label,
|
||||
value: this._formatTemp(i.temp),
|
||||
displayName: i.displayName});
|
||||
}
|
||||
for each (let i in sensorsTempInfo){
|
||||
for (let i of sensorsTempInfo){
|
||||
sensors.push({type:'temperature', label: i.label, value:this._formatTemp(i.temp)});
|
||||
}
|
||||
for each (let i in driveTempInfo){
|
||||
for (let i of driveTempInfo){
|
||||
sensors.push({type:'drive-temperature', label: i.label, value:this._formatTemp(i.temp)});
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
|
||||
if(sensorsTempInfo.length > 0 && this._settings.get_boolean('group-temperature')){
|
||||
sum = 0;
|
||||
for each (let i in sensorsTempInfo){
|
||||
for (let i of sensorsTempInfo){
|
||||
sum += i.temp;
|
||||
}
|
||||
sensors.push({
|
||||
@@ -361,7 +361,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
value: this._formatTemp(sum / sensorsTempInfo.length)});
|
||||
}
|
||||
|
||||
for each (let fan in fanInfo){
|
||||
for (let fan of fanInfo){
|
||||
sensors.push({
|
||||
type:'fan',
|
||||
label:fan.label,
|
||||
@@ -370,7 +370,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
if (fanInfo.length > 0 && voltageInfo.length > 0){
|
||||
sensors.push({type : 'separator'});
|
||||
}
|
||||
for each (let voltage in voltageInfo){
|
||||
for (let voltage of voltageInfo){
|
||||
sensors.push({
|
||||
type : 'voltage',
|
||||
label:voltage.label,
|
||||
@@ -380,7 +380,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
|
||||
this._fixNames(sensors);
|
||||
|
||||
for each (let s in sensors)
|
||||
for (let s of sensors)
|
||||
if(s.type != 'separator') {
|
||||
let l = this._hotLabels[s.key || s.label];
|
||||
if(l)
|
||||
@@ -388,7 +388,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
}
|
||||
|
||||
if(this._lastSensorsCount && this._lastSensorsCount==sensors.length){
|
||||
for each (let s in sensors) {
|
||||
for (let s of sensors) {
|
||||
if(s.type != 'separator') {
|
||||
let item = this._sensorMenuItems[s.key || s.label];
|
||||
if(item) {
|
||||
@@ -453,7 +453,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
|
||||
if(needGroupVoltage){
|
||||
let i = 0;
|
||||
for each (let s in sensors)
|
||||
for (let s of sensors)
|
||||
if(s.type == 'voltage')
|
||||
i++;
|
||||
if(i < 2)
|
||||
@@ -463,7 +463,7 @@ const FreonMenuButton = new Lang.Class({
|
||||
let temperatureGroup = null;
|
||||
let voltageGroup = null;
|
||||
|
||||
for each (let s in sensors){
|
||||
for (let s of sensors){
|
||||
if(s.type == 'separator'){
|
||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||
} else if (s.type == 'temperature-group') {
|
||||
|
||||
@@ -2,7 +2,7 @@ const Lang = imports.lang;
|
||||
const St = imports.gi.St;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
|
||||
const FreonItem = new Lang.Class({
|
||||
var FreonItem = new Lang.Class({
|
||||
Name: 'FreonItem',
|
||||
Extends: PopupMenu.PopupBaseMenuItem,
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ const GLib = imports.gi.GLib;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
||||
|
||||
const HddtempUtil = new Lang.Class({
|
||||
var HddtempUtil = new Lang.Class({
|
||||
Name: 'HddtempUtil',
|
||||
Extends: CommandLineUtil.CommandLineUtil,
|
||||
|
||||
@@ -67,7 +67,7 @@ const HddtempUtil = new Lang.Class({
|
||||
}
|
||||
|
||||
let sensors = [];
|
||||
for each(let line in hddtempOutput) {
|
||||
for (let line of hddtempOutput) {
|
||||
let fields = line.split(sep).filter(function(e){ return e; });
|
||||
let sensor = { label: fields[1], temp: parseFloat(fields[2])};
|
||||
//push only if the temp is a Number
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"shell-version": ["3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.24", "3.26", "3.28"],
|
||||
"shell-version": ["3.30"],
|
||||
"uuid": "freon@UshakovVasilii_Github.yahoo.com",
|
||||
"name": "Freon",
|
||||
"description": "Shows CPU temperature, disk temperature, video card temperature (NVIDIA/Catalyst/Bumblebee&NVIDIA), voltage and fan RPM (forked from xtranophilist/gnome-shell-extension-sensors)",
|
||||
|
||||
@@ -5,7 +5,7 @@ const Gio = imports.gi.Gio;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
||||
|
||||
const NvidiaUtil = new Lang.Class({
|
||||
var NvidiaUtil = new Lang.Class({
|
||||
Name: 'NvidiaUtil',
|
||||
Extends: CommandLineUtil.CommandLineUtil,
|
||||
|
||||
@@ -49,7 +49,7 @@ const NvidiaUtil = new Lang.Class({
|
||||
if(!this._output)
|
||||
return [];
|
||||
let temps = [];
|
||||
for each(let line in this._output) {
|
||||
for (let line of this._output) {
|
||||
if(!line)
|
||||
continue;
|
||||
temps.push(parseFloat(line));
|
||||
|
||||
@@ -17,7 +17,7 @@ function init() {
|
||||
Convenience.initTranslations();
|
||||
}
|
||||
|
||||
const FreonPrefsWidget = new GObject.Class({
|
||||
var FreonPrefsWidget = new GObject.Class({
|
||||
Name: 'Freon.Prefs.Widget',
|
||||
GTypeName: 'FreonPrefsWidget',
|
||||
Extends: Gtk.Grid,
|
||||
|
||||
@@ -4,7 +4,7 @@ const GLib = imports.gi.GLib;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
||||
|
||||
const SensorsUtil = new Lang.Class({
|
||||
var SensorsUtil = new Lang.Class({
|
||||
Name: 'SensorsUtil',
|
||||
Extends: CommandLineUtil.CommandLineUtil,
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ const Async = {
|
||||
}
|
||||
|
||||
// routines for handling of udisks2
|
||||
const UDisks2 = new Lang.Class({
|
||||
var UDisks2 = new Lang.Class({
|
||||
Name: 'UDisks2',
|
||||
|
||||
_init: function(callback) {
|
||||
@@ -110,7 +110,7 @@ const UDisks2 = new Lang.Class({
|
||||
},
|
||||
|
||||
destroy: function(callback) {
|
||||
for each (let proxy in this._udisksProxies){
|
||||
for (let proxy of this._udisksProxies){
|
||||
if(proxy.drive){
|
||||
proxy.drive.run_dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user