From 44fa90f31f0a77de20c7650e3f437b85c57e20c7 Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Sat, 16 Sep 2023 19:20:19 -0300 Subject: [PATCH 1/8] keep only 45 shell version, add gettext-domain, settings-schema --- metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index a5f4ee8f..446f037b 100644 --- a/metadata.json +++ b/metadata.json @@ -1,11 +1,12 @@ { "localedir": "/usr/local/share/locale", "shell-version": [ - "3.28", "3.30", "3.36", "3.38", "40", "41", "42" + "45" ], "uuid": "cpupower@mko-sl.de", "name": "CPU Power Manager", "url": "https://github.com/deinstapel/cpupower", "description": "Manage your CPU's frequency scaling driver", - "schema": "org.gnome.shell.extensions.cpupower" + "settings-schema": "org.gnome.shell.extensions.cpupower", + "gettext-domain": "cpupower" } From 248fa51cf72655539d3147e5888302bc2f03fc8f Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Sat, 16 Sep 2023 19:22:17 -0300 Subject: [PATCH 2/8] doesn't need anymore on g45, provided by new extension inheritance --- src/convenience.js | 98 ---------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 src/convenience.js diff --git a/src/convenience.js b/src/convenience.js deleted file mode 100644 index e4b260d9..00000000 --- a/src/convenience.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2011-2012, Giovanni Campagna - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the GNOME nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -const Gettext = imports.gettext; -const Gio = imports.gi.Gio; - -const Config = imports.misc.config; -const ExtensionUtils = imports.misc.extensionUtils; - -/* exported initTranslations */ -/** - * initTranslations: - * @domain: (optional): the gettext domain to use - * - * Initialize Gettext to load translations from extensionsdir/locale. - * If @domain is not provided, it will be taken from metadata["gettext-domain"] - */ -function initTranslations(domain) { - let extension = ExtensionUtils.getCurrentExtension(); - - domain = domain || extension.metadata["gettext-domain"]; - - // check if this extension was built with "make zip-file", and thus - // has the locale files in a subfolder - // otherwise assume that extension has been installed in the - // same prefix as gnome-shell - let localeDir = extension.dir.get_child("locale"); - if (localeDir.query_exists(null)) { - Gettext.bindtextdomain(domain, localeDir.get_path()); - } else { - Gettext.bindtextdomain(domain, Config.LOCALEDIR); - } -} - -/* exported getSettings */ -/** - * getSettings: - * @schema: (optional): the GSettings schema id - * - * Builds and return a GSettings schema for @schema, using schema files - * in extensionsdir/schemas. If @schema is not provided, it is taken from - * metadata["settings-schema"]. - */ -function getSettings(schema) { - let extension = ExtensionUtils.getCurrentExtension(); - - schema = schema || extension.metadata["settings-schema"]; - - const GioSSS = Gio.SettingsSchemaSource; - - // check if this extension was built with "make zip-file", and thus - // has the schema files in a subfolder - // otherwise assume that extension has been installed in the - // same prefix as gnome-shell (and therefore schemas are available - // in the standard folders) - let schemaDir = extension.dir.get_child("schemas"); - let schemaSource; - if (schemaDir.query_exists(null)) { - schemaSource = GioSSS.new_from_directory( - schemaDir.get_path(), - GioSSS.get_default(), - false, - ); - } else { - schemaSource = GioSSS.get_default(); - } - - let schemaObj = schemaSource.lookup(schema, true); - if (!schemaObj) { - throw new Error(`Schema ${schema} could not be found for extension ${extension.metadata.uuid}. ` + - "Please check your installation."); - } - - return new Gio.Settings({settings_schema: schemaObj}); -} From 30740c325ed7ea434b37a5fe90b0a28f85caf4cb Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Sat, 16 Sep 2023 20:18:25 -0300 Subject: [PATCH 3/8] fix import (port to ESM) and add extends extension --- extension.js | 171 ++++++++++++++++++++++++++------------------------- 1 file changed, 87 insertions(+), 84 deletions(-) diff --git a/extension.js b/extension.js index 7dbb12fe..9c983cfc 100644 --- a/extension.js +++ b/extension.js @@ -25,27 +25,24 @@ * */ -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const EXTENSIONDIR = Me.dir.get_path(); -const Convenience = Me.imports.src.convenience; -const Main = imports.ui.main; -const Config = imports.misc.config; +import * as Extension from 'resource:///org/gnome/shell/extensions/extension.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; + const ByteArray = imports.byteArray; -const utils = Me.imports.src.utils; -const checkInstalled = Me.imports.src.utils.checkInstalled; -const notinstalled = Me.imports.src.notinstalled; -const update = Me.imports.src.update; -const indicator = Me.imports.src.indicator; +import { utils } from "./src/utils.js" +import { checkInstalled } from "./src/checkInstalled.js" +import { notinstalled } from "./src/notinstalled.js" +import { update } from "./src/update.js" +import { indicator } from "./src/indicator.js" -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; let indicatorInstance; /* exported init */ function init(_meta) { - Convenience.initTranslations("gnome-shell-extension-cpupower"); + // Convenience.initTranslations("gnome-shell-extension-cpupower"); } function enableIndicator(instance) { @@ -56,80 +53,86 @@ function enableIndicator(instance) { let cpupowerProxy; let extensionReloadSignalHandler; /* exported enable */ -function enable() { - const interfaceBinary = GLib.file_get_contents(`${EXTENSIONDIR}/schemas/io.github.martin31821.cpupower.dbus.xml`)[1]; - let interfaceXml; - if (parseFloat(Config.PACKAGE_VERSION.substring(0, 4)) > 3.28) { - interfaceXml = ByteArray.toString(interfaceBinary); - } else { - interfaceXml = interfaceBinary.toString(); - } - const CpupowerProxy = Gio.DBusProxy.makeProxyWrapper(interfaceXml); - - cpupowerProxy = new CpupowerProxy( - Gio.DBus.session, - "io.github.martin31821.cpupower", - "/io/github/martin31821/cpupower", - ); - - extensionReloadSignalHandler = cpupowerProxy.connectSignal("ExtensionReloadRequired", () => { - log("Reloading cpupower"); - disable(); - enable(); - }); - - try { - checkInstalled((installed, exitCode) => { - if (!installed) { - switch (exitCode) { - case utils.INSTALLER_NEEDS_UPDATE: - indicatorInstance = new update.UpdateIndicator(update.UPDATE, function (success) { - if (success) { - // reenable the extension to allow immediate operation. - disable(); - enable(); - } - }, (inst) => enableIndicator(inst)); - break; - case utils.INSTALLER_NEEDS_SECURITY_UPDATE: - indicatorInstance = new update.UpdateIndicator(update.SECURITY_UPDATE, function (success) { - if (success) { - // reenable the extension to allow immediate operation. - disable(); - enable(); - } - }, (inst) => enableIndicator(inst)); - break; - default: - indicatorInstance = new notinstalled.NotInstalledIndicator(exitCode, function (success) { - if (success) { - // reenable the extension to allow immediate operation. - disable(); - enable(); - } - }, (inst) => enableIndicator(inst)); - break; - } - } else { - indicatorInstance = new indicator.CPUFreqIndicator((inst) => enableIndicator(inst)); - } + +export default class CpuPowerExtension extends Extension { + + enable() { + const EXTENSIONDIR = this.path; + const interfaceBinary = GLib.file_get_contents(`${EXTENSIONDIR}/schemas/io.github.martin31821.cpupower.dbus.xml`)[1]; + let interfaceXml; + + let decoder = new TextDecoder('utf-8'); + + interfaceXml = decoder.decode(interfaceBinary); + + const CpupowerProxy = Gio.DBusProxy.makeProxyWrapper(interfaceXml); + + cpupowerProxy = new CpupowerProxy( + Gio.DBus.session, + "io.github.martin31821.cpupower", + "/io/github/martin31821/cpupower", + ); + + extensionReloadSignalHandler = cpupowerProxy.connectSignal("ExtensionReloadRequired", () => { + log("Reloading cpupower"); + disable(); + enable(); }); - } catch (e) { - logError(e.message); - } -} -/* exported disable */ -function disable() { - if (indicatorInstance) { - indicatorInstance.disable(); - indicatorInstance.destroy(); + try { + checkInstalled((installed, exitCode) => { + if (!installed) { + switch (exitCode) { + case utils.INSTALLER_NEEDS_UPDATE: + indicatorInstance = new update.UpdateIndicator(update.UPDATE, function (success) { + if (success) { + // reenable the extension to allow immediate operation. + disable(); + enable(); + } + }, (inst) => enableIndicator(inst)); + break; + case utils.INSTALLER_NEEDS_SECURITY_UPDATE: + indicatorInstance = new update.UpdateIndicator(update.SECURITY_UPDATE, function (success) { + if (success) { + // reenable the extension to allow immediate operation. + disable(); + enable(); + } + }, (inst) => enableIndicator(inst)); + break; + default: + indicatorInstance = new notinstalled.NotInstalledIndicator(exitCode, function (success) { + if (success) { + // reenable the extension to allow immediate operation. + disable(); + enable(); + } + }, (inst) => enableIndicator(inst)); + break; + } + } else { + indicatorInstance = new indicator.CPUFreqIndicator((inst) => enableIndicator(inst)); + } + }); + } catch (e) { + logError(e.message); + } } - if (cpupowerProxy && extensionReloadSignalHandler) { - cpupowerProxy.disconnectSignal(extensionReloadSignalHandler); + /* exported disable */ + + disable() { + if (indicatorInstance) { + indicatorInstance.disable(); + indicatorInstance.destroy(); + } + + if (cpupowerProxy && extensionReloadSignalHandler) { + cpupowerProxy.disconnectSignal(extensionReloadSignalHandler); - cpupowerProxy = null; - extensionReloadSignalHandler = null; + cpupowerProxy = null; + extensionReloadSignalHandler = null; + } } } From fb8604ada168c8a8986b1d9759a85269c94c5552 Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Mon, 18 Sep 2023 14:11:52 -0300 Subject: [PATCH 4/8] migrate import to ESM --- src/indicator.js | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/indicator.js b/src/indicator.js index 573796f5..f164c2c4 100644 --- a/src/indicator.js +++ b/src/indicator.js @@ -25,30 +25,36 @@ * */ -const St = imports.gi.St; -const Main = imports.ui.main; -const PopupMenu = imports.ui.popupMenu; -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; -const Util = imports.misc.util; +import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; +import Shell from 'gi://Shell'; +import St from 'gi://St'; +import UPower from 'gi://UPowerGlib'; +import Gio from 'gi://Gio'; + const Mainloop = imports.mainloop; -const Shell = imports.gi.Shell; -const UPower = imports.gi.UPowerGlib; -const Config = imports.misc.config; -const Gettext = imports.gettext.domain("gnome-shell-extension-cpupower"); -const _ = Gettext.gettext; +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'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; +import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; + +import Gettext from 'gettext'; +const _ = Gettext.domain('gnome-shell-extension-cpupower'); + const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const EXTENSIONDIR = Me.dir.get_path(); -const utils = Me.imports.src.utils; -const Cpufreqctl = Me.imports.src.utils.Cpufreqctl; -const Slider = Me.imports.src.slider2; -const CPUFreqProfile = Me.imports.src.profile.CPUFreqProfile; -const baseindicator = Me.imports.src.baseindicator; -const CPUFreqProfileButton = Me.imports.src.profilebutton.CPUFreqProfileButton; + + +import { utils, Cpufreqctl } from "./utils.js" +import { CPUFreqProfile } from "./profile.js" +import { CPUFreqProfileButton } from "./profilebutton.js" +import { Slider } from "./slider2.js" +import { baseindicator } from "./baseindicator.js" const LASTSETTINGS = `${GLib.get_user_cache_dir()}/cpupower.last-settings`; From 8586474a18a2c4021753708e5ec130a2ed0d64bd Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Mon, 18 Sep 2023 19:08:51 -0300 Subject: [PATCH 5/8] migrate import to ESM --- extension.js | 4 ++-- src/indicator.js | 20 +++++--------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/extension.js b/extension.js index 9c983cfc..651e04b3 100644 --- a/extension.js +++ b/extension.js @@ -25,10 +25,10 @@ * */ -import * as Extension from 'resource:///org/gnome/shell/extensions/extension.js'; +import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; -const ByteArray = imports.byteArray; +//const ByteArray = imports.byteArray; import { utils } from "./src/utils.js" import { checkInstalled } from "./src/checkInstalled.js" diff --git a/src/indicator.js b/src/indicator.js index f164c2c4..57391c7d 100644 --- a/src/indicator.js +++ b/src/indicator.js @@ -44,12 +44,6 @@ import Gettext from 'gettext'; const _ = Gettext.domain('gnome-shell-extension-cpupower'); -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const EXTENSIONDIR = Me.dir.get_path(); - - - import { utils, Cpufreqctl } from "./utils.js" import { CPUFreqProfile } from "./profile.js" import { CPUFreqProfileButton } from "./profilebutton.js" @@ -125,8 +119,8 @@ var CPUFreqIndicator = class CPUFreqIndicator extends baseindicator.CPUFreqBaseI super.enable(); - this.timeout = Mainloop.timeout_add_seconds(1, () => this.updateFreq()); - this.timeoutMinMax = Mainloop.timeout_add_seconds(1, () => this.updateFreqMinMax(false)); + this.timeout = GLib.timeout_add_seconds(1, () => this.updateFreq()); + this.timeoutMinMax = GLib.timeout_add_seconds(1, () => this.updateFreqMinMax(false)); } onPowerChanged() { @@ -568,13 +562,9 @@ var CPUFreqIndicator = class CPUFreqIndicator extends baseindicator.CPUFreqBaseI } onPreferencesActivate(_item) { - if (parseFloat(Config.PACKAGE_VERSION.substring(0, 4)) >= 40) { - Util.trySpawnCommandLine(`${EXTENSIONDIR}/src/prefs40/main.js`); - } else if (parseFloat(Config.PACKAGE_VERSION.substring(0, 4)) > 3.32) { - Util.trySpawnCommandLine("gnome-extensions prefs cpupower@mko-sl.de"); - } else { - Util.trySpawnCommandLine("gnome-shell-extension-prefs cpupower@mko-sl.de"); - } + + Util.trySpawnCommandLine(GLib.uri_resolve_relative(import.meta.url, './src/prefs40/main.js', GLib.UriFlags.NONE)); + return 0; } }; From 875995e1d3591cadb6cecc04172eef26bf7485e3 Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Tue, 19 Sep 2023 17:47:18 -0300 Subject: [PATCH 6/8] migrate import to ESM --- src/baseindicator.js | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/baseindicator.js b/src/baseindicator.js index 1f9f1863..a06a3019 100644 --- a/src/baseindicator.js +++ b/src/baseindicator.js @@ -26,20 +26,26 @@ * */ + + + + +import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as Util from 'resource:///org/gnome/shell/misc/util.js'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; + // Gnome imports -const PanelMenu = imports.ui.panelMenu; -const St = imports.gi.St; -const Gio = imports.gi.Gio; -const PopupMenu = imports.ui.popupMenu; -const Main = imports.ui.main; -const Clutter = imports.gi.Clutter; -const Config = imports.misc.config; - -// Relative and misc imports and definitions -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const Convenience = Me.imports.src.convenience; -const SETTINGS_ID = "org.gnome.shell.extensions.cpupower"; +import Gio from 'gi://Gio'; +import St from 'gi://St'; +import Gio from 'gi://Gio'; +import Clutter from 'gi://Clutter'; + +//Relative imports + +import { CpuPowerExtension } from "./../extension.js" + /* exported CPUFreqBaseIndicator */ var CPUFreqBaseIndicator = class CPUFreqBaseIndicator { @@ -47,14 +53,9 @@ var CPUFreqBaseIndicator = class CPUFreqBaseIndicator { this.mainButton = new PanelMenu.Button(null, "cpupower"); this.menu = this.mainButton.menu; - if (parseFloat(Config.PACKAGE_VERSION.substring(0, 4)) > 3.32) { - this.actor = this.mainButton; - } else { - this.actor = this.mainButton.actor; - } - - this.settings = Convenience.getSettings(SETTINGS_ID); - + this.actor = this.mainButton; +ax + this.settings = new CpuPowerExtension().settings Main.panel.menuManager.addMenu(this.menu); this.hbox = new St.BoxLayout({style_class: "panel-status-menu-box"}); let gicon = Gio.icon_new_for_string(`${Me.path}/data/icons/cpu-symbolic.svg`); From 46c8d308a0812b7ddc548f6f96cba4b9704b247e Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Tue, 19 Sep 2023 19:26:52 -0300 Subject: [PATCH 7/8] migrate import to ESM, fix some other old calls, add constructor method on extension.js --- extension.js | 5 +++++ src/indicator.js | 4 ---- src/utils.js | 14 ++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/extension.js b/extension.js index 651e04b3..86c6707e 100644 --- a/extension.js +++ b/extension.js @@ -52,10 +52,15 @@ function enableIndicator(instance) { let cpupowerProxy; let extensionReloadSignalHandler; + /* exported enable */ export default class CpuPowerExtension extends Extension { + export const settings = this.getSettings(); + constructor(metadata) { + super(metadata); + } enable() { const EXTENSIONDIR = this.path; const interfaceBinary = GLib.file_get_contents(`${EXTENSIONDIR}/schemas/io.github.martin31821.cpupower.dbus.xml`)[1]; diff --git a/src/indicator.js b/src/indicator.js index 57391c7d..fd2aa021 100644 --- a/src/indicator.js +++ b/src/indicator.js @@ -32,14 +32,10 @@ import St from 'gi://St'; import UPower from 'gi://UPowerGlib'; import Gio from 'gi://Gio'; -const Mainloop = imports.mainloop; - 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'; import * as Config from 'resource:///org/gnome/shell/misc/config.js'; -import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; - import Gettext from 'gettext'; const _ = Gettext.domain('gnome-shell-extension-cpupower'); diff --git a/src/utils.js b/src/utils.js index 5a303207..279813d9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -26,16 +26,14 @@ * */ -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; -const ByteArray = imports.byteArray; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const EXTENSIONDIR = Me.dir.get_path(); -const INSTALLER = `${EXTENSIONDIR}/tool/installer.sh`; + +//const EXTENSIONDIR = Me.dir.get_path(); +const INSTALLER = GLib.uri_resolve_relative(import.meta.url, '/tool/installer.sh', GLib.UriFlags.NONE)); const PKEXEC = GLib.find_program_in_path("pkexec"); -const CONFIG = Me.imports.src.config; +import { CONFIG } from "./src/config.js" // FIXME: I don't know how to call linux's getuid directly... /* exported getuid */ From a55c098897729e25fe3e27611c1b2ceccc564d9d Mon Sep 17 00:00:00 2001 From: Gil Vicente Bernardo Pinto Date: Wed, 20 Sep 2023 18:24:03 -0300 Subject: [PATCH 8/8] migrate import to ESM --- src/barLevel2.js | 8 ++++++-- src/prefs40/misc.js | 4 +++- src/slider2.js | 12 +++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/barLevel2.js b/src/barLevel2.js index a8f5dabd..3a58bb59 100644 --- a/src/barLevel2.js +++ b/src/barLevel2.js @@ -8,8 +8,12 @@ * See for details. */ -const {Atk, Clutter, GObject, St} = imports.gi; -const Config = imports.misc.config; +import Clutter from 'gi://Clutter'; +import Atk from 'gi://Atk'; +import St from 'gi://St'; +import GObject from 'gi://GObject'; + +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; /* exported BarLevel2 */ var BarLevel2 = GObject.registerClass({ diff --git a/src/prefs40/misc.js b/src/prefs40/misc.js index 896019e6..26cad921 100644 --- a/src/prefs40/misc.js +++ b/src/prefs40/misc.js @@ -1,4 +1,6 @@ -const Gio = imports.gi.Gio; +import Gio from 'gi://Gio'; + + /* exported extensionUtils */ var extensionUtils = { diff --git a/src/slider2.js b/src/slider2.js index 645f73df..80c1bc9e 100644 --- a/src/slider2.js +++ b/src/slider2.js @@ -8,14 +8,16 @@ * See for details. */ -const {Atk, Clutter, GObject} = imports.gi; -const ExtensionUtils = imports.misc.extensionUtils; -const Config = imports.misc.config; +import Clutter from 'gi://Clutter'; +import Atk from 'gi://Atk'; +import St from 'gi://St'; +import GObject from 'gi://GObject'; -const Me = ExtensionUtils.getCurrentExtension(); -const BarLevel2 = Me.imports.src.barLevel2; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; + +import { barLevel2 } from "./src/barLevel2.js" /* exported Slider2 */ var Slider2 = GObject.registerClass({ GTypeName: "Slider2",