gnome-shell/js/ui/init.js
Evan Welsh 9a2c3da868 environment: Port environment.js to be an ES module
Removes the init() function in favor of executing all environment
changes when the file is imported.

Additionally ports all unit tests using imports.gi.environment.init() to
use the updated module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00

23 lines
652 B
JavaScript

import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
import './environment.js';
// Run the Mutter main loop after
// GJS finishes resolving this module.
imports._promiseNative.setMainLoopHook(() => {
// Queue starting the shell
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
imports.ui.main.start().catch(e => {
const error = new GLib.Error(
Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED,
e.message);
global.context.terminate_with_error(error);
});
return GLib.SOURCE_REMOVE;
});
// Run the meta context's main loop
global.context.run_main_loop();
});