js: Port to ESM

The shell pulled the trigger and switched to ESM for all its
imports, follow suit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/269>
This commit is contained in:
Florian Müllner
2023-07-14 02:07:41 +02:00
parent 2d3307c657
commit a911447375
15 changed files with 48 additions and 52 deletions
+5 -5
View File
@@ -9,14 +9,14 @@ import Gtk from 'gi://Gtk';
import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import St from 'gi://St';
const {EventEmitter} = imports.misc.signals;
import {EventEmitter} from 'resource:///org/gnome/shell/misc/signals.js';
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
const appSys = Shell.AppSystem.get_default();
+1 -2
View File
@@ -4,8 +4,7 @@
import Shell from 'gi://Shell';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
class WindowMover {
constructor(settings) {
+4 -4
View File
@@ -7,10 +7,10 @@ import St from 'gi://St';
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const ShellMountOperation = imports.ui.shellMountOperation;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import * as ShellMountOperation from 'resource:///org/gnome/shell/ui/shellMountOperation.js';
Gio._promisify(Gio.File.prototype, 'query_filesystem_info_async');
+1 -2
View File
@@ -1,7 +1,6 @@
import {AppIcon} from 'resource:///org/gnome/shell/ui/appDisplay.js';
import {InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
const {AppIcon} = imports.ui.appDisplay;
export default class Extension {
constructor() {
this._injectionManager = new InjectionManager();
+1 -1
View File
@@ -17,7 +17,7 @@
import St from 'gi://St';
const Main = imports.ui.main;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
export default class Extension {
_updateColorScheme(scheme) {
@@ -3,9 +3,9 @@ import Clutter from 'gi://Clutter';
import {Extension, InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
const {WindowPreview} = imports.ui.windowPreview;
const Workspace = imports.ui.workspace;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {WindowPreview} from 'resource:///org/gnome/shell/ui/windowPreview.js';
import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js';
// testing settings for natural window placement strategy:
const WINDOW_PLACEMENT_NATURAL_ACCURACY = 20; // accuracy of window translate moves (KDE-default: 20)
+3 -3
View File
@@ -5,9 +5,9 @@ import St from 'gi://St';
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import {PlacesManager} from './placeDisplay.js';
+3 -3
View File
@@ -2,12 +2,12 @@
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import Shell from 'gi://Shell';
const {EventEmitter} = imports.misc.signals;
import {EventEmitter} from 'resource:///org/gnome/shell/misc/signals.js';
import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
const ShellMountOperation = imports.ui.shellMountOperation;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as ShellMountOperation from 'resource:///org/gnome/shell/ui/shellMountOperation.js';
const N_ = x => x;
@@ -25,7 +25,7 @@ import St from 'gi://St';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
const MESSAGE_FADE_TIME = 2000;
+1 -1
View File
@@ -5,7 +5,7 @@ import Gio from 'gi://Gio';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {getThemeDirs, getModeThemeDirs} from './util.js';
+4 -4
View File
@@ -9,10 +9,10 @@ import St from 'gi://St';
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const Overview = imports.ui.overview;
const PopupMenu = imports.ui.popupMenu;
import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as Overview from 'resource:///org/gnome/shell/ui/overview.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import {WindowPicker, WindowPickerToggle} from './windowPicker.js';
import {WorkspaceIndicator} from './workspaceIndicator.js';
+8 -9
View File
@@ -4,18 +4,17 @@ import Shell from 'gi://Shell';
import St from 'gi://St';
import {Extension, InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
import * as Layout from 'resource:///org/gnome/shell/ui/layout.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {WorkspacesDisplay} from 'resource:///org/gnome/shell/ui/workspacesView.js';
import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js';
const Layout = imports.ui.layout;
const Main = imports.ui.main;
const {WorkspacesDisplay} = imports.ui.workspacesView;
const Workspace = imports.ui.workspace;
const {VIGNETTE_BRIGHTNESS} = imports.ui.lightbox;
const {
import {VIGNETTE_BRIGHTNESS} from 'resource:///org/gnome/shell/ui/lightbox.js';
import {
SIDE_CONTROLS_ANIMATION_TIME,
OverviewAdjustment,
ControlsState,
} = imports.ui.overviewControls;
ControlsState
} from 'resource:///org/gnome/shell/ui/overviewControls.js';
class MyWorkspacesDisplay extends WorkspacesDisplay {
static {
+4 -4
View File
@@ -6,10 +6,10 @@ import St from 'gi://St';
import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
const TOOLTIP_OFFSET = 6;
const TOOLTIP_ANIMATION_TIME = 150;
+5 -6
View File
@@ -3,13 +3,12 @@ import Clutter from 'gi://Clutter';
import Graphene from 'gi://Graphene';
import St from 'gi://St';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as OverviewControls from 'resource:///org/gnome/shell/ui/overviewControls.js';
import {InjectionManager} from 'resource:///org/gnome/shell/extensions/extension.js';
const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls;
const {WindowPreview} = imports.ui.windowPreview;
const {Workspace} = imports.ui.workspace;
const {WorkspacesView} = imports.ui.workspacesView;
import {WindowPreview} from 'resource:///org/gnome/shell/ui/windowPreview.js';
import {Workspace} from 'resource:///org/gnome/shell/ui/workspace.js';
import {WorkspacesView} from 'resource:///org/gnome/shell/ui/workspacesView.js';
const WINDOW_SLOT = 4;
+4 -4
View File
@@ -7,10 +7,10 @@ import St from 'gi://St';
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';
const WORKSPACE_KEY = 'workspace-names';