diff options
Diffstat (limited to 'raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com')
32 files changed, 4421 insertions, 0 deletions
diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/ProfileManager.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/ProfileManager.js new file mode 100644 index 0000000..91233be --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/ProfileManager.js @@ -0,0 +1,186 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; + +////////////////////////////////////////////////////////////////////////////////////////// +// Burn-My-Windows allows applying different sets of effect settings under specific // +// circumstances. These settings are called "effect profiles". The ProfileManager // +// provides access to all currently configured effect profiles. It can be used in both // +// the settings dialog and the in the actual extension. // +// The profiles are stored in ~/.config/burn-my-windows/profiles and can be accessed // +// via Gio.Settings objects. // +////////////////////////////////////////////////////////////////////////////////////////// + +export class ProfileManager { + // ------------------------------------------------------------------------- constructor + + constructor(metadata) { + this._metadata = metadata; + + this._makeProfilesDir(); + this.reloadProfiles(); + } + + // -------------------------------------------------------------------- public interface + + // Returns an array of effect profiles. Each effect profile is an object with two + // properties: The 'path' points to the file which contains the effect profile + // settings (located in ~/.config/burn-my-windows/profiles). The 'settings' property + // contains a Gio.Settings object for the profile. The former can be used to uniquely + // identify the profile, the latter can be used to access the profile's settings. This + // method will always return at least one profile. If none is configured, a default + // profile will be created. + getProfiles() { + if (this._profiles.length == 0) { + this.createProfile(); + } + + return this._profiles; + } + + // This will create a new profile. If no content is given, all values will be + // initialized to their defaults. The method will return an effect profile object (as + // described above). We will use the current system time in microseconds as profile + // name. This ensures that they are always sorted according to their creation date. + createProfile(content = '') { + const path = `${GLib.get_user_config_dir()}/burn-my-windows/profiles/${ + GLib.get_real_time()}.conf`; + const file = Gio.File.new_for_path(path); + file.create(Gio.FileCreateFlags.NONE, null); + + if (content != '') { + file.replace_contents(content, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, + null); + } + + const profile = {'path': path, 'settings': this._getProfileSettings(path)}; + + // Add the profile to our internal list of profiles. + this._profiles.push(profile); + + return profile; + } + + // Removes a profile defined by its file path. This will actually remove the file from + // the disk, so there's no going back. + deleteProfile(profilePath) { + const profileDir = `${GLib.get_user_config_dir()}/burn-my-windows/profiles`; + const file = Gio.File.new_for_path(profilePath); + if (file.has_prefix(Gio.File.new_for_path(profileDir)) && file.query_exists(null)) { + file.delete(null); + } + + // Remove the profile from our internal list of profiles. + this._profiles = this._profiles.filter(p => p.path != profilePath); + } + + // Reloads all profiles from ~/.config/burn-my-windows/profiles. If you called the + // createProfile() and deleteProfile() methods above, there is no need to reload the + // profiles. + reloadProfiles() { + const dir = + Gio.File.new_for_path(GLib.get_user_config_dir() + '/burn-my-windows/profiles'); + + const files = + dir.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, null); + + let profilePaths = []; + + while (true) { + const presetInfo = files.next_file(null); + + if (presetInfo == null) { + break; + } + + if (presetInfo.get_file_type() == Gio.FileType.REGULAR) { + const suffixPos = presetInfo.get_display_name().indexOf('.conf'); + if (suffixPos > 0) { + profilePaths.push(dir.get_child(presetInfo.get_name()).get_path()); + } + } + } + + // Sort profiles alphabetically, that is by their creation time. + profilePaths.sort(); + + this._profiles = []; + + profilePaths.forEach(path => { + this._profiles.push({'path': path, 'settings': this._getProfileSettings(path)}); + }); + } + + // Each profile has a priority. It is higher, the more specific it is. + getProfilePriority(settings) { + let priority = 0; + + // If an application is specified, we increase the priority quite a lot. This makes + // sure that per-application overrides are used in most cases. + if (settings.get_string('profile-app') != '') priority += 10; + + // Each other setting which is not set to its default value increases the priority by + // one. + if (settings.get_int('profile-animation-type') > 0) ++priority; + if (settings.get_int('profile-window-type') > 0) ++priority; + if (settings.get_int('profile-color-scheme') > 0) ++priority; + if (settings.get_int('profile-power-mode') > 0) ++priority; + if (settings.get_int('profile-power-profile') > 0) ++priority; + + // Increase the priority significantly for high-priority profiles. + if (settings.get_boolean('profile-high-priority')) priority += 100; + + return priority; + } + + // ----------------------------------------------------------------------- private stuff + + // Creates the directory ~/.config/burn-my-windows/profiles if it does not yet exist. + _makeProfilesDir() { + const path = `${GLib.get_user_config_dir()}/burn-my-windows/profiles`; + const dir = Gio.File.new_for_path(path); + + if (!dir.query_exists(null)) { + dir.make_directory_with_parents(null); + } + } + + // Creates a Gio.Settings object for the given effect profile path. Based on + // https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/misc/extensionUtils.js#L213 + _getProfileSettings(profilePath) { + + // Expect USER extensions to have a schemas/ subfolder, otherwise assume a + // SYSTEM extension that has been installed in the same prefix as the shell + const schemaDir = this._metadata.dir.get_child('schemas'); + let source; + if (schemaDir.query_exists(null)) { + source = Gio.SettingsSchemaSource.new_from_directory( + schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false); + } else { + source = Gio.SettingsSchemaSource.get_default(); + } + + const schema = + source.lookup('org.gnome.shell.extensions.burn-my-windows-profile', true); + + const backend = + Gio.keyfile_settings_backend_new(profilePath, '/org/gnome/shell/extensions/', null); + + return new Gio.Settings({settings_schema: schema, backend: backend}); + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/Shader.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/Shader.js new file mode 100644 index 0000000..b7a6377 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/Shader.js @@ -0,0 +1,231 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import Gio from 'gi://Gio'; +import Shell from 'gi://Shell'; +import Cogl from 'gi://Cogl'; +import GObject from 'gi://GObject'; +import Clutter from 'gi://Clutter'; +import Meta from 'gi://Meta'; + +import * as utils from './utils.js'; + +////////////////////////////////////////////////////////////////////////////////////////// +// This is the base class for all shaders of Burn-My-Windows. It automagically loads // +// the shader's source code from the resource file resources/shaders/<nick>.glsl and // +// ensures that some standard uniforms are always updated. // +// Using Shell.GLSLEffect as a base class has some benefits and some drawbacks. The // +// main benefit when compared to Clutter.ShaderEffect is that setting uniforms of types // +// vec2, vec3 or vec4 is supported via the API (with Clutter.ShaderEffect the GJS // +// binding does not work properly). However, there are two drawbacks: On the one hand, // +// the shader source code is cached statically - this means if we want to have a // +// different shader, we have to derive a new class. Therefore, each effect has to // +// derive its own class from the class below. This is encapsulated in the // +// ShaderFactory, however it is some really awkward code. The other drawback is the // +// hard-coded use of straight alpha (as opposed to premultiplied). This makes the // +// shaders a bit more complicated than required. // +// // +// The Shader fires three signals: // +// * begin-animation: This is called each time a new animation is started. It can // +// be used to set uniform values which do not change during the // +// animation. // +// * update-animation: This is called at each frame during the animation. It can be // +// used to set uniforms which change during the animation. // +// * end-animation: This is called when the animation is stopped. This can be // +// used to clean up any resources. +////////////////////////////////////////////////////////////////////////////////////////// + +export var Shader = GObject.registerClass({ + Signals: { + 'begin-animation': { + param_types: [ + Gio.Settings.$gtype, GObject.TYPE_BOOLEAN, GObject.TYPE_BOOLEAN, + Clutter.Actor.$gtype + ] + }, + 'update-animation': {param_types: [GObject.TYPE_DOUBLE]}, + 'end-animation': {} + } +}, + + class Shader extends Shell.GLSLEffect { + // -------------------------------------------- + // The constructor automagically loads the shader's source code (in + // vfunc_build_pipeline()) from the resource file resources/shaders/<nick>.glsl + // resolving any #includes in this file. + _init(nick) { + this._nick = nick; + + // This will call vfunc_build_pipeline(). + super._init(); + + // These will be updated during the animation. + this._progress = 0; + this._time = 0; + + // Store standard uniform locations. + this._uForOpening = this.get_uniform_location('uForOpening'); + this._uIsFullscreen = this.get_uniform_location('uIsFullscreen'); + this._uProgress = this.get_uniform_location('uProgress'); + this._uDuration = this.get_uniform_location('uDuration'); + this._uSize = this.get_uniform_location('uSize'); + this._uPadding = this.get_uniform_location('uPadding'); + + // Create a timeline to drive the animation. + this._timeline = new Clutter.Timeline(); + + // Call updateAnimation() once a frame. + this._timeline.connect('new-frame', (t) => { + if (this._testMode) { + this.updateAnimation(0.5); + } else { + this.updateAnimation(t.get_progress()); + } + }); + + // Clean up if the animation finished or was interrupted. + this._timeline.connect('stopped', (t, finished) => { + this.endAnimation(); + }); + } + + // This is called once each time the shader is used. + beginAnimation(settings, forOpening, testMode, duration, actor) { + if (this._timeline.is_playing()) { + this._timeline.stop(); + } + + // On GNOME 3.36 this method was not yet available. + if (this._timeline.set_actor) { + this._timeline.set_actor(actor); + } + + this._timeline.set_duration(duration); + this._timeline.start(); + + // Make sure that no fullscreen window is drawn over our animations. Since GNOME 48 + // this is a "global" method. + if (Meta.disable_unredirect_for_display) { + Meta.disable_unredirect_for_display(global.display); + } else { + global.compositor.disable_unredirect(); + } + + global.begin_work(); + + // Reset progress value. + this._progress = 0; + this._testMode = testMode; + + // This is not necessarily symmetric, but I haven't figured out a way to + // get the actual values... + const padding = (actor.width - actor.meta_window.get_frame_rect().width) / 2; + let isFullscreen = actor.meta_window.fullscreen; + + // is_maximized has been added in GNOME 49. + if (actor.meta_window.is_maximized) { + isFullscreen |= actor.meta_window.is_maximized(); + } else { + isFullscreen |= actor.meta_window.get_maximized() === Meta.MaximizeFlags.BOTH; + } + + this.set_uniform_float(this._uPadding, 1, [padding]); + this.set_uniform_float(this._uForOpening, 1, [forOpening]); + this.set_uniform_float(this._uIsFullscreen, 1, [isFullscreen]); + this.set_uniform_float(this._uDuration, 1, [duration * 0.001]); + this.set_uniform_float(this._uSize, 2, [actor.width, actor.height]); + + this.emit('begin-animation', settings, forOpening, testMode, actor); + } + + // This is called at each frame during the animation. + updateAnimation(progress) { + // Store the current progress value. The corresponding signal is emitted each frame + // in vfunc_paint_target. We do not emit it here, as the pipeline which may be used + // by handlers must not have been created yet. + this._progress = progress; + + this.queue_repaint(); + } + + // This will stop any running animation and emit the end-animation signal. + endAnimation() { + // This will call endAnimation() again, so we can return for now. + if (this._timeline.is_playing()) { + this._timeline.stop(); + return; + } + + // Restore unredirecting behavior for fullscreen windows. Since GNOME 48 this is a + // "global" method. + if (Meta.disable_unredirect_for_display) { + Meta.enable_unredirect_for_display(global.display); + } else { + global.compositor.enable_unredirect(); + } + global.end_work(); + + this.emit('end-animation'); + } + + // This is called by the constructor. This means, it's only called when the + // effect is used for the first time. + vfunc_build_pipeline() { + // Shell.GLSLEffect requires the declarations and the main source code as separate + // strings. As it's more convenient to store the in one GLSL file, we use a regex + // here to split the source code in two parts. + const code = this._loadShaderResource(`/shaders/${this._nick}.frag`); + + // Match anything between the curly brackets of "void main() {...}". + const regex = RegExp('void main *\\(\\) *\\{([\\S\\s]+)\\}'); + const match = regex.exec(code); + + const declarations = code.substr(0, match.index); + const main = match[1]; + + this.add_glsl_snippet( + Cogl.SnippetHook ? Cogl.SnippetHook.FRAGMENT : Shell.SnippetHook.FRAGMENT, + declarations, main, true); + } + + // We use this vfunc to trigger the update as it allows calling this.get_pipeline() in + // the handler. This could still be null if called from the updateAnimation() above. + vfunc_paint_target(...params) { + this.emit('update-animation', this._progress); + + // Starting with GNOME 44.2, the alpha channel is not written to by default. We need + // to undo this. It is a pity that we have to do this here, as it is not really + // required to be done each frame. But it's the only place where we can do it. + // https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2650 + this.get_pipeline().set_blend( + 'RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))'); + + this.set_uniform_float(this._uProgress, 1, [this._progress]); + super.vfunc_paint_target(...params); + } + + // --------------------------------------------------------------------- private stuff + + // This loads a GLSL file from the extension's resources to a JavaScript string. The + // code from "common.glsl" is prepended automatically. + _loadShaderResource(path) { + let common = utils.getStringResource('/shaders/common.glsl'); + let code = utils.getStringResource(path); + + // Add a trailing newline. Else the GLSL compiler complains... + return common + '\n' + code + '\n'; + } +}); diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/ShaderFactory.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/ShaderFactory.js new file mode 100644 index 0000000..6056262 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/ShaderFactory.js @@ -0,0 +1,94 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import GObject from 'gi://GObject'; + +import {Shader} from './Shader.js'; + +////////////////////////////////////////////////////////////////////////////////////////// +// Each effect of Burn-My-Windows owns an instance of this class. It is used to create // +// shaders whenever a new one is required. It tries to re-use old shaders as much as // +// possible in order to avoid memory leaks. // +////////////////////////////////////////////////////////////////////////////////////////// + +export default class ShaderFactory { + + // Creates a new ShaderFactory. Requires the nick of the effect and a callback function + // which will be called whenever a new shader is created. + constructor(nick, setupFunc) { + // The _freeShaders array contains previously created shaders which are not currently + // in use. + this._freeShaders = []; + + // The nick of the effect is required when creating new shaders as it's part of the + // GLSL source code file name. + this._nick = nick; + + // Store the setup callback. + this._setupFunc = setupFunc; + } + + // ---------------------------------------------------------------- API for extension.js + + // This is called from extension.js whenever a window is opened or closed. It returns an + // instance of the shader class, trying to reuse previously created shaders. If a new + // shader instance is required, it calls creates a new one and calls the setupFunc + // thereafter. + getShader() { + let shader; + + // If there are currently no free shaders, we have to create a new one. + if (this._freeShaders.length == 0) { + + // Since Shell.GLSLEffect caches the shader source per class (not per instance), we + // have to derive a new shader type for each effect. The type name contains the nick + // of the effect to make it unique. + const typeName = `BurnMyWindowsShader_${this._nick}`; + + // Only try to register the new type once. + if (GObject.type_from_name(typeName) == null) { + const outerThis = this; + GObject.registerClass({GTypeName: typeName}, class ShaderImp extends Shader { + // This will actually load the GLSL source code from the resources. + _init() { + super._init(outerThis._nick); + } + + // This can be called to mark this instance to be re-usable. + returnToFactory() { + outerThis._freeShaders.push(this); + } + }); + } + + // Now create a niew instance of the newly registered shader type. + // GObject.Object.new is only available with newer versions of GJS. + if (GObject.Object.new) { + shader = GObject.Object.new(GObject.type_from_name(typeName), {}); + } else { + shader = GObject.Object.newv(GObject.type_from_name(typeName), []); + } + + // Call the provided setup callback. + this._setupFunc(shader); + + } else { + shader = this._freeShaders.pop(); + } + + return shader; + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/WindowPicker.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/WindowPicker.js new file mode 100644 index 0000000..0f9b8d3 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/WindowPicker.js @@ -0,0 +1,93 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-FileCopyrightText: Aurélien Hamy <aunetx@yandex.com> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; + +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as LookingGlass from 'resource:///org/gnome/shell/ui/lookingGlass.js'; + +import * as utils from './utils.js'; + +////////////////////////////////////////////////////////////////////////////////////////// +// This is based on the window-picking functionality of the Blur-My-Shell extension. // +// The PickWindow() method is exposed via the D-Bus and can be called by the // +// preferences dialog of the Burn-My-Windows extensions in order to initiate the window // +// picking. // +////////////////////////////////////////////////////////////////////////////////////////// + +export class WindowPicker { + // ------------------------------------------------------------------------- constructor + + constructor() { + const iFace = utils.getStringResource( + '/interfaces/org.gnome.shell.extensions.burn-my-windows.xml'); + this._dbus = Gio.DBusExportedObject.wrapJSObject(iFace, this); + } + + // --------------------------------------------------------------------- D-Bus interface + + // This method is exposed via the D-Bus. It is called by the preferences dialog of the + // Burn-My-Windows extensions in order to initiate the window picking. + PickWindow() { + + // We use the actor picking from LookingGlass. This seems a bit hacky and also allows + // selecting things of the Shell which are not windows, but it does the trick :) + const lookingGlass = Main.createLookingGlass(); + lookingGlass.open(); + lookingGlass.hide(); + + const inspector = new LookingGlass.Inspector(Main.createLookingGlass()); + inspector.connect('target', (me, target, x, y) => { + // Remove border effect when window is picked. + target.get_effects() + .filter(e => e.toString().includes('lookingGlass_RedBorderEffect')) + .forEach(e => target.remove_effect(e)); + + if (target.toString().includes('MetaSurfaceActor')) { + target = target.get_parent(); + } + + if (target.toString().includes('ContainerActor')) { + target = target.get_parent(); + } + + let wmClass = 'window-not-found'; + if (target.toString().includes('WindowActor') && + target.meta_window.get_wm_class() != '') { + wmClass = target.meta_window.get_wm_class(); + } + + this._dbus.emit_signal('WindowPicked', new GLib.Variant('(s)', [wmClass])); + }); + + // Close LookingGlass when we're done. + inspector.connect('closed', _ => lookingGlass.close()); + } + + // -------------------------------------------------------------------- public interface + + // Call this to make the window-picking API available on the D-Bus. + export() { + this._dbus.export(Gio.DBus.session, '/org/gnome/shell/extensions/BurnMyWindows'); + } + + // Call this to stop this D-Bus again. + unexport() { + this._dbus.unexport(); + } +}; diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Apparition.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Apparition.js new file mode 100644 index 0000000..f770e71 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Apparition.js @@ -0,0 +1,103 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect hides the actor by violently sucking it into the void of magic. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uShake = shader.get_uniform_location('uShake'); + shader._uTwirl = shader.get_uniform_location('uTwirl'); + shader._uSuction = shader.get_uniform_location('uSuction'); + shader._uRandomness = shader.get_uniform_location('uRandomness'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uShake, 1, [settings.get_double('apparition-shake-intensity')]); + shader.set_uniform_float(shader._uTwirl, 1, [settings.get_double('apparition-twirl-intensity')]); + shader.set_uniform_float(shader._uSuction, 1, [settings.get_double('apparition-suction-intensity')]); + shader.set_uniform_float(shader._uRandomness, 1, [settings.get_double('apparition-randomness')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is not available on GNOME Shell 3.36 as it requires scaling of the window + // actor. + static getMinShellVersion() { + return [3, 38]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'apparition'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Apparition'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('apparition-randomness'); + dialog.bindAdjustment('apparition-animation-time'); + dialog.bindAdjustment('apparition-twirl-intensity'); + dialog.bindAdjustment('apparition-shake-intensity'); + dialog.bindAdjustment('apparition-suction-intensity'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 2.0, y: 2.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/AuraGlow.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/AuraGlow.js new file mode 100644 index 0000000..dd89e04 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/AuraGlow.js @@ -0,0 +1,163 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Justin Garza <JGarza9788@gmail.com> +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +// We import Gtk for the color preview in the preferences dialog. This is only available +// and required in the preferences process. +const Gtk = await utils.importInPrefsOnly('gi://Gtk'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect was inspired by apple's new siri effect. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSpeed = shader.get_uniform_location('uSpeed'); + shader._uRandomColor = shader.get_uniform_location('uRandomColor'); + shader._uStartHue = shader.get_uniform_location('uStartHue'); + shader._uSaturation = shader.get_uniform_location('uSaturation'); + shader._uEdgeSize = shader.get_uniform_location('uEdgeSize'); + shader._uEdgeHardness = shader.get_uniform_location('uEdgeHardness'); + shader._uBlur = shader.get_uniform_location('uBlur'); + shader._uSeed = shader.get_uniform_location('uSeed'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uSpeed, 1, [settings.get_double('aura-glow-speed')]); + shader.set_uniform_float(shader._uRandomColor, 1, [settings.get_boolean('aura-glow-random-color')]); + shader.set_uniform_float(shader._uStartHue, 1, [settings.get_double('aura-glow-start-hue')]); + shader.set_uniform_float(shader._uSaturation, 1, [settings.get_double('aura-glow-saturation')]); + shader.set_uniform_float(shader._uEdgeSize, 1, [settings.get_double('aura-glow-edge-size')]); + shader.set_uniform_float(shader._uEdgeHardness, 1, [settings.get_double('aura-glow-edge-hardness')]); + shader.set_uniform_float(shader._uBlur, 1, [settings.get_double('aura-glow-blur')]); + shader.set_uniform_float(shader._uSeed, 2, [Math.random(), Math.random()]); + // clang-format on + }); + }); + } + + + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be + // named likes this. + static getNick() { + return 'aura-glow'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Aura Glow'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('aura-glow-animation-time'); + dialog.bindAdjustment('aura-glow-speed'); + dialog.bindSwitch('aura-glow-random-color'); + dialog.bindAdjustment('aura-glow-start-hue'); + dialog.bindAdjustment('aura-glow-saturation'); + dialog.bindAdjustment('aura-glow-edge-size'); + dialog.bindAdjustment('aura-glow-edge-hardness'); + dialog.bindAdjustment('aura-glow-blur'); + + dialog.getBuilder() + .get_object('aura-glow-hue-preview') + .set_draw_func((area, cairo) => { + const hueScale = dialog.getBuilder().get_object('aura-glow-start-hue-slider'); + const satScale = dialog.getBuilder().get_object('aura-glow-saturation-slider'); + const [r, g, b] = Gtk.hsv_to_rgb(hueScale.get_value(), satScale.get_value(), 1); + const height = area.get_allocated_height(); + const width = area.get_allocated_width(); + cairo.setSourceRGB(r, g, b); + cairo.arc(width / 2, height / 2, width / 2, 0.0, 2 * Math.PI); + cairo.fill(); + }); + + function redrawHuePreview() { + dialog.getBuilder().get_object('aura-glow-hue-preview').queue_draw(); + } + + dialog.getBuilder() + .get_object('aura-glow-start-hue-slider') + .connect('value-changed', redrawHuePreview); + + dialog.getBuilder() + .get_object('aura-glow-saturation-slider') + .connect('value-changed', redrawHuePreview); + + // enable and disable the one slider + function enableDisablePref(dialog, state) { + dialog.getBuilder().get_object('aura-glow-start-hue-slider').set_sensitive(!state); + } + + const switchWidget = dialog.getBuilder().get_object('aura-glow-random-color'); + + // Connect to the "state-set" signal to update preferences dynamically based on + // the switch state. + switchWidget.connect('state-set', (widget, state) => { + enableDisablePref(dialog, state); // Update sensitivity when the state changes. + }); + + // Manually call the update function on startup, using the initial state of the + // switch. + const initialState = + switchWidget.get_active(); // Get the current state of the switch. + enableDisablePref(dialog, initialState); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/BrokenGlass.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/BrokenGlass.js new file mode 100644 index 0000000..94f7bc3 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/BrokenGlass.js @@ -0,0 +1,155 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Cogl = await utils.importInShellOnly('gi://Cogl'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect shatters the window into pieces. For an explanation how this works, look // +// further down in this file into the documentation of the Shader class. This effect is // +// not available on GNOME 3.3x, due to the limitation described in the documentation // +// of vfunc_paint_target further down in this file. // +// This shader creates a complex-looking effect with rather simple means. Here is how // +// it works: The window is drawn five times on top of each other (see the SHARD_LAYERS // +// constant in the GLSL code). Each layer only draws some of the shards, all layers // +// combined make up the entire window. The layers are then scaled, rotated, and moved // +// independently from each other - this creates the impression that all shards are // +// moving independently. In reality, there are only five groups of shards! Which shard // +// belongs to which layer is defined by the green channel of the texture // +// resources/img/shards.png. The red channel of the texture contains the distance to // +// the shard edges. This information is used to fade out the shards. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Create the texture in the first call. + if (!this._shardTexture) { + this._shardTexture = utils.getImageResource('/img/shards.png'); + } + + // Store all uniform locations. + shader._uShardTexture = shader.get_uniform_location('uShardTexture'); + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uEpicenter = shader.get_uniform_location('uEpicenter'); + shader._uShardScale = shader.get_uniform_location('uShardScale'); + shader._uBlowForce = shader.get_uniform_location('uBlowForce'); + shader._uGravity = shader.get_uniform_location('uGravity'); + + // And update all uniforms at the start of each animation. + shader.connect( + 'begin-animation', (shader, settings, forOpening, testMode, actor) => { + // Usually, the shards fly away from the center of the window. + let epicenterX = 0.5; + let epicenterY = 0.5; + + // However, if this option is set, we use the mouse pointer position. + if (!forOpening && settings.get_boolean('broken-glass-use-pointer')) { + const [x, y] = global.get_pointer(); + const [ok, localX, localY] = actor.transform_stage_point(x, y); + + if (ok) { + epicenterX = localX / actor.width; + epicenterY = localY / actor.height; + } + } + + // clang-format off + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uEpicenter, 2, [epicenterX, epicenterY]); + shader.set_uniform_float(shader._uShardScale, 1, [settings.get_double('broken-glass-scale')]); + shader.set_uniform_float(shader._uBlowForce, 1, [settings.get_double('broken-glass-blow-force')]); + shader.set_uniform_float(shader._uGravity, 1, [settings.get_double('broken-glass-gravity')]); + // clang-format on + }); + + // This is required to bind the shard texture for drawing. Sadly, this seems to be + // impossible under GNOME 3.3x as this.get_pipeline() is not available. It was + // called get_target() back then but this is not wrapped in GJS. + // https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-3-36/clutter/clutter/clutter-offscreen-effect.c#L598 + shader.connect('update-animation', (shader) => { + const pipeline = shader.get_pipeline(); + + // Use linear filtering for the window texture. + pipeline.set_layer_filters(0, Cogl.PipelineFilter.LINEAR, + Cogl.PipelineFilter.LINEAR); + + // Bind the shard texture. + pipeline.set_layer_texture(1, this._shardTexture.get_texture()); + pipeline.set_layer_wrap_mode(1, Cogl.PipelineWrapMode.REPEAT); + pipeline.set_uniform_1i(shader._uShardTexture, 1); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // This effect is only available on GNOME Shell 40+. + static getMinShellVersion() { + return [40, 0]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be + // named likes this. + static getNick() { + return 'broken-glass'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Broken Glass'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('broken-glass-animation-time'); + dialog.bindAdjustment('broken-glass-scale'); + dialog.bindAdjustment('broken-glass-gravity'); + dialog.bindAdjustment('broken-glass-blow-force'); + dialog.bindSwitch('broken-glass-use-pointer'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 2.0, y: 2.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Doom.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Doom.js new file mode 100644 index 0000000..7afa97c --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Doom.js @@ -0,0 +1,112 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect melts your windows. Inspired by the legendary screen transitions of the // +// original Doom. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uActorScale = shader.get_uniform_location('uActorScale'); + shader._uHorizontalScale = shader.get_uniform_location('uHorizontalScale'); + shader._uVerticalScale = shader.get_uniform_location('uVerticalScale'); + shader._uPixelSize = shader.get_uniform_location('uPixelSize'); + + // Write all uniform values at the start of each animation. + shader.connect( + 'begin-animation', (shader, settings, forOpening, testMode, actor) => { + // For this effect, we scale the actor vertically so that it covers the entire + // screen. This ensures that the melted window will not be cut off. + let actorScale = 2.0 * Math.max(1.0, global.stage.height / actor.height); + + // If we are currently performing integration test, nothing will be visible in + // the test images as the animation has passed the center of the window already. + // To fix this, we set the actor scale to a fixed low value when performing + // tests. + // clang-format off + shader.set_uniform_float(shader._uActorScale, 1, [testMode ? 1.0 : actorScale]); + shader.set_uniform_float(shader._uHorizontalScale, 1, [testMode ? 50.0 :settings.get_double('doom-horizontal-scale')]); + shader.set_uniform_float(shader._uVerticalScale, 1, [testMode ? 150.0 : settings.get_double('doom-vertical-scale')]); + shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('doom-pixel-size')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is not available on GNOME Shell 3.36 as it requires scaling of the window + // actor. + static getMinShellVersion() { + return [3, 38]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'doom'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Doom'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('doom-animation-time'); + dialog.bindAdjustment('doom-horizontal-scale'); + dialog.bindAdjustment('doom-vertical-scale'); + dialog.bindAdjustment('doom-pixel-size'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + // For this effect, we scale the actor vertically so that it covers the entire screen. + // This ensures that the melted window will not be cut off. + static getActorScale(settings, forOpening, actor) { + let actorScale = 2.0 * Math.max(1.0, global.stage.height / actor.height); + return {x: 1.0, y: actorScale}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/EnergizeA.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/EnergizeA.js new file mode 100644 index 0000000..3b1b84b --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/EnergizeA.js @@ -0,0 +1,95 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect looks a bit like the transporter effect from TOS. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uColor = shader.get_uniform_location('uColor'); + shader._uScale = shader.get_uniform_location('uScale'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uColor, 3, utils.parseColor(settings.get_string('energize-a-color'))); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('energize-a-scale')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'energize-a'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Energize A'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('energize-a-animation-time'); + dialog.bindAdjustment('energize-a-scale'); + dialog.bindColorButton('energize-a-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/EnergizeB.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/EnergizeB.js new file mode 100644 index 0000000..610a81c --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/EnergizeB.js @@ -0,0 +1,96 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect looks a bit like the transporter effect from TNG. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uColor = shader.get_uniform_location('uColor'); + shader._uScale = shader.get_uniform_location('uScale'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uColor, 3, utils.parseColor(settings.get_string('energize-b-color'))); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('energize-b-scale')]); + // clang-format on + }); + }); + } + + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'energize-b'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Energize B'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('energize-b-animation-time'); + dialog.bindAdjustment('energize-b-scale'); + dialog.bindColorButton('energize-b-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Fire.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Fire.js new file mode 100644 index 0000000..07f2c2d --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Fire.js @@ -0,0 +1,277 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +// modified by Justin Garza <JGarza9788@gmail.com> + +'use strict'; + +import Gio from 'gi://Gio'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect is a homage to the good old Compiz days. However, it is implemented // +// quite differently. While Compiz used a particle system, this effect uses a noise // +// shader. The noise is moved vertically over time and mapped to a configurable color // +// gradient. It is faded to transparency towards the edges of the window. In addition, // +// there are a couple of moving gradients which fade-in or fade-out the fire effect. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store all uniform locations. + shader._uGradient = [ + shader.get_uniform_location('uGradient1'), + shader.get_uniform_location('uGradient2'), + shader.get_uniform_location('uGradient3'), + shader.get_uniform_location('uGradient4'), + shader.get_uniform_location('uGradient5'), + ]; + + shader._u3DNoise = shader.get_uniform_location('u3DNoise'); + shader._uScale = shader.get_uniform_location('uScale'); + shader._uMovementSpeed = shader.get_uniform_location('uMovementSpeed'); + + shader._uRandomColor = shader.get_uniform_location('uRandomColor'); + shader._uSeed = shader.get_uniform_location('uSeed'); + + // And update all uniforms at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + for (let i = 1; i <= 5; i++) { + shader.set_uniform_float( + shader._uGradient[i - 1], 4, + utils.parseColor(settings.get_string('fire-color-' + i))); + } + + // clang-format off + shader.set_uniform_float(shader._u3DNoise, 1, [settings.get_boolean('fire-3d-noise')]); + shader.set_uniform_float(shader._uRandomColor, 1, [settings.get_boolean('fire-random-color')]); + shader.set_uniform_float(shader._uSeed, 1, [Math.random()]); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('fire-scale')]); + shader.set_uniform_float(shader._uMovementSpeed, 1, [settings.get_double('fire-movement-speed')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'fire'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Fire'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + + // Bind all properties. + dialog.bindAdjustment('fire-animation-time'); + dialog.bindAdjustment('fire-movement-speed'); + dialog.bindAdjustment('fire-scale'); + dialog.bindSwitch('fire-3d-noise'); + dialog.bindSwitch('fire-random-color'); + dialog.bindColorButton('fire-color-1'); + dialog.bindColorButton('fire-color-2'); + dialog.bindColorButton('fire-color-3'); + dialog.bindColorButton('fire-color-4'); + dialog.bindColorButton('fire-color-5'); + + // Connect the buttons only once. The bindPreferences can be called multiple times... + if (!Effect._isConnected) { + Effect._isConnected = true; + + // The fire-gradient-reset button needs to be bound explicitly. + dialog.getBuilder().get_object('reset-fire-colors').connect('clicked', () => { + dialog.getProfileSettings().reset('fire-color-1'); + dialog.getProfileSettings().reset('fire-color-2'); + dialog.getProfileSettings().reset('fire-color-3'); + dialog.getProfileSettings().reset('fire-color-4'); + dialog.getProfileSettings().reset('fire-color-5'); + }); + + // Initialize the fire-preset dropdown. + Effect._createFirePresets(dialog); + } + + // enables and disables the color buttons + function enableDisableColorButtons(dialog, state) { + + for (let i = 1; i <= 5; i++) { + dialog.getBuilder().get_object('fire-color-' + i).set_sensitive(!state); + } + } + + const switchWidget = dialog.getBuilder().get_object('fire-random-color'); + if (switchWidget) { + // Connect to the "state-set" signal to update preferences dynamically based on + // the switch state. + switchWidget.connect('state-set', (widget, state) => { + enableDisableColorButtons(dialog, + state); // Update sensitivity when the state changes. + }); + + // Manually call the update function on startup, using the initial state of the + // switch. + const initialState = + switchWidget.get_active(); // Get the current state of the switch. + enableDisableColorButtons(dialog, initialState); + } else { + // Log an error if the switch widget is not found in the UI. + log('Error: \'fire-random-color\' switch widget not found.'); + } + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } + + // ----------------------------------------------------------------------- private stuff + + // This populates the preset dropdown menu for the fire options. + static _createFirePresets(dialog) { + dialog.getBuilder().get_object('fire-prefs').connect('realize', (widget) => { + const presets = [ + { + name: _('Default Fire'), + scale: 1.0, + speed: 0.5, + color1: 'rgba(76, 51, 25, 0.0)', + color2: 'rgba(180, 55, 30, 0.7)', + color3: 'rgba(255, 76, 38, 0.9)', + color4: 'rgba(255, 166, 25, 1)', + color5: 'rgba(255, 255, 255, 1)' + }, + { + name: _('Hell Fire'), + scale: 1.5, + speed: 0.2, + color1: 'rgba(0,0,0,0)', + color2: 'rgba(103,7,80,0.5)', + color3: 'rgba(150,0,24,0.9)', + color4: 'rgb(255,200,0)', + color5: 'rgba(255, 255, 255, 1)' + }, + { + name: _('Dark and Smutty'), + scale: 1.0, + speed: 0.5, + color1: 'rgba(0,0,0,0)', + color2: 'rgba(36,3,0,0.5)', + color3: 'rgba(150,0,24,0.9)', + color4: 'rgb(255,177,21)', + color5: 'rgb(255,238,166)' + }, + { + name: _('Cold Breeze'), + scale: 1.5, + speed: -0.1, + color1: 'rgba(0,110,255,0)', + color2: 'rgba(30,111,180,0.24)', + color3: 'rgba(38,181,255,0.54)', + color4: 'rgba(34,162,255,0.84)', + color5: 'rgb(97,189,255)' + }, + { + name: _('Santa is Coming'), + scale: 0.4, + speed: -0.5, + color1: 'rgba(0,110,255,0)', + color2: 'rgba(208,233,255,0.24)', + color3: 'rgba(207,235,255,0.84)', + color4: 'rgb(208,243,255)', + color5: 'rgb(255,255,255)' + }, + // i don't think he'll notice if i sneak this in + { + name: _('Nuclear ☢️'), + scale: 1.5, + speed: 0.5, + color1: 'rgba(0,0,0,0)', + color2: 'rgba(2, 40, 0, 0.3)', + color3: 'rgba(0, 200, 50, 0.9)', + color4: 'rgba(255, 255, 0, 1.0)', + color5: 'rgba(255, 255, 255, 1.0)' + } + ]; + + const menu = Gio.Menu.new(); + const group = Gio.SimpleActionGroup.new(); + const groupName = 'fire-presets'; + + // Add all presets. + presets.forEach((preset, i) => { + const actionName = 'fire' + i; + menu.append(preset.name, groupName + '.' + actionName); + let action = Gio.SimpleAction.new(actionName, null); + + // Load the preset on activation. + action.connect('activate', () => { + dialog.getProfileSettings().set_double('fire-movement-speed', preset.speed); + dialog.getProfileSettings().set_double('fire-scale', preset.scale); + dialog.getProfileSettings().set_string('fire-color-1', preset.color1); + dialog.getProfileSettings().set_string('fire-color-2', preset.color2); + dialog.getProfileSettings().set_string('fire-color-3', preset.color3); + dialog.getProfileSettings().set_string('fire-color-4', preset.color4); + dialog.getProfileSettings().set_string('fire-color-5', preset.color5); + }); + + group.add_action(action); + }); + + dialog.getBuilder().get_object('fire-preset-button').set_menu_model(menu); + + const root = widget.get_root(); + root.insert_action_group(groupName, group); + }); + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Focus.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Focus.js new file mode 100644 index 0000000..7e18fd8 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Focus.js @@ -0,0 +1,99 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect uses a blur effect to allow the window to focus in and out of view. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uBlurAmount = shader.get_uniform_location('uBlurAmount'); + shader._uBlurQuality = shader.get_uniform_location('uBlurQuality'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + shader.set_uniform_float(shader._uBlurAmount, 1, [ + settings.get_int('focus-blur-amount'), + ]); + + shader.set_uniform_float(shader._uBlurQuality, 1, [ + settings.get_int('focus-blur-quality'), + ]); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be + // named likes this. + static getNick() { + return 'focus'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Focus'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + // These connect the settings to the UI elements. Have a look at prefs.js + // on how to bind other types of UI elements. + dialog.bindAdjustment('focus-animation-time'); + dialog.bindAdjustment('focus-blur-amount'); + dialog.bindAdjustment('focus-blur-quality'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Glide.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Glide.js new file mode 100644 index 0000000..7aee968 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Glide.js @@ -0,0 +1,101 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This very simple effect fades the window to transparency with subtle 3D effects. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uScale = shader.get_uniform_location('uScale'); + shader._uSquish = shader.get_uniform_location('uSquish'); + shader._uTilt = shader.get_uniform_location('uTilt'); + shader._uShift = shader.get_uniform_location('uShift'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('glide-scale')]); + shader.set_uniform_float(shader._uSquish, 1, [settings.get_double('glide-squish')]); + shader.set_uniform_float(shader._uTilt, 1, [settings.get_double('glide-tilt')]); + shader.set_uniform_float(shader._uShift, 1, [settings.get_double('glide-shift')]); + // clang-format on + }); + }); + } + + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'glide'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Glide'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('glide-animation-time'); + dialog.bindAdjustment('glide-scale'); + dialog.bindAdjustment('glide-squish'); + dialog.bindAdjustment('glide-tilt'); + dialog.bindAdjustment('glide-shift'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Glitch.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Glitch.js new file mode 100644 index 0000000..492d6e1 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Glitch.js @@ -0,0 +1,103 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect applies some intentional graphics issues to your windows. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uColor = shader.get_uniform_location('uColor'); + shader._uScale = shader.get_uniform_location('uScale'); + shader._uStrength = shader.get_uniform_location('uStrength'); + shader._uSpeed = shader.get_uniform_location('uSpeed'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uColor, 4, utils.parseColor(settings.get_string('glitch-color'))); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('glitch-scale')]); + shader.set_uniform_float(shader._uStrength, 1, [settings.get_double('glitch-strength')]); + shader.set_uniform_float(shader._uSpeed, 1, [settings.get_double('glitch-speed')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'glitch'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Glitch'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('glitch-animation-time'); + dialog.bindAdjustment('glitch-scale'); + dialog.bindAdjustment('glitch-speed'); + dialog.bindAdjustment('glitch-strength'); + dialog.bindColorButton('glitch-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Hexagon.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Hexagon.js new file mode 100644 index 0000000..5adb59c --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Hexagon.js @@ -0,0 +1,107 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect overlays a glowing hexagonal grid over the window. The grid cells then // +// gradually shrink until the window is fully dissolved. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uAdditiveBlending = shader.get_uniform_location('uAdditiveBlending'); + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uScale = shader.get_uniform_location('uScale'); + shader._uLineWidth = shader.get_uniform_location('uLineWidth'); + shader._uGlowColor = shader.get_uniform_location('uGlowColor'); + shader._uLineColor = shader.get_uniform_location('uLineColor'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uAdditiveBlending, 1, [settings.get_boolean('hexagon-additive-blending')]); + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('hexagon-scale')]); + shader.set_uniform_float(shader._uLineWidth, 1, [settings.get_double('hexagon-line-width')]); + shader.set_uniform_float(shader._uGlowColor, 4, utils.parseColor(settings.get_string('hexagon-glow-color'))); + shader.set_uniform_float(shader._uLineColor, 4, utils.parseColor(settings.get_string('hexagon-line-color'))); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'hexagon'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Hexagon'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('hexagon-animation-time'); + dialog.bindAdjustment('hexagon-scale'); + dialog.bindAdjustment('hexagon-line-width'); + dialog.bindColorButton('hexagon-line-color'); + dialog.bindColorButton('hexagon-glow-color'); + dialog.bindSwitch('hexagon-additive-blending'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Incinerate.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Incinerate.js new file mode 100644 index 0000000..beb1e06 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Incinerate.js @@ -0,0 +1,149 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect burns windows to ashes. The fire starts at a random position at the // +// window's boundary and then burns through the window in a circular shape. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uColor = shader.get_uniform_location('uColor'); + shader._uScale = shader.get_uniform_location('uScale'); + shader._uTurbulence = shader.get_uniform_location('uTurbulence'); + shader._uStartPos = shader.get_uniform_location('uStartPos'); + + // Write all uniform values at the start of each animation. + shader.connect( + 'begin-animation', (shader, settings, forOpening, testMode, actor) => { + // If we are currently performing integration test, the animation uses a fixed + // seed. + let seed = [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]; + + // If this option is set, we use the mouse pointer position. Because the actor + // position may change after the begin-animation signal is called, we set the + // uStartPos uniform during the update callback. + if (settings.get_boolean('incinerate-use-pointer')) { + shader._startPointerPos = global.get_pointer(); + shader._actor = actor; + + } else { + // Else, a random position along the window boundary is used as start position + // for the incinerate effect. + let startPos = seed[0] > seed[1] ? [seed[0], Math.floor(seed[1] + 0.5)] : + [Math.floor(seed[0] + 0.5), seed[1]]; + + shader.set_uniform_float(shader._uStartPos, 2, startPos); + + shader._startPointerPos = null; + } + + // clang-format off + shader.set_uniform_float(shader._uSeed, 2, seed); + shader.set_uniform_float(shader._uColor, 3, utils.parseColor(settings.get_string('incinerate-color'))); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('incinerate-scale')]); + shader.set_uniform_float(shader._uTurbulence, 1, [settings.get_double('incinerate-turbulence')]); + // clang-format on + }); + + // If the mouse pointer position is used as start position, we set the uStartPos + // uniform during the update callback as the actor position may not be set up + // properly before the begin animation callback. + shader.connect('update-animation', (shader) => { + if (shader._startPointerPos) { + const [x, y] = shader._startPointerPos; + const [ok, localX, localY] = shader._actor.transform_stage_point(x, y); + + if (ok) { + let startPos = [ + Math.max(0.0, Math.min(1.0, localX / shader._actor.width)), + Math.max(0.0, Math.min(1.0, localY / shader._actor.height)) + ]; + shader.set_uniform_float(shader._uStartPos, 2, startPos); + } + } + }); + + // Make sure to drop the reference to the actor. + shader.connect('end-animation', (shader) => { + shader._actor = null; + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // This effect is available on all supported GNOME Shell versions. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'incinerate'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Incinerate'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('incinerate-animation-time'); + dialog.bindAdjustment('incinerate-scale'); + dialog.bindAdjustment('incinerate-turbulence'); + dialog.bindSwitch('incinerate-use-pointer'); + dialog.bindColorButton('incinerate-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Matrix.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Matrix.js new file mode 100644 index 0000000..45065ec --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Matrix.js @@ -0,0 +1,125 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// The Matrix shader multiplies a grid of random letters with some gradients which are // +// moving from top to bottom. The speed of the moving gradients is chosen randomly. // +// Also, there is a random delay making the gradients not drop all at the same time. // +// This effect is not available on GNOME 3.3x, due to the limitation described in the // +// documentation of vfunc_paint_target further down in this file. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Create the texture in the first call. + if (!this._fontTexture) { + this._fontTexture = utils.getImageResource('/img/matrixFont.png'); + } + + // Store uniform locations of newly created shaders. + shader._uFontTexture = shader.get_uniform_location('uFontTexture'); + shader._uTrailColor = shader.get_uniform_location('uTrailColor'); + shader._uTipColor = shader.get_uniform_location('uTipColor'); + shader._uLetterSize = shader.get_uniform_location('uLetterSize'); + shader._uRandomness = shader.get_uniform_location('uRandomness'); + shader._uOverShoot = shader.get_uniform_location('uOverShoot'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uTrailColor, 3, utils.parseColor(settings.get_string('matrix-trail-color'))); + shader.set_uniform_float(shader._uTipColor, 3, utils.parseColor(settings.get_string('matrix-tip-color'))); + shader.set_uniform_float(shader._uLetterSize, 1, [settings.get_int('matrix-scale')]); + shader.set_uniform_float(shader._uRandomness, 1, [settings.get_double('matrix-randomness')]); + shader.set_uniform_float(shader._uOverShoot, 1, [settings.get_double('matrix-overshoot')]); + // clang-format on + }); + + // This is required to bind the font texture for drawing. Sadly, this seems to be + // impossible under GNOME 3.3x as this.get_pipeline() is not available. It was + // called get_target() back then but this is not wrapped in GJS. + // https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-3-36/clutter/clutter/clutter-offscreen-effect.c#L598 + shader.connect('update-animation', (shader) => { + const pipeline = shader.get_pipeline(); + + // Bind the font texture. + pipeline.set_layer_texture(1, this._fontTexture.get_texture()); + pipeline.set_uniform_1i(shader._uFontTexture, 1); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // This effect is only available on GNOME Shell 40+. + static getMinShellVersion() { + return [40, 0]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'matrix'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Matrix'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('matrix-animation-time'); + dialog.bindAdjustment('matrix-scale'); + dialog.bindAdjustment('matrix-randomness'); + dialog.bindAdjustment('matrix-overshoot'); + dialog.bindColorButton('matrix-trail-color'); + dialog.bindColorButton('matrix-tip-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0 + settings.get_double('matrix-overshoot')}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Mushroom.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Mushroom.js new file mode 100644 index 0000000..a7ee166 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Mushroom.js @@ -0,0 +1,384 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +// Import the Gio module from the GNOME platform (GObject Introspection). +// This module provides APIs for I/O operations, settings management, and other core +// features. +import Gio from 'gi://Gio'; + +// Import utility functions from the local utils.js file. +// These utilities likely contain helper functions or shared logic used across the +// application. +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect is inspired by the old 8bit mario video games and the New Super Mario // +// Bros 2 specifically when mario gets the mushroom. i hope you enjoy this little blast // +// from the past. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // very basic effect... so nothing here + + shader._uGradient = [ + shader.get_uniform_location('uStarColor0'), + shader.get_uniform_location('uStarColor1'), + shader.get_uniform_location('uStarColor2'), + shader.get_uniform_location('uStarColor3'), + shader.get_uniform_location('uStarColor4'), + shader.get_uniform_location('uStarColor5'), + ]; + + + shader._uScaleStyle = shader.get_uniform_location('uScaleStyle'); + + shader._uSparkCount = shader.get_uniform_location('uSparkCount'); + shader._uSparkColor = shader.get_uniform_location('uSparkColor'); + shader._uSparkRotation = shader.get_uniform_location('uSparkRotation'); + + shader._uRaysColor = shader.get_uniform_location('uRaysColor'); + + shader._uRingCount = shader.get_uniform_location('uRingCount'); + shader._uRingRotation = shader.get_uniform_location('uRingRotation'); + shader._uStarCount = shader.get_uniform_location('uStarCount'); + + shader._uSeed = shader.get_uniform_location('uSeed'); + + // And update all uniforms at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + for (let i = 0; i <= 5; i++) { + shader.set_uniform_float( + shader._uGradient[i], 4, + utils.parseColor(settings.get_string('mushroom-star-color-' + i))); + } + + // clang-format off + shader.set_uniform_float(shader._uScaleStyle, 1, [settings.get_double('mushroom-scale-style')]); + shader.set_uniform_float(shader._uSparkCount, 1, [settings.get_int('mushroom-spark-count')]); + shader.set_uniform_float(shader._uSparkColor, 4, utils.parseColor(settings.get_string('mushroom-spark-color'))); + shader.set_uniform_float(shader._uSparkRotation, 1, [settings.get_double('mushroom-spark-rotation')]); + shader.set_uniform_float(shader._uRaysColor, 4, utils.parseColor(settings.get_string('mushroom-rays-color'))); + shader.set_uniform_float(shader._uRingCount, 1, [settings.get_int('mushroom-ring-count')]); + shader.set_uniform_float(shader._uRingRotation, 1, [settings.get_double('mushroom-ring-rotation')]); + shader.set_uniform_float(shader._uStarCount, 1, [settings.get_int('mushroom-star-count')]); + + shader.set_uniform_float(shader._uSeed, 2, [Math.random(), Math.random()]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be + // named likes this. + static getNick() { + return 'mushroom'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Mushroom'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + // Empty for now... Code is added here later in the tutorial! + dialog.bindAdjustment('mushroom-animation-time'); + // dialog.bindSwitch('mushroom-8bit-enable'); + + dialog.bindAdjustment('mushroom-scale-style'); + + dialog.bindAdjustment('mushroom-spark-count'); + dialog.bindColorButton('mushroom-spark-color'); + dialog.bindAdjustment('mushroom-spark-rotation'); + + dialog.bindColorButton('mushroom-rays-color'); + + dialog.bindAdjustment('mushroom-ring-count'); + dialog.bindAdjustment('mushroom-ring-rotation'); + dialog.bindAdjustment('mushroom-star-count'); + + dialog.bindColorButton('mushroom-star-color-0'); + dialog.bindColorButton('mushroom-star-color-1'); + dialog.bindColorButton('mushroom-star-color-2'); + dialog.bindColorButton('mushroom-star-color-3'); + dialog.bindColorButton('mushroom-star-color-4'); + dialog.bindColorButton('mushroom-star-color-5'); + + + // Ensure the button connections and other bindings happen only once, + // even if the bindPreferences function is called multiple times. + if (!Effect._isConnected) { + Effect._isConnected = true; + + // Bind the "reset-star-colors" button to reset all star colors to their default + // values. + dialog.getBuilder().get_object('reset-star-colors').connect('clicked', () => { + // Reset each mushroom star color setting. + dialog.getProfileSettings().reset('mushroom-star-color-0'); + dialog.getProfileSettings().reset('mushroom-star-color-1'); + dialog.getProfileSettings().reset('mushroom-star-color-2'); + dialog.getProfileSettings().reset('mushroom-star-color-3'); + dialog.getProfileSettings().reset('mushroom-star-color-4'); + dialog.getProfileSettings().reset('mushroom-star-color-5'); + }); + + + // Initialize the preset dropdown menu for mushroom star colors. + Effect._createMushroomPresets(dialog); + } + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } + + // ---------------------------------------------------------------- Presets + + // This function initializes the preset dropdown menu for configuring fire options. + // It defines multiple color presets for the "mushroom star" effect and sets up + // the logic to apply these presets when selected. + + static _createMushroomPresets(dialog) { + // Retrieve the builder object for the dialog and connect to the "realize" event of + // the button. + dialog.getBuilder() + .get_object('mushroom-star-color-preset-button') + .connect('realize', (widget) => { + // Define an array of color presets, each with a name and six color values (RGBA + // format). + const presets = [ + { + name: _('8Bit Plumber'), + ScaleStyle: 0.0, + SparkCount: 0, + SparkColor: 'rgba(255,255,255,0.0)', + SparkRotation: 0.33, + RayColor: 'rgba(255,255,255,0.0)', + RingCount: 0, + RingRotation: 0.0, + StarCount: 0, + color0: 'rgba(233,249,0,1.0)', + color1: 'rgba(233,249,0,1.0)', + color2: 'rgba(91,255,0,1.0)', + color3: 'rgba(91,255,0,1.0)', + color4: 'rgba(0,240,236,1.0)', + color5: 'rgba(0,240,236,1.0)', + }, + { + name: _('New Bros 2 🍄'), + ScaleStyle: 1.0, + SparkCount: 4, + SparkColor: 'rgba(255,255,255,1.0)', + SparkRotation: 0.3, + RayColor: 'rgba(255,255,255,1.0)', + RingCount: 3, + RingRotation: 1.33, + StarCount: 5, + color0: 'rgba(233,249,0,1.0)', + color1: 'rgba(233,249,0,1.0)', + color2: 'rgba(91,255,0,1.0)', + color3: 'rgba(91,255,0,1.0)', + color4: 'rgba(0,240,236,1.0)', + color5: 'rgba(0,240,236,1.0)', + }, + { + name: + _('Red White and Blue 🇺🇸'), // A patriotic palette of red, white, and blue + ScaleStyle: 1.0, + SparkCount: 4, + SparkColor: 'rgba(255,255,255,1.0)', + SparkRotation: 0.3, + RayColor: 'rgba(255,255,255,0.0)', + RingCount: 3, + RingRotation: 1.33, + StarCount: 5, + color0: 'rgba(255, 0, 0, 1.0)', + color1: 'rgba(255, 0, 0, 1.0)', + color2: 'rgba(255,255,255, 1.0)', + color3: 'rgba(255,255,255, 1.0)', + color4: 'rgba(0,0,255, 1.0)', + color5: 'rgba(0,0,255, 1.0)' + }, + { + name: _('Rainbow 🌈'), // A vivid rainbow spectrum of colors + ScaleStyle: 1.0, + SparkCount: 4, + SparkColor: 'rgba(255,255,255,1.0)', + SparkRotation: 0.3, + RayColor: 'rgba(255,255,255,0.0)', + RingCount: 3, + RingRotation: 2.0, + StarCount: 7, + color0: 'rgba(255, 69, 58, 1.0)', // Bold Red + color1: 'rgba(255, 140, 0, 1.0)', // Bold Orange + color2: 'rgba(255, 223, 0, 1.0)', // Bold Yellow + color3: 'rgba(50, 205, 50, 1.0)', // Bold Green + color4: 'rgba(30, 144, 255, 1.0)', // Bold Blue + color5: 'rgba(148, 0, 211, 1.0)' // Bold Purple + }, + { + name: _('Cattuccino 😺'), // A soft pastel palette inspired by a + // cappuccino theme + ScaleStyle: 1.0, + SparkCount: 4, + SparkColor: 'rgba(255,255,255,1.0)', + SparkRotation: 0.3, + RayColor: 'rgba(255,255,255,0.0)', + RingCount: 3, + RingRotation: 2.0, + StarCount: 7, + color0: 'rgba(239, 146, 160, 1.0)', + color1: 'rgba(246, 178, 138, 1.0)', + color2: 'rgba(240, 217, 169, 1.0)', + color3: 'rgba(175, 223, 159, 1.0)', + color4: 'rgba(149, 182, 246, 1.0)', + color5: 'rgba(205, 170, 247, 1.0)' + }, + { + name: _('Dracula 🦇'), // A dark palette inspired by the Dracula theme + ScaleStyle: 1.0, + SparkCount: 0, + SparkColor: 'rgba(255,255,255,1.0)', + SparkRotation: 0.3, + RayColor: 'rgba(255,255,255,0.0)', + RingCount: 3, + RingRotation: 2.0, + StarCount: 7, + color0: 'rgba(40, 42, 54, 1.0)', // Dark Grey + color1: 'rgba(68, 71, 90, 1.0)', // Medium Grey + color2: 'rgba(90, 94, 119, 1.0)', // Light Grey + color3: 'rgba(90, 94, 119, 1.0)', // Light Grey + color4: 'rgba(68, 71, 90, 1.0)', // Medium Grey + color5: 'rgba(40, 42, 54, 1.0)' // Dark Grey + }, + { + name: _('Sparkle ✨'), // A dark palette inspired by the Dracula theme + ScaleStyle: 1.0, + SparkCount: 25, + SparkColor: 'rgba(255,255,255,1.0)', + SparkRotation: 0.3, + RayColor: 'rgba(255,255,255,0.0)', + RingCount: 0, + RingRotation: 1.33, + StarCount: 7, + color0: 'rgba(255,255,255,0.0)', + color1: 'rgba(255,255,255,0.0)', + color2: 'rgba(255,255,255,0.0)', + color3: 'rgba(255,255,255,0.0)', + color4: 'rgba(255,255,255,0.0)', + color5: 'rgba(255,255,255,0.0)', + } + ]; + + // Create a new menu model to hold the presets and an action group for handling + // selections. + const menu = Gio.Menu.new(); + const group = Gio.SimpleActionGroup.new(); + const groupName = 'mushroom-presets'; + + // Iterate over the presets to populate the menu. + presets.forEach((preset, i) => { + // Define an action name based on the preset index. + const actionName = 'mushroom' + i; + + // Append the preset name to the menu. + menu.append(preset.name, groupName + '.' + actionName); + + // Create a new action for the preset. + let action = Gio.SimpleAction.new(actionName, null); + + // Connect the action to a function that loads the preset colors into the + // dialog. + action.connect('activate', () => { + dialog.getProfileSettings().set_double('mushroom-scale-style', + preset.ScaleStyle); + dialog.getProfileSettings().set_int('mushroom-spark-count', + preset.SparkCount); + dialog.getProfileSettings().set_string('mushroom-spark-color', + preset.SparkColor); + dialog.getProfileSettings().set_double('mushroom-spark-rotation', + preset.SparkRotation); + dialog.getProfileSettings().set_string('mushroom-rays-color', + preset.RayColor); + dialog.getProfileSettings().set_int('mushroom-ring-count', preset.RingCount); + dialog.getProfileSettings().set_double('mushroom-ring-rotation', + preset.RingRotation); + dialog.getProfileSettings().set_int('mushroom-star-count', preset.StarCount); + + dialog.getProfileSettings().set_string('mushroom-star-color-0', + preset.color0); + dialog.getProfileSettings().set_string('mushroom-star-color-1', + preset.color1); + dialog.getProfileSettings().set_string('mushroom-star-color-2', + preset.color2); + dialog.getProfileSettings().set_string('mushroom-star-color-3', + preset.color3); + dialog.getProfileSettings().set_string('mushroom-star-color-4', + preset.color4); + dialog.getProfileSettings().set_string('mushroom-star-color-5', + preset.color5); + }); + + // Add the action to the action group. + group.add_action(action); + }); + + // Assign the populated menu to the preset button. + dialog.getBuilder() + .get_object('mushroom-star-color-preset-button') + .set_menu_model(menu); + + // Insert the action group into the root widget for handling the presets. + const root = widget.get_root(); + root.insert_action_group(groupName, group); + }); + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PaintBrush.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PaintBrush.js new file mode 100644 index 0000000..d352833 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PaintBrush.js @@ -0,0 +1,115 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Cogl = await utils.importInShellOnly('gi://Cogl'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect paints your windows with a thick paint brush. // +// This effect is not available on GNOME 3.3x, due to the limitation described in the // +// documentation of vfunc_paint_target further down in this file. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Create the texture in the first call. + if (!this._brushTexture) { + this._brushTexture = utils.getImageResource('/img/brush.png', true); + } + + // Store uniform locations of newly created shaders. + shader._uBrushTexture = shader.get_uniform_location('uBrushTexture'); + shader._uBrushSize = shader.get_uniform_location('uBrushSize'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + shader.set_uniform_float(shader._uBrushSize, 1, + [settings.get_int('paint-brush-size')]); + }); + + // This is required to bind the brush texture for drawing. Sadly, this seems to be + // impossible under GNOME 3.3x as this.get_pipeline() is not available. It was + // called get_target() back then but this is not wrapped in GJS. + // https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-3-36/clutter/clutter/clutter-offscreen-effect.c#L598 + shader.connect('update-animation', (shader) => { + const pipeline = shader.get_pipeline(); + + // Use linear filtering for the window texture. + pipeline.set_layer_filters(0, Cogl.PipelineFilter.LINEAR, + Cogl.PipelineFilter.LINEAR); + + // Bind the brush texture. + pipeline.set_layer_texture(1, this._brushTexture.get_texture()); + pipeline.set_uniform_1i(shader._uBrushTexture, 1); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // This effect is only available on GNOME Shell 40+. + static getMinShellVersion() { + return [40, 0]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'paint-brush'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Paint Brush'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('paint-brush-animation-time'); + dialog.bindAdjustment('paint-brush-size'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PixelWheel.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PixelWheel.js new file mode 100644 index 0000000..af74c72 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PixelWheel.js @@ -0,0 +1,95 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This simple effect pixelates the window texture and hides the pixels in a wheel-like // +// fashion. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uPixelSize = shader.get_uniform_location('uPixelSize'); + shader._uSpokeCount = shader.get_uniform_location('uSpokeCount'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_double('pixel-wheel-pixel-size')]); + shader.set_uniform_float(shader._uSpokeCount, 1, [settings.get_int('pixel-wheel-spoke-count')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'pixel-wheel'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Pixel Wheel'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('pixel-wheel-animation-time'); + dialog.bindAdjustment('pixel-wheel-pixel-size'); + dialog.bindAdjustment('pixel-wheel-spoke-count'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PixelWipe.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PixelWipe.js new file mode 100644 index 0000000..6f9a3bc --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/PixelWipe.js @@ -0,0 +1,120 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect pixelates the window texture and hides the pixels radially, starting // +// from the pointer position. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uPixelSize = shader.get_uniform_location('uPixelSize'); + shader._uStartPos = shader.get_uniform_location('uStartPos'); + + // Write all uniform values at the start of each animation. + shader.connect( + 'begin-animation', (shader, settings, forOpening, testMode, actor) => { + // Because the actor position may change after the begin-animation signal is + // called, we set the uStartPos uniform during the update callback. + shader._startPointerPos = global.get_pointer(); + shader._actor = actor; + + shader.set_uniform_float(shader._uPixelSize, 1, + [settings.get_int('pixel-wipe-pixel-size')]); + }); + + // We set the uStartPos uniform during the update callback as the actor position + // may not be set up properly before the begin animation callback. + shader.connect('update-animation', (shader) => { + if (shader._startPointerPos) { + const [x, y] = shader._startPointerPos; + const [ok, localX, localY] = shader._actor.transform_stage_point(x, y); + + if (ok) { + let startPos = [ + Math.max(0.0, Math.min(1.0, localX / shader._actor.width)), + Math.max(0.0, Math.min(1.0, localY / shader._actor.height)) + ]; + shader.set_uniform_float(shader._uStartPos, 2, startPos); + } + } + }); + + // Make sure to drop the reference to the actor. + shader.connect('end-animation', (shader) => { + shader._actor = null; + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'pixel-wipe'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Pixel Wipe'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('pixel-wipe-animation-time'); + dialog.bindAdjustment('pixel-wipe-pixel-size'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Pixelate.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Pixelate.js new file mode 100644 index 0000000..1730b59 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Pixelate.js @@ -0,0 +1,95 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This very simple effect pixelates the window texture and randomly hides pixels until // +// the entire window is gone. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uNoise = shader.get_uniform_location('uNoise'); + shader._uPixelSize = shader.get_uniform_location('uPixelSize'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uNoise, 1, [settings.get_double('pixelate-noise')]); + shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('pixelate-pixel-size')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'pixelate'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Pixelate'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('pixelate-animation-time'); + dialog.bindAdjustment('pixelate-noise'); + dialog.bindAdjustment('pixelate-pixel-size'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Portal.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Portal.js new file mode 100644 index 0000000..21f7a4e --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Portal.js @@ -0,0 +1,105 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This ridiculous effect teleports your windows from and to alternative dimensions. // +// It may resemble the portal from a well-known cartoon series... // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uColor = shader.get_uniform_location('uColor'); + shader._uDetails = shader.get_uniform_location('uDetails'); + shader._uRotationSpeed = shader.get_uniform_location('uRotationSpeed'); + shader._uWhirling = shader.get_uniform_location('uWhirling'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uColor, 3, utils.parseColor(settings.get_string('portal-color'))); + shader.set_uniform_float(shader._uDetails, 1, [settings.get_double('portal-details')]); + shader.set_uniform_float(shader._uRotationSpeed, 1, [settings.get_double('portal-rotation-speed')]); + shader.set_uniform_float(shader._uWhirling, 1, [settings.get_double('portal-whirling')]); + // clang-format on + }); + }); + } + + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'portal'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Portal'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('portal-animation-time'); + dialog.bindAdjustment('portal-rotation-speed'); + dialog.bindAdjustment('portal-whirling'); + dialog.bindAdjustment('portal-details'); + dialog.bindColorButton('portal-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/RGBWarp.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/RGBWarp.js new file mode 100644 index 0000000..e8ab802 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/RGBWarp.js @@ -0,0 +1,100 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect warps the Red Green Blue values // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uBrightness = shader.get_uniform_location('uBrightness'); + shader._uSpeedR = shader.get_uniform_location('uSpeedR'); + shader._uSpeedG = shader.get_uniform_location('uSpeedG'); + shader._uSpeedB = shader.get_uniform_location('uSpeedB'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uBrightness, 1, [settings.get_double('rgbwarp-brightness')]); + shader.set_uniform_float(shader._uSpeedR, 1, [settings.get_double('rgbwarp-speed-r')]); + shader.set_uniform_float(shader._uSpeedG, 1, [settings.get_double('rgbwarp-speed-g')]); + shader.set_uniform_float(shader._uSpeedB, 1, [settings.get_double('rgbwarp-speed-b')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be + // named likes this. + static getNick() { + return 'rgbwarp'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('RGB Warp'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('rgbwarp-animation-time'); + dialog.bindAdjustment('rgbwarp-brightness'); + dialog.bindAdjustment('rgbwarp-speed-r'); + dialog.bindAdjustment('rgbwarp-speed-g'); + dialog.bindAdjustment('rgbwarp-speed-b'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/SnapOfDisintegration.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/SnapOfDisintegration.js new file mode 100644 index 0000000..3bb4417 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/SnapOfDisintegration.js @@ -0,0 +1,126 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Cogl = await utils.importInShellOnly('gi://Cogl'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effects dissolves your windows into a cloud of dust. For this, it uses an // +// approach similar to the Broken Glass effect. A dust texture is used to segment the // +// window texture into a set of layers. Each layer is then moved, sheared and scaled // +// randomly. Just a few layers are sufficient to create the illusion of many individual // +// dust particles. // +// This effect is not available on GNOME 3.3x, due to the limitation described in the // +// documentation of vfunc_paint_target further down in this file. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Create the texture in the first call. + if (!this._dustTexture) { + this._dustTexture = utils.getImageResource('/img/dust.png'); + } + + // Store uniform locations of newly created shaders. + shader._uDustTexture = shader.get_uniform_location('uDustTexture'); + shader._uDustColor = shader.get_uniform_location('uDustColor'); + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uDustScale = shader.get_uniform_location('uDustScale'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uDustColor, 4, utils.parseColor(settings.get_string('snap-color'))); + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uDustScale, 1, [settings.get_double('snap-scale')]); + // clang-format on + }); + + // This is required to bind the dust texture for drawing. Sadly, this seems to be + // impossible under GNOME 3.3x as this.get_pipeline() is not available. It was + // called get_target() back then but this is not wrapped in GJS. + // https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-3-36/clutter/clutter/clutter-offscreen-effect.c#L598 + shader.connect('update-animation', (shader) => { + const pipeline = shader.get_pipeline(); + + // Use linear filtering for the window texture. + pipeline.set_layer_filters(0, Cogl.PipelineFilter.LINEAR, + Cogl.PipelineFilter.LINEAR); + + // Bind the dust texture. + pipeline.set_layer_texture(1, this._dustTexture.get_texture()); + pipeline.set_layer_wrap_mode(1, Cogl.PipelineWrapMode.REPEAT); + pipeline.set_uniform_1i(shader._uDustTexture, 1); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // This effect is only available on GNOME Shell 40+. + static getMinShellVersion() { + return [40, 0]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'snap'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Snap of Disintegration'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('snap-animation-time'); + dialog.bindAdjustment('snap-scale'); + dialog.bindColorButton('snap-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.2, y: 1.2}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TRexAttack.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TRexAttack.js new file mode 100644 index 0000000..3c7f278 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TRexAttack.js @@ -0,0 +1,128 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Cogl = await utils.importInShellOnly('gi://Cogl'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect tears your windows apart with a series of violent scratches! // +// This effect is not available on GNOME 3.3x, due to the limitation described in the // +// documentation of vfunc_paint_target further down in this file. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Create the texture in the first call. + if (!this._clawTexture) { + this._clawTexture = utils.getImageResource('/img/claws.png'); + } + + // Store uniform locations of newly created shaders. + shader._uClawTexture = shader.get_uniform_location('uClawTexture'); + shader._uFlashColor = shader.get_uniform_location('uFlashColor'); + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uClawSize = shader.get_uniform_location('uClawSize'); + shader._uNumClaws = shader.get_uniform_location('uNumClaws'); + shader._uWarpIntensity = shader.get_uniform_location('uWarpIntensity'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uFlashColor, 4, utils.parseColor(settings.get_string('trex-scratch-color'))); + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uClawSize, 1, [settings.get_double('trex-scratch-scale')]); + shader.set_uniform_float(shader._uNumClaws, 1, [settings.get_int('trex-scratch-count')]); + shader.set_uniform_float(shader._uWarpIntensity, 1, [settings.get_double('trex-scratch-warp')]); + // clang-format on + }); + + // This is required to bind the claw texture for drawing. Sadly, this seems to be + // impossible under GNOME 3.3x as this.get_pipeline() is not available. It was + // called get_target() back then but this is not wrapped in GJS. + // https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-3-36/clutter/clutter/clutter-offscreen-effect.c#L598 + shader.connect('update-animation', (shader) => { + const pipeline = shader.get_pipeline(); + + // Use linear filtering for the window texture. + pipeline.set_layer_filters(0, Cogl.PipelineFilter.LINEAR, + Cogl.PipelineFilter.LINEAR); + + // Bind the claw texture. + pipeline.set_layer_texture(1, this._clawTexture.get_texture()); + pipeline.set_uniform_1i(shader._uClawTexture, 1); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // This effect is only available on GNOME Shell 40+. + static getMinShellVersion() { + return [40, 0]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'trex'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('T-Rex Attack'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('trex-animation-time'); + dialog.bindColorButton('trex-scratch-color'); + dialog.bindAdjustment('trex-scratch-scale'); + dialog.bindAdjustment('trex-scratch-count'); + dialog.bindAdjustment('trex-scratch-warp'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + const scale = 1.0 + 0.5 * settings.get_double('trex-scratch-warp'); + return {x: scale, y: scale}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TVEffect.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TVEffect.js new file mode 100644 index 0000000..f551f6f --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TVEffect.js @@ -0,0 +1,93 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect hides the actor by making it first transparent from top and bottom // +// towards the middle and then hiding the resulting line from left and right towards // +// the center. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uColor = shader.get_uniform_location('uColor'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + shader.set_uniform_float( + shader._uColor, 4, utils.parseColor(settings.get_string('tv-effect-color'))); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'tv'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('TV Effect'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('tv-animation-time'); + dialog.bindColorButton('tv-effect-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TVGlitch.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TVGlitch.js new file mode 100644 index 0000000..b50fa8d --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TVGlitch.js @@ -0,0 +1,104 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect combines the Glitch and the TV Effect. Credits go to Kurt Wilson // +// (https://github.com/Kurtoid) for this idea! // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uColor = shader.get_uniform_location('uColor'); + shader._uScale = shader.get_uniform_location('uScale'); + shader._uStrength = shader.get_uniform_location('uStrength'); + shader._uSpeed = shader.get_uniform_location('uSpeed'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + // clang-format off + shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uColor, 4, utils.parseColor(settings.get_string('tv-glitch-color'))); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('tv-glitch-scale')]); + shader.set_uniform_float(shader._uStrength, 1, [settings.get_double('tv-glitch-strength')]); + shader.set_uniform_float(shader._uSpeed, 1, [settings.get_double('tv-glitch-speed')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-close-effect'), and its animation time + // (e.g. '*-animation-time'). + static getNick() { + return 'tv-glitch'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('TV Glitch'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('tv-glitch-animation-time'); + dialog.bindAdjustment('tv-glitch-scale'); + dialog.bindAdjustment('tv-glitch-speed'); + dialog.bindAdjustment('tv-glitch-strength'); + dialog.bindColorButton('tv-glitch-color'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TeamRocket.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TeamRocket.js new file mode 100644 index 0000000..c1d54d8 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/TeamRocket.js @@ -0,0 +1,114 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import the ShaderFactory only in the Shell process as it is not required in the +// preferences process. The preferences process does not create any shader instances, it +// only uses the static metadata of the effect. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect was inspired by Team Rocket Blasting Off again! // +// https://c.tenor.com/0ag0MVXUaQEAAAAd/tenor.gif // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uAnimationSplit = shader.get_uniform_location('uAnimationSplit'); + shader._uHorizontalSparklePosition = + shader.get_uniform_location('uHorizontalSparklePosition'); + shader._uVerticalSparklePosition = + shader.get_uniform_location('uVerticalSparklePosition'); + shader._uWindowRotation = shader.get_uniform_location('uWindowRotation'); + shader._uSparkleRot = shader.get_uniform_location('uSparkleRot'); + shader._uSparkleSize = shader.get_uniform_location('uSparkleSize'); + + shader._uSeed = shader.get_uniform_location('uSeed'); + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings) => { + // clang-format off + shader.set_uniform_float(shader._uAnimationSplit, 1, [settings.get_double('team-rocket-animation-split')]); + shader.set_uniform_float(shader._uHorizontalSparklePosition, 1, [settings.get_double('team-rocket-horizontal-sparkle-position')]); + shader.set_uniform_float(shader._uVerticalSparklePosition, 1, [settings.get_double('team-rocket-vertical-sparkle-position')]); + shader.set_uniform_float(shader._uWindowRotation, 1, [settings.get_boolean('team-rocket-window-rotation')]); + shader.set_uniform_float(shader._uSparkleRot, 1, [settings.get_double('team-rocket-sparkle-rot')]); + shader.set_uniform_float(shader._uSparkleSize, 1, [settings.get_double('team-rocket-sparkle-size')]); + // clang-format on + + // This will be used with a hash function to get a random number. + shader.set_uniform_float(shader._uSeed, 2, [Math.random(), Math.random()]); + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. '*-enable-effect'), and its animation time + // (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be + // named likes this. + static getNick() { + return 'team-rocket'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Team Rocket'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('team-rocket-animation-time'); + dialog.bindAdjustment('team-rocket-animation-split'); + dialog.bindAdjustment('team-rocket-horizontal-sparkle-position'); + dialog.bindAdjustment('team-rocket-vertical-sparkle-position'); + dialog.bindSwitch('team-rocket-window-rotation'); + dialog.bindAdjustment('team-rocket-sparkle-rot'); + dialog.bindAdjustment('team-rocket-sparkle-size'); + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Wisps.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Wisps.js new file mode 100644 index 0000000..aa8482c --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/effects/Wisps.js @@ -0,0 +1,120 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import * as utils from '../utils.js'; + +// We import some modules only in the Shell process as they are not available in the +// preferences process. They are used only in the creator function of the ShaderFactory +// which is only called within GNOME Shell's process. +const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js'); +const Clutter = await utils.importInShellOnly('gi://Clutter'); + +const _ = await utils.importGettext(); + +////////////////////////////////////////////////////////////////////////////////////////// +// This effect lets your windows be carried to the realm of dreams by some little // +// fairies. It's implemented with several overlaid grids of randomly moving points. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The effect class can be used to get some metadata (like the effect's name or supported +// GNOME Shell versions), to initialize the respective page of the settings dialog, as +// well as to create the actual shader for the effect. +export default class Effect { + + // The constructor creates a ShaderFactory which will be used by extension.js to create + // shader instances for this effect. The shaders will be automagically created using the + // GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each + // newly created shader instance. + constructor() { + this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => { + // Store uniform locations of newly created shaders. + shader._uSeed = shader.get_uniform_location('uSeed'); + shader._uScale = shader.get_uniform_location('uScale'); + shader._uColor = [ + shader.get_uniform_location('uColor1'), + shader.get_uniform_location('uColor2'), + shader.get_uniform_location('uColor3'), + ]; + + // Write all uniform values at the start of each animation. + shader.connect('begin-animation', (shader, settings, forOpening, testMode) => { + for (let i = 1; i <= 3; i++) { + shader.set_uniform_float( + shader._uColor[i - 1], 3, + utils.parseColor(settings.get_string('wisps-color-' + i))); + } + + // clang-format off + shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]); + shader.set_uniform_float(shader._uScale, 1, [settings.get_double('wisps-scale')]); + // clang-format on + }); + }); + } + + // ---------------------------------------------------------------------------- metadata + + // The effect is available on all GNOME Shell versions supported by this extension. + static getMinShellVersion() { + return [3, 36]; + } + + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. the '*-enable-effect'). + static getNick() { + return 'wisps'; + } + + // This will be shown in the sidebar of the preferences dialog as well as in the + // drop-down menus where the user can choose the effect. + static getLabel() { + return _('Wisps'); + } + + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog whenever a new effect profile is loaded. It + // binds all user interface elements to the respective settings keys of the profile. + static bindPreferences(dialog) { + dialog.bindAdjustment('wisps-animation-time'); + dialog.bindAdjustment('wisps-scale'); + dialog.bindColorButton('wisps-color-1'); + dialog.bindColorButton('wisps-color-2'); + dialog.bindColorButton('wisps-color-3'); + + // Connect the buttons only once. The bindPreferences can be called multiple times... + if (!this._isConnected) { + this._isConnected = true; + + // The wisps-color-reset button needs to be bound explicitly. + dialog.getBuilder().get_object('reset-wisps-colors').connect('clicked', () => { + dialog.getProfileSettings().reset('wisps-color-1'); + dialog.getProfileSettings().reset('wisps-color-2'); + dialog.getProfileSettings().reset('wisps-color-3'); + }); + } + } + + // ---------------------------------------------------------------- API for extension.js + + // The getActorScale() is called from extension.js to adjust the actor's size during the + // animation. This is useful if the effect requires drawing something beyond the usual + // bounds of the actor. This only works for GNOME 3.38+. + static getActorScale(settings, forOpening, actor) { + return {x: 1.0, y: 1.0}; + } +} diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/migrate.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/migrate.js new file mode 100644 index 0000000..6cc92b7 --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/migrate.js @@ -0,0 +1,227 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import {ProfileManager} from './ProfileManager.js'; +import * as utils from './utils.js'; + +// Migrating from pre-27 versions is pretty involved. Before, all settings were stored in +// the standard Gio.Settings backend. Now, there are effect profiles. Depending on the +// settings one or two profiles may be required. +export async function fromVersion26() { + return utils + .executeCommand(['dconf', 'dump', '/org/gnome/shell/extensions/burn-my-windows/']) + .catch(r => utils.debug('Failed to get old settings for effect migration: ' + r)) + .then(r => { + // If there were no settings before, we do not have to migrate anything. Just use + // the new defaults. + if (r == '') { + return; + } + + utils.debug('Starting Burn-My-Windows profile migration (old version <= 26)!'); + + // We use this to write the new profiles. + const profileManager = new ProfileManager(); + + // The default value of this was false, so not-present is equal to false. + const destroyDialogs = r.includes('destroy-dialogs=true'); + if (!destroyDialogs) { + utils.debug('Only normal windows will be burned by the new profile(s).'); + } + + // The default value of this was false, so not-present is equal to false. + const disableOnBattery = r.includes('disable-on-battery=true'); + if (disableOnBattery) { + utils.debug('The new profile(s) will not be active on battery.'); + } + + // The default value of this was false, so not-present is equal to false. + const disableOnPowerSave = r.includes('disable-on-power-save=true'); + if (disableOnPowerSave) { + utils.debug('The new profile(s) will not be active in power-save mode.'); + } + + // Remove some unnecessary lines. + r = r.replace(/^active-profile=.*\n?/gm, ''); + r = r.replace(/^test-mode=.*\n?/gm, ''); + r = r.replace(/^last-extension-version=.*\n?/gm, ''); + r = r.replace(/^last-prefs-version=.*\n?/gm, ''); + r = r.replace(/^destroy-dialogs=.*\n?/gm, ''); + r = r.replace(/^disable-on-battery=.*\n?/gm, ''); + r = r.replace(/^disable-on-power-save=.*\n?/gm, ''); + r = r.replace(/^.*-preview-.*\n?/gm, ''); + r = r.replace('[/]\n', ''); + r = r.trim(); + + // There were some inconsistencies in the key names. The update fixes them. + r.replace('flame-', 'fire-'); + r.replace('claw-', 'trex-'); + + // Find all effects which were used for openeing and closing. This first extracts + // all lines which end in "-open-effect=true" and then remove this suffix from the + // lines. This leaves only the effect nicks. + let lines = r.split('\n'); + let openEffects = lines.filter(l => l.includes('-open-effect=true')) + .map(l => l.replace('-open-effect=true', '')); + let closeEffects = lines.filter(l => l.includes('-close-effect=true')) + .map(l => l.replace('-close-effect=true', '')); + + // The fire-close effect is enabled per default, so we have to add it if it's not + // explicitly disabled. + if (!r.includes('fire-close-effect=false') && !closeEffects.includes('fire')) { + closeEffects.push('fire'); + } + + // Print all effects we've found. + utils.debug('Enabled open effects: ' + openEffects); + utils.debug('Enabled close effects: ' + closeEffects); + + // If the same effects were used for opening and closing windows or there is either + // no opening or no closing animation configured, only one profile is required. Else + // we have to create two new profiles. + const numProfiles = openEffects.join() == closeEffects.join() ? 1 : 2; + if (numProfiles == 1) { + utils.debug('Only one profile is required.'); + } else if (closeEffects.length == 0) { + utils.debug('Only a window-open profile is required.'); + } else if (openEffects.length == 0) { + utils.debug('Only a window-close profile is required.'); + } else { + utils.debug('Two profiles are required.'); + } + + // Remove all open / close lines. + const profileLines = + lines.filter(l => !l.includes('-close-effect=') && !l.includes('-open-effect=')); + + // Add the header. + profileLines.unshift('[burn-my-windows-profile]'); + + // Push the line which makes the profile only apply to normal windows. + if (!destroyDialogs) { + profileLines.push('profile-window-type=1'); + } + + // Push the line which makes the profile only active when plugged in. + if (disableOnBattery) { + profileLines.push('profile-power-mode=2'); + } + + // Push the line which makes the profile only active when on balanced or performance + // mode. + if (disableOnPowerSave) { + profileLines.push('profile-power-profile=5'); + } + + // Now comes a bit of code repetition, but it is more readable this way. + if (numProfiles == 1) { + + // Add all relevant effects. + openEffects.forEach(e => profileLines.push(e + '-enable-effect=true')); + + // The fire effect is enabled per default, so we have to explicitly disable it if + // not required. + if (!openEffects.includes('fire')) { + profileLines.push('fire-enable-effect=false'); + } + + // Print and save the new profile. + const profile = profileLines.join('\n'); + + utils.debug('The new profile:'); + utils.debug(profile); + + profileManager.createProfile(profile); + + } else if (closeEffects.length == 0) { + + // This profile is only for window openeing. + profileLines.push('profile-animation-type=1') + + // Add all relevant effects. + openEffects.forEach(e => profileLines.push(e + '-enable-effect=true')); + + // The fire effect is enabled per default, so we have to explicitly disable it if + // not required. + if (!openEffects.includes('fire')) { + profileLines.push('fire-enable-effect=false'); + } + + // Print and save the new profile. + const profile = profileLines.join('\n'); + + utils.debug('The new window-open profile:'); + utils.debug(profile); + + profileManager.createProfile(profile); + + } else if (openEffects.length == 0) { + + // This profile is only for window closing. + profileLines.push('profile-animation-type=2') + + // Add all relevant effects. + closeEffects.forEach(e => profileLines.push(e + '-enable-effect=true')); + + // The fire effect is enabled per default, so we have to explicitly disable it if + // not required. + if (!closeEffects.includes('fire')) { + profileLines.push('fire-enable-effect=false'); + } + + // Print and save the new profile. + const profile = profileLines.join('\n'); + + utils.debug('The new window-close profile:'); + utils.debug(profile); + + profileManager.createProfile(profile); + + + } else { + + const openProfileLines = [...profileLines, 'profile-animation-type=1']; + const closeProfileLines = [...profileLines, 'profile-animation-type=2']; + + // Add all relevant effects. + openEffects.forEach(e => openProfileLines.push(e + '-enable-effect=true')); + closeEffects.forEach(e => closeProfileLines.push(e + '-enable-effect=true')); + + // The fire effect is enabled per default, so we have to explicitly disable it if + // not required. + if (!closeEffects.includes('fire')) { + closeProfileLines.push('fire-enable-effect=false'); + } + + if (!openEffects.includes('fire')) { + openProfileLines.push('fire-enable-effect=false'); + } + + // Print and save the new profiles. + const openProfile = openProfileLines.join('\n'); + const closeProfile = closeProfileLines.join('\n'); + + utils.debug('The new open-window profile:'); + utils.debug(openProfile); + utils.debug('The new close-window profile:'); + utils.debug(closeProfile); + + profileManager.createProfile(openProfile); + profileManager.createProfile(closeProfile); + } + }) + .catch(r => utils.debug('Failed to migrate settings: ' + r)); +}
\ No newline at end of file diff --git a/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/utils.js b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/utils.js new file mode 100644 index 0000000..2e0d53d --- /dev/null +++ b/raveos-gnome-theme/theme-data/extensions/installed/burn-my-windows@schneegans.github.com/src/utils.js @@ -0,0 +1,206 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de> +// SPDX-License-Identifier: GPL-3.0-or-later + +'use strict'; + +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; + +// We import some modules optionally. This file is used in the preferences process as well +// as in the GNOME Shell process. Some modules are only available or required in one of +// these processes. +const GdkPixbuf = await importInShellOnly('gi://GdkPixbuf'); +const Clutter = await importInShellOnly('gi://Clutter'); +const Cogl = await importInShellOnly('gi://Cogl'); +const St = await importInShellOnly('gi://St'); + +// We import the Config module. This is done differently in the GNOME Shell process and in +// the preferences process. +const Config = await importConfig(); + +// Returns the given argument, except for "alpha", "beta", and "rc". In these cases -3, +// -2, and -1 are returned respectively. +function toNumericVersion(x) { + switch (x) { + case 'alpha': + return -3; + case 'beta': + return -2; + case 'rc': + return -1; + } + return x; +} + +const [GS_MAJOR, GS_MINOR] = Config.PACKAGE_VERSION.split('.').map(toNumericVersion); + +// This method returns true if the current GNOME Shell version matches the given +// arguments. +export function shellVersionIs(major, minor) { + return GS_MAJOR == major && GS_MINOR == toNumericVersion(minor); +} + +// This method returns true if the current GNOME Shell version is at least as high as the +// given arguments. Supports "alpha" and "beta" for the minor version number. +export function shellVersionIsAtLeast(major, minor = 0) { + if (GS_MAJOR > major) { + return true; + } + + if (GS_MAJOR == major) { + return GS_MINOR >= toNumericVersion(minor); + } + + return false; +} + +// This method can be used to import the Config module. +export async function importConfig() { + if (typeof global === 'undefined') { + return (await import('resource:///org/gnome/Shell/Extensions/js/misc/config.js')); + } + return (await import('resource:///org/gnome/shell/misc/config.js')); +} + + +// This method can be used to write a message to GNOME Shell's log. This is enhances +// the standard log() functionality by prepending the extension's name and the location +// where the message was logged. As the extensions name is part of the location, you +// can more effectively watch the log output of GNOME Shell: +// journalctl -f -o cat | grep -E 'burn-my-windows|' +export function debug(message) { + const stack = new Error().stack.split('\n'); + + // Remove debug() function call from stack. + stack.shift(); + + // Find the index of the extension directory in the stack entry. We do not want to + // print the entire absolute file path. + const extensionRoot = stack[0].indexOf('burn-my-windows@schneegans.github.com'); + + 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; +} + +// This method can be used to import a module in the preferences process only. The same as +// importInShellOnly(), but the other way around. +export async function importInPrefsOnly(module) { + if (typeof global === 'undefined') { + return (await import(module)).default; + } + return null; +} + +// This method can be used to import gettext. This is done differently in the +// GNOME Shell process and in the preferences process. +export async function importGettext() { + if (typeof global === 'undefined') { + return (await import('resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js')) + .gettext; + } + return (await import('resource:///org/gnome/shell/extensions/extension.js')).gettext; +} + +// Reads the contents of a file contained in the global resources archive. The data +// is returned as a string. +export function getStringResource(path) { + const data = Gio.resources_lookup_data(path, 0); + return new TextDecoder().decode(data.get_data()); +} + +// Reads the contents of an image file contained in the global resources archive. The data +// is returned as a St.ImageContent. +export function getImageResource(path, premultiplied = false) { + const data = GdkPixbuf.Pixbuf.new_from_resource(path); + const texture = St.ImageContent.new_with_preferred_size(data.width, data.height); + const format = data.has_alpha ? + (premultiplied ? Cogl.PixelFormat.RGBA_8888_PRE : Cogl.PixelFormat.RGBA_8888) : + Cogl.PixelFormat.RGB_888; + + // https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/44b84e458a22046fedb85701ea25ad08ecc0d43f + if (shellVersionIsAtLeast(48, 'beta')) { + texture.set_data(global.stage.context.get_backend().get_cogl_context(), + data.get_pixels(), format, data.width, data.height, data.rowstride); + } else { + texture.set_data(data.get_pixels(), format, data.width, data.height, data.rowstride); + } + + return texture; +} + +// Executes a command asynchronously and returns the output from 'stdout' on success or +// throw an error with output from 'stderr' on failure. If given, input will be passed to +// 'stdin' and cancellable can be used to stop the process before it finishes. +// This is directly taken from here: +// https://gjs.guide/guides/gio/subprocesses.html#complete-examples +export async function executeCommand(argv, input = null, cancellable = null) { + let cancelId = 0; + let flags = (Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE); + + if (input !== null) flags |= Gio.SubprocessFlags.STDIN_PIPE; + + let proc = new Gio.Subprocess({argv: argv, flags: flags}); + proc.init(cancellable); + + if (cancellable instanceof Gio.Cancellable) { + cancelId = cancellable.connect(() => proc.force_exit()); + } + + return new Promise((resolve, reject) => { + proc.communicate_utf8_async(input, null, (proc, res) => { + try { + let [, stdout, stderr] = proc.communicate_utf8_finish(res); + let status = proc.get_exit_status(); + + if (status !== 0) { + throw new Gio.IOErrorEnum({ + code: Gio.io_error_from_errno(status), + message: stderr ? stderr.trim() : GLib.strerror(status) + }); + } + + resolve(stdout.trim()); + } catch (e) { + reject(e); + } finally { + if (cancelId > 0) { + cancellable.disconnect(cancelId); + } + } + }); + }); +} + +// Converts a hex, rgb, or rgba CSS-like color string to four numbers +// representing rgba values. +export function parseColor(string) { + let color; + if (shellVersionIsAtLeast(47, 'alpha')) { + color = Cogl.Color.from_string(string)[1]; + } else { + color = Clutter.Color.from_string(string)[1]; + } + + + return [color.red / 255, color.green / 255, color.blue / 255, color.alpha / 255]; +} |