diff options
| author | AlexanderCurl <alexc@alexc.hu> | 2026-04-18 17:46:06 +0100 |
|---|---|---|
| committer | AlexanderCurl <alexc@alexc.hu> | 2026-04-18 17:46:06 +0100 |
| commit | 70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch) | |
| tree | ab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/conveniences/utils.js | |
| parent | 5d94c0a7d44a2255b81815a52a7056a94a39842d (diff) | |
| download | RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip | |
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/conveniences/utils.js')
| -rw-r--r-- | raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/conveniences/utils.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/conveniences/utils.js b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/conveniences/utils.js new file mode 100644 index 0000000..0277e0e --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/conveniences/utils.js @@ -0,0 +1,38 @@ +import GLib from 'gi://GLib'; + +export const IS_IN_PREFERENCES = typeof global === 'undefined'; + +// Taken from https://github.com/Schneegans/Burn-My-Windows/blob/main/src/utils.js +// 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 import_in_shell_only(module) { + if (IS_IN_PREFERENCES) + return null; + return (await import(module)).default; +} + +// In use for the effects, to prevent boilerplate code +export function setup_params(outer_this, params) { + // setup each parameter, either with the given or the default value + for (const params_name in outer_this.constructor.default_params) { + outer_this["_" + params_name] = null; + outer_this[params_name] = params_name in params ? + params[params_name] : + outer_this.constructor.default_params[params_name]; + } +}; + +export const get_shader_source = (Shell, shader_filename, self_uri) => { + if (!Shell) + return; + const shader_path = GLib.filename_from_uri( + GLib.uri_resolve_relative(self_uri, shader_filename, GLib.UriFlags.NONE) + )[0]; + try { + return Shell.get_file_contents_utf8_sync(shader_path); + } catch (e) { + console.warn(`[Blur my Shell > effect] error loading shader from ${shader_path}: ${e}`); + return null; + } +};
\ No newline at end of file |