♻️ Use utility method to import module in Shell process only
This commit is contained in:
@@ -165,11 +165,11 @@ void main() {
|
||||
|
||||
"use strict";
|
||||
|
||||
const GObject = imports.gi.GObject;
|
||||
|
||||
const _ = imports.gettext.domain("burn-my-windows").gettext;
|
||||
|
||||
import { ShaderFactory } from "../ShaderFactory.js";
|
||||
import * as utils from "../utils.js";
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly("./ShaderFactory.js");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect ... //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect hides the actor by violently sucking it into the void of magic. //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect shatters the window into pieces. For an explanation how this works, look //
|
||||
|
||||
+3
-2
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect melts your windows. Inspired by the legendary screen transitions of the //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect looks a bit like the transporter effect from TOS. //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect looks a bit like the transporter effect from TNG. //
|
||||
|
||||
+3
-2
@@ -18,8 +18,9 @@ import Gio from 'gi://Gio';
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect is a homage to the good old Compiz days. However, it is implemented //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This very simple effect fades the window to transparency with subtle 3D effects. //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect applies some intentional graphics issues to your windows. //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect overlays a glowing hexagonal grid over the window. The grid cells then //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect burns windows to ashes. The fire starts at a random position at the //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The Matrix shader multiplies a grid of random letters with some gradients which are //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect paints your windows with a thick paint brush. //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This simple effect pixelates the window texture and hides the pixels in a wheel-like //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect pixelates the window texture and hides the pixels radially, starting //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This very simple effect pixelates the window texture and randomly hides pixels until //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This ridiculous effect teleports your windows from and to alternative dimensions. //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effects dissolves your windows into a cloud of dust. For this, it uses an //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect tears your windows apart with a series of violent scratches! //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect hides the actor by making it first transparent from top and bottom //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect combines the Glitch and the TV Effect. Credits go to Kurt Wilson //
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
const _ = imports.gettext.domain('burn-my-windows').gettext;
|
||||
|
||||
const ShaderFactory =
|
||||
typeof global !== 'undefined' ? (await import('../ShaderFactory.js'))?.default : null;
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This effect lets your windows be carried to the realm of dreams by some little //
|
||||
|
||||
@@ -35,6 +35,16 @@ export function debug(message) {
|
||||
console.log('[' + stack[0].slice(extensionRoot) + '] ' + message);
|
||||
}
|
||||
|
||||
// This method can be used to import a module in the GNOME Shell process only. This
|
||||
// is useful if you want to use a module in extension.js, but not in the preferences
|
||||
// process. This method returns null if it is called in the preferences process.
|
||||
export async function importInShellOnly(module) {
|
||||
if (typeof global !== 'undefined') {
|
||||
return (await import(module)).default;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Reads the contents of a file contained in the global resources archive. The data
|
||||
// is returned as a string.
|
||||
export function getStringResource(path) {
|
||||
|
||||
Reference in New Issue
Block a user