Breaking: Migrate extension to the new ESM system of GNOME 45

Migrate with the help of, among others, the following resources:
https://blogs.gnome.org/shell-dev/2023/09/02/extensions-in-gnome-45/
https://gjs.guide/extensions/upgrading/gnome-shell-45.html

Only support GNOME Shell version 45, since only 45 is compatible with
the new ESM system.

Since panel._originalAddToPanelBox is no longer valid, just overwrite
using the prototype on disable.

Add "sourceType": "module" to eslintrc.yml to get rid of:
"Parsing error: 'import' and 'export' may appear only with 'sourceType:
module'"
See here:
https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options
This commit is contained in:
June 2023-10-02 03:56:48 +02:00
commit a1188d5684
No known key found for this signature in database
GPG key ID: 094C2AC34192FA11
10 changed files with 85 additions and 102 deletions

View file

@ -1,11 +1,8 @@
"use strict";
/* exported BoxOrderManager */
const GObject = imports.gi.GObject;
import GObject from "gi://GObject";
const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main;
import * as Main from "resource:///org/gnome/shell/ui/main.js";
/**
* This class provides methods get, set and interact with box orders, while
@ -13,7 +10,7 @@ const Main = imports.ui.main;
* what is really useable by the other extension code.
* It's basically a heavy wrapper around the box orders stored in the settings.
*/
var BoxOrderManager = GObject.registerClass({
const BoxOrderManager = GObject.registerClass({
Signals: {
"appIndicatorReady": {}
}
@ -22,13 +19,13 @@ var BoxOrderManager = GObject.registerClass({
#appIndicatorItemApplicationRoleMap;
#settings;
constructor(params = {}) {
constructor(params = {}, settings) {
super(params);
this.#appIndicatorReadyHandlerIdMap = new Map();
this.#appIndicatorItemApplicationRoleMap = new Map();
this.#settings = ExtensionUtils.getSettings();
this.#settings = settings;
}
/**
@ -271,3 +268,5 @@ var BoxOrderManager = GObject.registerClass({
saveBoxOrderToSettings(boxOrders.right, "right");
}
});
export default BoxOrderManager;