diff --git a/docs/changelog.md b/docs/changelog.md index 8399725..df202a9 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -14,6 +14,11 @@ SPDX-License-Identifier: CC-BY-4.0 #### Other Enhancements * **New donation method: Ko-fi**. Follow me on Ko-fi to get the latest updates regarding my extensions: https://ko-fi.com/schneegans! +* It is now possible to create effects which do not have any settings at all. + +#### Bug Fixes + +* The tutorial on how to create new effects has been updated and should work again. ## [Burn My Windows 27](https://github.com/schneegans/Burn-My-Windows/releases/tag/v27) diff --git a/docs/how-to-create-new-effects.md b/docs/how-to-create-new-effects.md index 36314f4..4c68a2e 100644 --- a/docs/how-to-create-new-effects.md +++ b/docs/how-to-create-new-effects.md @@ -49,7 +49,7 @@ You will have to ... For enabling the new effect, the boolean settings keys `simple-fade-enable-effect` and `simple-fade-animation-time` are required. In this example, we also add a floating point value for storing another property of the effect - we will use them later in the tutorial. -Just copy the XML code below to the file [`schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml`](../schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml). +Just copy the XML code below to the file [`schemas/org.gnome.shell.extensions.burn-my-windows-profile.gschema.xml`](../schemas/org.gnome.shell.extensions.burn-my-windows-profile.gschema.xml). Just remember to replace `simple-fade` with your custom name! ```xml @@ -86,6 +86,20 @@ Please study this code carefully, all of it is explained with inline comments. Expand this to show the GLSL code. ```glsl +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +////////////////////////////////////////////////////////////////////////////////////////// + +// SPDX-FileCopyrightText: Your Name +// SPDX-License-Identifier: GPL-3.0-or-later + // The content from common.glsl is automatically prepended to each shader effect. This // provides the standard input: @@ -214,7 +228,6 @@ var SimpleFade = class { // binds all user interface elements to the respective settings keys of the profile. bindPreferences(dialog) { // Empty for now... Code is added here later in the tutorial! - return null; } // ---------------------------------------------------------------- API for extension.js @@ -265,7 +278,8 @@ There should be two sliders in this example: The animation duration and the widt If your effect supports GNOME Shell 3.3x _and_ GNOME Shell 40+, you will have to provide three `*.ui` files for this. This is because starting with GNOME Shell 40, the preference dialog uses GTK4, before it used to use GTK3. Starting with GNOME Shell 42, it uses `libadwaita` which requires different UI files again. -We will load the respective file in the `bindPreferences()` method of your new effect class. + +_:information_source: If you do not have the means to test your effect on different versions of GNOME, feel free to submit a pull request for one GNOME version only, I may then port your effect to other GNOME versions!_ Just save the code below to `resources/ui/gtk3/simple-fade.ui`, `resources/ui/gtk4/simple-fade.ui`, and `resources/ui/adw/simple-fade.ui` respectively. Remember to replace any occurrence of `simple-fade` with your effect's nick-name! @@ -281,7 +295,7 @@ SPDX-FileCopyrightText: Your Name SPDX-License-Identifier: GPL-3.0-or-later --> - + 5000 @@ -297,106 +311,97 @@ SPDX-License-Identifier: GPL-3.0-or-later 0.1 - - vertical + - + + none + - - none - - + + 0 - - 0 + - + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + simple-fade-animation-time + + + + - - Animation Time [ms] - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - simple-fade-animation-time - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - + + edit-clear-symbolic + 1 + Reset to Default Value + + + + + + 0 - - 0 + - + + Fade Width + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + simple-fade-width + + + + - - Fade Width - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - simple-fade-width - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - + + edit-clear-symbolic + 1 + Reset to Default Value + - @@ -423,7 +428,7 @@ SPDX-FileCopyrightText: Your Name SPDX-License-Identifier: GPL-3.0-or-later --> - + 5000 @@ -439,97 +444,87 @@ SPDX-License-Identifier: GPL-3.0-or-later 0.1 - - vertical + - + + none + - - none - 1 - - + + 0 - - 0 + - - - - Animation Time [ms] - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - simple-fade-animation-time - - - - - edit-clear-symbolic - Reset to Default Value - - - + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + simple-fade-animation-time + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + 0 - - 0 + - - - - Fade Width - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - simple-fade-width - - - - - edit-clear-symbolic - Reset to Default Value - - - + + Fade Width + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + simple-fade-width + + + + + edit-clear-symbolic + Reset to Default Value + - @@ -570,7 +565,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 0.1 - + diff --git a/prefs.js b/prefs.js index d992ae8..82d7614 100644 --- a/prefs.js +++ b/prefs.js @@ -227,8 +227,16 @@ var PreferencesDialog = class PreferencesDialog { const [minMajor, minMinor] = effect.getMinShellVersion(); if (utils.shellVersionIsAtLeast(minMajor, minMinor)) { - const uiFile = `/ui/${utils.getUIDir()}/${effect.getNick()}.ui`; - const [hasPrefs] = Gio.resources_get_info(uiFile, 0); + const uiFile = `/ui/${utils.getUIDir()}/${effect.getNick()}.ui`; + + // Is there a better way to test for the existence of a resource file? + let hasPrefs = false; + try { + Gio.resources_get_info(uiFile, 0); + hasPrefs = true; + } catch (e) { + // Nothing todo, there + } // Add the settings page to the builder. if (hasPrefs) { @@ -288,9 +296,11 @@ var PreferencesDialog = class PreferencesDialog { } }); this._effectRows.push(row); + row.add_action(previewButton); + } else { + row.add_suffix(previewButton); } - row.add_action(previewButton); row.add_prefix(button); group.add(row);