mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-15 00:44:22 +09:00
Migrate Plugin to Gnome 45 Shell (#267)
* Migrate Plugin to Gnome 45 Shell * Use TextDecoder instead of ByteArray or toString() * use the Glib timeout functions * remove unused imports
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
import CommandLineUtil from './commandLineUtil.js';
|
||||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
|
||||||
var AticonfigUtil = class extends CommandLineUtil.CommandLineUtil {
|
export default class AticonfigUtil extends CommandLineUtil {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import Gio from 'gi://Gio';
|
||||||
const Gio = imports.gi.Gio;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
import CommandLineUtil from './commandLineUtil.js';
|
||||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
|
||||||
var BumblebeeNvidiaUtil = class extends CommandLineUtil.CommandLineUtil {
|
export default class BumblebeeNvidiaUtil extends CommandLineUtil {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const ByteArray = imports.byteArray;
|
import Gio from 'gi://Gio';
|
||||||
const GLib = imports.gi.GLib;
|
|
||||||
const Gio = imports.gi.Gio;
|
|
||||||
|
|
||||||
var CommandLineUtil = class {
|
export default class CommandLineUtil {
|
||||||
|
|
||||||
constructor(){
|
constructor(){
|
||||||
this._argv = null;
|
this._argv = null;
|
||||||
|
|||||||
@@ -1,34 +1,30 @@
|
|||||||
const St = imports.gi.St;
|
import Clutter from 'gi://Clutter';
|
||||||
const PanelMenu = imports.ui.panelMenu;
|
import Gio from 'gi://Gio';
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
import GLib from 'gi://GLib';
|
||||||
const Main = imports.ui.main;
|
import GObject from 'gi://GObject';
|
||||||
const Util = imports.misc.util;
|
import St from 'gi://St';
|
||||||
const Mainloop = imports.mainloop;
|
|
||||||
const Clutter = imports.gi.Clutter;
|
|
||||||
const Gio = imports.gi.Gio;
|
|
||||||
const GLib = imports.gi.GLib;
|
|
||||||
const GObject = imports.gi.GObject;
|
|
||||||
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
||||||
const Me = ExtensionUtils.getCurrentExtension();
|
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
||||||
|
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||||
|
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
|
||||||
|
|
||||||
const SensorsUtil = Me.imports.sensorsUtil.SensorsUtil;
|
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||||
const FreeipmiUtil = Me.imports.freeipmiUtil.FreeipmiUtil;
|
|
||||||
const LiquidctlUtil = Me.imports.liquidctlUtil.LiquidctlUtil;
|
|
||||||
|
|
||||||
const NvidiaUtil = Me.imports.nvidiaUtil.NvidiaUtil;
|
import SensorsUtil from './sensorsUtil.js';
|
||||||
const BumblebeeNvidiaUtil = Me.imports.bumblebeeNvidiaUtil.BumblebeeNvidiaUtil;
|
import FreeipmiUtil from './freeipmiUtil.js';
|
||||||
const AticonfigUtil = Me.imports.aticonfigUtil.AtiConfigUtil;
|
import LiquidctlUtil from './liquidctlUtil.js';
|
||||||
|
|
||||||
const Udisks2Util = Me.imports.udisks2.UDisks2;
|
import NvidiaUtil from './nvidiaUtil.js';
|
||||||
const HddtempUtil = Me.imports.hddtempUtil.HddtempUtil;
|
import BumblebeeNvidiaUtil from './bumblebeeNvidiaUtil.js';
|
||||||
const SmartctlUtil = Me.imports.smartctlUtil.SmartctlUtil;
|
import AticonfigUtil from './aticonfigUtil.js';
|
||||||
const NvmecliUtil = Me.imports.nvmecliUtil.NvmecliUtil;
|
|
||||||
|
|
||||||
const FreonItem = Me.imports.freonItem.FreonItem;
|
import Udisks2Util from './udisks2.js';
|
||||||
|
import HddtempUtil from './hddtempUtil.js';
|
||||||
|
import SmartctlUtil from './smartctlUtil.js';
|
||||||
|
import NvmecliUtil from './nvmecliUtil.js';
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
import FreonItem from './freonItem.js';
|
||||||
const _ = Gettext.gettext;
|
|
||||||
|
|
||||||
function _makeLogFunction(prefix) {
|
function _makeLogFunction(prefix) {
|
||||||
return msg => {
|
return msg => {
|
||||||
@@ -55,10 +51,12 @@ function _makeLogFunction(prefix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extends PanelMenu.Button {
|
const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extends PanelMenu.Button {
|
||||||
_init() {
|
|
||||||
super._init(St.Align.START);
|
|
||||||
|
|
||||||
this._settings = ExtensionUtils.getSettings();
|
constructor(uuid, path, settings) {
|
||||||
|
super(0);
|
||||||
|
|
||||||
|
this._extension_uuid = uuid;
|
||||||
|
this._settings = settings;
|
||||||
|
|
||||||
var _debugFunc = _makeLogFunction('DEBUG');
|
var _debugFunc = _makeLogFunction('DEBUG');
|
||||||
this.debug = this._settings.get_boolean('debug') ? _debugFunc : () => {};
|
this.debug = this._settings.get_boolean('debug') ? _debugFunc : () => {};
|
||||||
@@ -84,17 +82,17 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
this._initSmartctlUtility();
|
this._initSmartctlUtility();
|
||||||
this._initNvmecliUtility();
|
this._initNvmecliUtility();
|
||||||
|
|
||||||
let temperatureIcon = Gio.icon_new_for_string(Me.path + '/icons/material-icons/material-temperature-symbolic.svg');
|
let temperatureIcon = Gio.icon_new_for_string(path + '/icons/material-icons/material-temperature-symbolic.svg');
|
||||||
let voltageIcon = Gio.icon_new_for_string(Me.path + '/icons/freon-voltage-symbolic.svg');
|
let voltageIcon = Gio.icon_new_for_string(path + '/icons/freon-voltage-symbolic.svg');
|
||||||
|
|
||||||
this._sensorIcons = {
|
this._sensorIcons = {
|
||||||
'temperature' : temperatureIcon,
|
'temperature' : temperatureIcon,
|
||||||
'temperature-average' : temperatureIcon,
|
'temperature-average' : temperatureIcon,
|
||||||
'temperature-maximum' : temperatureIcon,
|
'temperature-maximum' : temperatureIcon,
|
||||||
'gpu-temperature' : Gio.icon_new_for_string(Me.path + '/icons/material-icons/material-gpu-temperature-symbolic.svg'),
|
'gpu-temperature' : Gio.icon_new_for_string(path + '/icons/material-icons/material-gpu-temperature-symbolic.svg'),
|
||||||
'drive-temperature' : Gio.icon_new_for_string('drive-harddisk-symbolic'),
|
'drive-temperature' : Gio.icon_new_for_string('drive-harddisk-symbolic'),
|
||||||
'voltage' : voltageIcon,
|
'voltage' : voltageIcon,
|
||||||
'fan' : Gio.icon_new_for_string(Me.path + '/icons/freon-fan-symbolic.svg'),
|
'fan' : Gio.icon_new_for_string(path + '/icons/freon-fan-symbolic.svg'),
|
||||||
'power' : voltageIcon,
|
'power' : voltageIcon,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +161,7 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
|
|
||||||
this._addTimer();
|
this._addTimer();
|
||||||
this._updateUI(true);
|
this._updateUI(true);
|
||||||
this._updateUITimeoutId = Mainloop.timeout_add(250, () => {
|
this._updateUITimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 250, () => {
|
||||||
this._updateUI();
|
this._updateUI();
|
||||||
// readd to update queue
|
// readd to update queue
|
||||||
return true;
|
return true;
|
||||||
@@ -429,12 +427,12 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateTimeChanged(){
|
_updateTimeChanged(){
|
||||||
Mainloop.source_remove(this._timeoutId);
|
GLib.Source.remove(this._timeoutId);
|
||||||
this._addTimer();
|
this._addTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
_addTimer(){
|
_addTimer(){
|
||||||
this._timeoutId = Mainloop.timeout_add_seconds(this._settings.get_int('update-time'), () => {
|
this._timeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, this._settings.get_int('update-time'), () => {
|
||||||
this._querySensors();
|
this._querySensors();
|
||||||
// readd to update queue
|
// readd to update queue
|
||||||
return true;
|
return true;
|
||||||
@@ -459,8 +457,8 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
this._destroySmartctlUtility();
|
this._destroySmartctlUtility();
|
||||||
this._destroyNvmecliUtility();
|
this._destroyNvmecliUtility();
|
||||||
|
|
||||||
Mainloop.source_remove(this._timeoutId);
|
GLib.Source.remove(this._timeoutId);
|
||||||
Mainloop.source_remove(this._updateUITimeoutId);
|
GLib.Source.remove(this._updateUITimeoutId);
|
||||||
|
|
||||||
for (let signal of this._settingChangedSignals){
|
for (let signal of this._settingChangedSignals){
|
||||||
this._settings.disconnect(signal);
|
this._settings.disconnect(signal);
|
||||||
@@ -778,7 +776,7 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
|
|
||||||
let wiki = new PopupMenu.PopupBaseMenuItem();
|
let wiki = new PopupMenu.PopupBaseMenuItem();
|
||||||
wiki.actor.add_child(new St.Label({ text: _("Go to the Freon wiki"), x_align: Clutter.ActorAlign.START, x_expand: true }));
|
wiki.actor.add_child(new St.Label({ text: _("Go to the Freon wiki"), x_align: Clutter.ActorAlign.START, x_expand: true }));
|
||||||
wiki.connect('activate', function () {
|
wiki.connect('activate', () => {
|
||||||
Util.spawn(["xdg-open", "https://github.com/UshakovVasilii/gnome-shell-extension-freon/wiki"]);
|
Util.spawn(["xdg-open", "https://github.com/UshakovVasilii/gnome-shell-extension-freon/wiki"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -786,8 +784,8 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
|
|
||||||
let settings = new PopupMenu.PopupBaseMenuItem();
|
let settings = new PopupMenu.PopupBaseMenuItem();
|
||||||
settings.actor.add_child(new St.Label({ text: _("Sensor Settings"), x_align: Clutter.ActorAlign.START, x_expand: true }));
|
settings.actor.add_child(new St.Label({ text: _("Sensor Settings"), x_align: Clutter.ActorAlign.START, x_expand: true }));
|
||||||
settings.connect('activate', function () {
|
settings.connect('activate', () => {
|
||||||
Util.spawn(["gnome-extensions", "prefs", Me.metadata.uuid]);
|
Util.spawn(["gnome-extensions", "prefs", this._extension_uuid]);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.menu.addMenuItem(settings);
|
this.menu.addMenuItem(settings);
|
||||||
@@ -970,19 +968,16 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let freonMenu;
|
export default class extends Extension {
|
||||||
|
|
||||||
function init(extensionMeta) {
|
enable() {
|
||||||
ExtensionUtils.initTranslations();
|
this._freonMenu = new FreonMenuButton(this.uuid, this.path, this.getSettings());
|
||||||
}
|
Main.panel.addToStatusArea('freonMenu', this._freonMenu);
|
||||||
|
this._freonMenu._positionInPanelChanged();
|
||||||
|
}
|
||||||
|
|
||||||
function enable() {
|
disable() {
|
||||||
freonMenu = new FreonMenuButton();
|
this._freonMenu?.destroy();
|
||||||
Main.panel.addToStatusArea('freonMenu', freonMenu);
|
this._freonMenu = null;
|
||||||
freonMenu._positionInPanelChanged();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function disable() {
|
|
||||||
freonMenu.destroy();
|
|
||||||
freonMenu = null;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
import CommandLineUtil from './commandLineUtil.js';
|
||||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
export default class FreeipmiUtil extends CommandLineUtil {
|
||||||
|
|
||||||
var FreeipmiUtil = class extends CommandLineUtil.CommandLineUtil {
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
const GObject = imports.gi.GObject;
|
import Clutter from 'gi://Clutter';
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
import GObject from 'gi://GObject';
|
||||||
const St = imports.gi.St;
|
import St from 'gi://St';
|
||||||
const Clutter = imports.gi.Clutter;
|
|
||||||
|
|
||||||
var FreonItem = GObject.registerClass(class FreonItem extends PopupMenu.PopupBaseMenuItem {
|
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
||||||
|
|
||||||
_init(gIcon, key, label, value, displayName) {
|
export default GObject.registerClass(class FreonItem extends PopupMenu.PopupBaseMenuItem {
|
||||||
super._init();
|
|
||||||
|
constructor(gIcon, key, label, value, displayName) {
|
||||||
|
super();
|
||||||
this._main = false;
|
this._main = false;
|
||||||
this._key = key;
|
this._key = key;
|
||||||
this._gIcon = gIcon;
|
this._gIcon = gIcon;
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
import CommandLineUtil from './commandLineUtil.js';
|
||||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
|
||||||
var HddtempUtil = class extends CommandLineUtil.CommandLineUtil {
|
function run_command(argv) {
|
||||||
|
return new TextDecoder().decode(GLib.spawn_command_line_sync(argv)[1]).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class HddtempUtil extends CommandLineUtil {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -24,9 +27,9 @@ var HddtempUtil = class extends CommandLineUtil.CommandLineUtil {
|
|||||||
let pid = undefined;
|
let pid = undefined;
|
||||||
|
|
||||||
if(systemctl) {
|
if(systemctl) {
|
||||||
let activeState = GLib.spawn_command_line_sync(systemctl + " show hddtemp.service -p ActiveState")[1].toString().trim();
|
let activeState = run_command(systemctl + " show hddtemp.service -p ActiveState");
|
||||||
if(activeState == "ActiveState=active") {
|
if(activeState == "ActiveState=active") {
|
||||||
let output = GLib.spawn_command_line_sync(systemctl + " show hddtemp.service -p MainPID")[1].toString().trim();
|
let output = run_command(systemctl + " show hddtemp.service -p MainPID");
|
||||||
|
|
||||||
if(output.length && output.split("=").length == 2)
|
if(output.length && output.split("=").length == 2)
|
||||||
pid = Number(output.split("=")[1].trim());
|
pid = Number(output.split("=")[1].trim());
|
||||||
@@ -35,7 +38,7 @@ var HddtempUtil = class extends CommandLineUtil.CommandLineUtil {
|
|||||||
|
|
||||||
// systemd isn't used on this system, try sysvinit instead
|
// systemd isn't used on this system, try sysvinit instead
|
||||||
if(!pid && pidof) {
|
if(!pid && pidof) {
|
||||||
let output = GLib.spawn_command_line_sync("pidof hddtemp")[1].toString().trim();
|
let output = run_command("pidof hddtemp");
|
||||||
if(output.length)
|
if(output.length)
|
||||||
pid = Number(output.trim());
|
pid = Number(output.trim());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
// Provide sensor data from liquidctl.
|
// Provide sensor data from liquidctl.
|
||||||
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const GLib = imports.gi.GLib;
|
import CommandLineUtil from './commandLineUtil.js';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
export default class LiquidctlUtil extends CommandLineUtil {
|
||||||
const commandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
|
||||||
var LiquidctlUtil = class extends commandLineUtil.CommandLineUtil {
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
const path = GLib.find_program_in_path('liquidctl');
|
const path = GLib.find_program_in_path('liquidctl');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"shell-version": ["40", "41", "42", "43","44"],
|
"shell-version": ["45"],
|
||||||
"uuid": "freon@UshakovVasilii_Github.yahoo.com",
|
"uuid": "freon@UshakovVasilii_Github.yahoo.com",
|
||||||
"name": "Freon",
|
"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)",
|
"description": "Shows CPU temperature, disk temperature, video card temperature (NVIDIA/Catalyst/Bumblebee&NVIDIA), voltage and fan RPM (forked from xtranophilist/gnome-shell-extension-sensors)",
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
const ByteArray = imports.byteArray;
|
import Gio from 'gi://Gio';
|
||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
const Gio = imports.gi.Gio;
|
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
export default class NvidiaUtil {
|
||||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
|
||||||
var NvidiaUtil = class {
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._nvidiaSmiPath = GLib.find_program_in_path('nvidia-smi');
|
this._nvidiaSmiPath = GLib.find_program_in_path('nvidia-smi');
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
|
||||||
|
|
||||||
function getNvmeData (argv){
|
function getNvmeData (argv){
|
||||||
const nvme = GLib.find_program_in_path('nvme')
|
const nvme = GLib.find_program_in_path('nvme')
|
||||||
return JSON.parse(GLib.spawn_command_line_sync(`${nvme} ${argv} -o json`)[1].toString())
|
return JSON.parse(new TextDecoder().decode(GLib.spawn_command_line_sync(`${nvme} ${argv} -o json`)[1]))
|
||||||
}
|
}
|
||||||
|
|
||||||
var NvmecliUtil = class {
|
export default class NvmecliUtil {
|
||||||
|
|
||||||
constructor(callback) {
|
constructor(callback) {
|
||||||
this._nvmeDevices = [];
|
this._nvmeDevices = [];
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,29 +1,21 @@
|
|||||||
const GObject = imports.gi.GObject;
|
import Gio from 'gi://Gio';
|
||||||
const Gio = imports.gi.Gio;
|
import GObject from 'gi://GObject';
|
||||||
const Gtk = imports.gi.Gtk;
|
import Gtk from 'gi://Gtk?version=4.0';
|
||||||
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||||
const Me = ExtensionUtils.getCurrentExtension();
|
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
|
||||||
const _ = Gettext.gettext;
|
|
||||||
|
|
||||||
const modelColumn = {
|
const modelColumn = {
|
||||||
label: 0,
|
label: 0,
|
||||||
separator: 1
|
separator: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
|
||||||
ExtensionUtils.initTranslations();
|
|
||||||
}
|
|
||||||
|
|
||||||
var FreonPrefsWidget = new GObject.registerClass(class Freon_FreonPrefsWidget extends Gtk.Grid {
|
var FreonPrefsWidget = new GObject.registerClass(class Freon_FreonPrefsWidget extends Gtk.Grid {
|
||||||
|
|
||||||
_init() {
|
constructor(settings) {
|
||||||
super._init();
|
super();
|
||||||
this.margin = this.row_spacing = this.column_spacing = 20;
|
this.margin = this.row_spacing = this.column_spacing = 20;
|
||||||
|
|
||||||
this._settings = ExtensionUtils.getSettings();
|
this._settings = settings;
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let j = 0;
|
let j = 0;
|
||||||
@@ -230,6 +222,9 @@ var FreonPrefsWidget = new GObject.registerClass(class Freon_FreonPrefsWidget ex
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function buildPrefsWidget() {
|
export default class extends ExtensionPreferences {
|
||||||
return new FreonPrefsWidget();
|
|
||||||
|
getPreferencesWidget() {
|
||||||
|
return new FreonPrefsWidget(this.getSettings());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
import CommandLineUtil from './commandLineUtil.js';
|
||||||
const CommandLineUtil = Me.imports.commandLineUtil;
|
|
||||||
|
|
||||||
var SensorsUtil = class extends CommandLineUtil.CommandLineUtil {
|
export default class SensorsUtil extends CommandLineUtil {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
const GLib = imports.gi.GLib;
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
|
||||||
const ByteArray = imports.byteArray;
|
|
||||||
function getSmartData (argv){
|
function getSmartData (argv){
|
||||||
const smartctl = GLib.find_program_in_path('smartctl')
|
const smartctl = GLib.find_program_in_path('smartctl')
|
||||||
return JSON.parse(ByteArray.toString( GLib.spawn_command_line_sync(`'${smartctl}' ${argv} -j`)[1] ))
|
return JSON.parse(new TextDecoder().decode( GLib.spawn_command_line_sync(`'${smartctl}' ${argv} -j`)[1] ))
|
||||||
}
|
}
|
||||||
|
|
||||||
var SmartctlUtil = class {
|
export default class SmartctlUtil {
|
||||||
|
|
||||||
constructor(callback) {
|
constructor(callback) {
|
||||||
this._smartDevices = [];
|
this._smartDevices = [];
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const Gio = imports.gi.Gio;
|
import Gio from 'gi://Gio';
|
||||||
|
|
||||||
const UDisksDriveProxy = Gio.DBusProxy.makeProxyWrapper(
|
const UDisksDriveProxy = Gio.DBusProxy.makeProxyWrapper(
|
||||||
'<node> \
|
'<node> \
|
||||||
@@ -30,7 +30,7 @@ const Async = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// routines for handling of udisks2
|
// routines for handling of udisks2
|
||||||
var UDisks2 = class {
|
export default class UDisks2 {
|
||||||
|
|
||||||
constructor(callback) {
|
constructor(callback) {
|
||||||
this._udisksProxies = [];
|
this._udisksProxies = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user