🔀 Merge pull request #448 from Schneegans/feature/gnome-47
This commit is contained in:
@@ -91,7 +91,6 @@ jobs:
|
||||
matrix:
|
||||
version:
|
||||
- "39"
|
||||
- "rawhide"
|
||||
session:
|
||||
- "gnome-xsession"
|
||||
- "gnome-wayland-nested"
|
||||
|
||||
@@ -9,6 +9,10 @@ SPDX-License-Identifier: CC-BY-4.0
|
||||
|
||||
**Release Date:** TBD
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- Ported the extension to GNOME 47.
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Fixed an issue in the KDE metadata files which caused a warning in the logs on KDE Plasma 6. Thanks to [@nask0](https://github.com/nask0) for the fix!
|
||||
|
||||
+3
-2
@@ -11,8 +11,9 @@
|
||||
"settings-schema": "org.gnome.shell.extensions.burn-my-windows",
|
||||
"shell-version": [
|
||||
"45",
|
||||
"46"
|
||||
"46",
|
||||
"47"
|
||||
],
|
||||
"url": "https://github.com/Schneegans/Burn-My-Windows",
|
||||
"version": 41
|
||||
"version": 43
|
||||
}
|
||||
@@ -46,23 +46,6 @@ import TVGlitch from './src/effects/TVGlitch.js';
|
||||
import Wisps from './src/effects/Wisps.js';
|
||||
|
||||
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
import * as Config from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js';
|
||||
|
||||
const [GS_MAJOR, GS_MINOR] = Config.PACKAGE_VERSION.split('.').map(toNumericVersion);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Currently, the extension supports only one set of UI files. In the past, there were
|
||||
// three different sets for GTK3, GTK4, and Adwaita. This method returns the name of the
|
||||
@@ -71,21 +54,6 @@ function getUIDir() {
|
||||
return 'adw';
|
||||
}
|
||||
|
||||
// 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.
|
||||
function shellVersionIsAtLeast(major, minor) {
|
||||
if (GS_MAJOR > major) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GS_MAJOR == major) {
|
||||
return GS_MINOR >= toNumericVersion(minor);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The preferences dialog is organized in pages, each of which is loaded from a //
|
||||
// separate ui file. There's one page with general options, all other paged are loaded //
|
||||
@@ -231,7 +199,7 @@ export default class BurnMyWindowsPreferences extends ExtensionPreferences {
|
||||
// Now add all the rows.
|
||||
this._ALL_EFFECTS.forEach(effect => {
|
||||
const [minMajor, minMinor] = effect.getMinShellVersion();
|
||||
if (shellVersionIsAtLeast(minMajor, minMinor)) {
|
||||
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
|
||||
|
||||
const uiFile = `/ui/${getUIDir()}/${effect.getNick()}.ui`;
|
||||
|
||||
@@ -691,7 +659,7 @@ GitHub: <a href='https://github.com/sponsors/schneegans'>https://github.com/spon
|
||||
// Connect all effect settings.
|
||||
this._ALL_EFFECTS.forEach(effect => {
|
||||
const [minMajor, minMinor] = effect.getMinShellVersion();
|
||||
if (shellVersionIsAtLeast(minMajor, minMinor)) {
|
||||
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
|
||||
this.bindSwitch(`${effect.getNick()}-enable-effect`);
|
||||
effect.bindPreferences(this);
|
||||
}
|
||||
|
||||
@@ -45,10 +45,8 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('energize-a-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
||||
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
|
||||
});
|
||||
|
||||
@@ -45,10 +45,8 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('energize-b-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
||||
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
|
||||
});
|
||||
|
||||
+1
-2
@@ -61,10 +61,9 @@ export default class Effect {
|
||||
// And update all uniforms at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings) => {
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
const c = Clutter.Color.from_string(settings.get_string('fire-color-' + i))[1];
|
||||
shader.set_uniform_float(
|
||||
shader._uGradient[i - 1], 4,
|
||||
[c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||
utils.parseColor(settings.get_string('fire-color-' + i)));
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
||||
@@ -48,11 +48,9 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('glitch-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
|
||||
shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||
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')]);
|
||||
|
||||
@@ -50,20 +50,13 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
// Get the two configurable colors. They are directly injected into the shader
|
||||
// code below.
|
||||
const gc =
|
||||
Clutter.Color.from_string(settings.get_string('hexagon-glow-color'))[1];
|
||||
const lc =
|
||||
Clutter.Color.from_string(settings.get_string('hexagon-line-color'))[1];
|
||||
|
||||
// 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, [gc.red / 255, gc.green / 255, gc.blue / 255, gc.alpha / 255]);
|
||||
shader.set_uniform_float(shader._uLineColor, 4, [lc.red / 255, lc.green / 255, lc.blue / 255, lc.alpha / 255]);
|
||||
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
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,11 +72,9 @@ export default class Effect {
|
||||
shader._startPointerPos = null;
|
||||
}
|
||||
|
||||
const c = Clutter.Color.from_string(settings.get_string('incinerate-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uSeed, 2, seed);
|
||||
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
||||
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
|
||||
|
||||
@@ -65,13 +65,9 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings) => {
|
||||
const c1 =
|
||||
Clutter.Color.from_string(settings.get_string('matrix-trail-color'))[1];
|
||||
const c2 = Clutter.Color.from_string(settings.get_string('matrix-tip-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uTrailColor, 3, [c1.red / 255, c1.green / 255, c1.blue / 255]);
|
||||
shader.set_uniform_float(shader._uTipColor, 3, [c2.red / 255, c2.green / 255, c2.blue / 255]);
|
||||
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')]);
|
||||
|
||||
@@ -49,11 +49,9 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('portal-color'))[1];
|
||||
|
||||
// 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, [c.red / 255, c.green / 255, c.blue / 255]);
|
||||
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')]);
|
||||
|
||||
@@ -63,11 +63,8 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
// The dust particles will fade to this color over time.
|
||||
const c = Clutter.Color.from_string(settings.get_string('snap-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uDustColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||
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
|
||||
|
||||
@@ -61,10 +61,8 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('trex-scratch-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uFlashColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||
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')]);
|
||||
|
||||
@@ -46,9 +46,8 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('tv-effect-color'))[1];
|
||||
shader.set_uniform_float(
|
||||
shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||
shader._uColor, 4, utils.parseColor(settings.get_string('tv-effect-color')));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,11 +49,9 @@ export default class Effect {
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('tv-glitch-color'))[1];
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
|
||||
shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||
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')]);
|
||||
|
||||
@@ -52,9 +52,9 @@ export default class Effect {
|
||||
// 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++) {
|
||||
const c = Clutter.Color.from_string(settings.get_string('wisps-color-' + i))[1];
|
||||
shader.set_uniform_float(shader._uColor[i - 1], 3,
|
||||
[c.red / 255, c.green / 255, c.blue / 255]);
|
||||
shader.set_uniform_float(
|
||||
shader._uColor[i - 1], 3,
|
||||
utils.parseColor(settings.get_string('wisps-color-' + i)));
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
||||
@@ -17,6 +17,61 @@
|
||||
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 Clutter = await importInShellOnly('gi://Clutter');
|
||||
const Cogl = await importInShellOnly('gi://Cogl');
|
||||
|
||||
// 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
|
||||
@@ -104,3 +159,17 @@ export async function executeCommand(argv, input = null, cancellable = null) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user