diff --git a/docs/how-to-create-new-effects.md b/docs/how-to-create-new-effects.md index 6ddc66e..2c3a6db 100644 --- a/docs/how-to-create-new-effects.md +++ b/docs/how-to-create-new-effects.md @@ -71,7 +71,7 @@ Just remember to replace `simple-fade` with your custom name! ### 2. Creating the Effect Class -You will have to create a new file called `src/SimpleFadeEffect.js` and paste the following code to it. +You will have to create a new file called `src/SimpleFade.js` and paste the following code to it. Please study this code carefully, all of it is explained with inline comments.
@@ -110,7 +110,7 @@ let Shader = null; // The effect class is completely static. It 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. -var SimpleFadeEffect = class SimpleFadeEffect { +var SimpleFade = class SimpleFade { // ---------------------------------------------------------------------------- metadata @@ -233,7 +233,7 @@ Like this: ```javascript const ALL_EFFECTS = [ ... - Me.imports.src.SimpleFadeEffect.SimpleFadeEffect, + Me.imports.src.SimpleFade.SimpleFade, ... ]; ``` @@ -555,8 +555,8 @@ static initPreferences(dialog) { // Finally, append the settings page to the main stack. const stack = dialog.getBuilder().get_object('main-stack'); stack.add_titled( - dialog.getBuilder().get_object(SimpleFadeEffect.getNick() + '-prefs'), - SimpleFadeEffect.getNick(), SimpleFadeEffect.getLabel()); + dialog.getBuilder().get_object(SimpleFade.getNick() + '-prefs'), + SimpleFade.getNick(), SimpleFade.getLabel()); } ``` diff --git a/extension.js b/extension.js index 33145c9..51a4292 100644 --- a/extension.js +++ b/extension.js @@ -22,15 +22,14 @@ const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DEL const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); const utils = Me.imports.src.utils; -const FireEffect = Me.imports.src.FireEffect.FireEffect; // New effects must be registered here and in prefs.js. const ALL_EFFECTS = [ - Me.imports.src.FireEffect.FireEffect, - Me.imports.src.MatrixEffect.MatrixEffect, - Me.imports.src.TRexEffect.TRexEffect, + Me.imports.src.Fire.Fire, + Me.imports.src.Matrix.Matrix, + Me.imports.src.TRexAttack.TRexAttack, Me.imports.src.TVEffect.TVEffect, - Me.imports.src.WispsEffect.WispsEffect, + Me.imports.src.Wisps.Wisps, ]; ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/prefs.js b/prefs.js index 73fbc71..1c10224 100644 --- a/prefs.js +++ b/prefs.js @@ -21,11 +21,11 @@ const utils = Me.imports.src.utils; // New effects must be registered here and in extension.js. const ALL_EFFECTS = [ - Me.imports.src.FireEffect.FireEffect, - Me.imports.src.MatrixEffect.MatrixEffect, - Me.imports.src.TRexEffect.TRexEffect, + Me.imports.src.Fire.Fire, + Me.imports.src.Matrix.Matrix, + Me.imports.src.TRexAttack.TRexAttack, Me.imports.src.TVEffect.TVEffect, - Me.imports.src.WispsEffect.WispsEffect, + Me.imports.src.Wisps.Wisps, ]; ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/FireEffect.js b/src/Fire.js similarity index 98% rename from src/FireEffect.js rename to src/Fire.js index 94bf2bc..55a4a38 100644 --- a/src/FireEffect.js +++ b/src/Fire.js @@ -33,7 +33,7 @@ let Shader = null; // The effect class is completely static. It 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. -var FireEffect = class FireEffect { +var Fire = class Fire { // ---------------------------------------------------------------------------- metadata @@ -86,13 +86,12 @@ var FireEffect = class FireEffect { }); // Initialize the fire-preset dropdown. - FireEffect._createFirePresets(dialog); + Fire._createFirePresets(dialog); // Finally, append the settings page to the main stack. const stack = dialog.getBuilder().get_object('main-stack'); stack.add_titled( - dialog.getBuilder().get_object('fire-prefs'), FireEffect.getNick(), - FireEffect.getLabel()); + dialog.getBuilder().get_object('fire-prefs'), Fire.getNick(), Fire.getLabel()); } // ---------------------------------------------------------------- API for extension.js diff --git a/src/MatrixEffect.js b/src/Matrix.js similarity index 98% rename from src/MatrixEffect.js rename to src/Matrix.js index b35ce83..a879ff5 100644 --- a/src/MatrixEffect.js +++ b/src/Matrix.js @@ -33,7 +33,7 @@ let Shader = null; // The effect class is completely static. It 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. -var MatrixEffect = class MatrixEffect { +var Matrix = class Matrix { // ---------------------------------------------------------------------------- metadata @@ -75,8 +75,8 @@ var MatrixEffect = class MatrixEffect { // Finally, append the settings page to the main stack. const stack = dialog.getBuilder().get_object('main-stack'); stack.add_titled( - dialog.getBuilder().get_object('matrix-prefs'), MatrixEffect.getNick(), - MatrixEffect.getLabel()); + dialog.getBuilder().get_object('matrix-prefs'), Matrix.getNick(), + Matrix.getLabel()); } // ---------------------------------------------------------------- API for extension.js diff --git a/src/TRexEffect.js b/src/TRexAttack.js similarity index 98% rename from src/TRexEffect.js rename to src/TRexAttack.js index 7268e80..99286de 100644 --- a/src/TRexEffect.js +++ b/src/TRexAttack.js @@ -31,7 +31,7 @@ let Shader = null; // The effect class is completely static. It 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. -var TRexEffect = class TRexEffect { +var TRexAttack = class TRexAttack { // ---------------------------------------------------------------------------- metadata @@ -73,8 +73,8 @@ var TRexEffect = class TRexEffect { // Finally, append the settings page to the main stack. const stack = dialog.getBuilder().get_object('main-stack'); stack.add_titled( - dialog.getBuilder().get_object('trex-prefs'), TRexEffect.getNick(), - TRexEffect.getLabel()); + dialog.getBuilder().get_object('trex-prefs'), TRexAttack.getNick(), + TRexAttack.getLabel()); } // ---------------------------------------------------------------- API for extension.js diff --git a/src/WispsEffect.js b/src/Wisps.js similarity index 98% rename from src/WispsEffect.js rename to src/Wisps.js index d8a7b07..411a793 100644 --- a/src/WispsEffect.js +++ b/src/Wisps.js @@ -30,7 +30,7 @@ let Shader = null; // The effect class is completely static. It 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. -var WispsEffect = class WispsEffect { +var Wisps = class Wisps { // ---------------------------------------------------------------------------- metadata @@ -69,8 +69,7 @@ var WispsEffect = class WispsEffect { // Finally, append the settings page to the main stack. const stack = dialog.getBuilder().get_object('main-stack'); stack.add_titled( - dialog.getBuilder().get_object('wisps-prefs'), WispsEffect.getNick(), - WispsEffect.getLabel()); + dialog.getBuilder().get_object('wisps-prefs'), Wisps.getNick(), Wisps.getLabel()); } // ---------------------------------------------------------------- API for extension.js