diff --git a/prefs.js b/prefs.js
index df91abc..cfb1e20 100644
--- a/prefs.js
+++ b/prefs.js
@@ -51,6 +51,10 @@ var PreferencesDialog = class PreferencesDialog {
this._bindColorButton('fire-color-3');
this._bindColorButton('fire-color-4');
this._bindColorButton('fire-color-5');
+ this._bindAdjustment('matrix-scale');
+ this._bindAdjustment('matrix-randomness');
+ this._bindColorButton('matrix-trail-color');
+ this._bindColorButton('matrix-tip-color');
// The fire-gradient-reset button needs to by bound explicitly.
this._builder.get_object('reset-fire-colors').connect('clicked', () => {
@@ -99,7 +103,8 @@ var PreferencesDialog = class PreferencesDialog {
}
// Colors are stored as strings like 'rgb(1, 0.5, 0)'. As Gio.Settings.bind_with_mapping
- // is not available yet, we need to do the color conversion manually.
+ // is not available yet, we need to do the color conversion manually. It also binds the
+ // corresponding reset button.
_bindColorButton(settingsKey) {
const button = this._builder.get_object(settingsKey);
@@ -120,6 +125,8 @@ var PreferencesDialog = class PreferencesDialog {
// Initialize the button with the state in the settings.
settingSignalHandler();
+
+ this._bindResetButton(settingsKey);
}
// Connects any widget's property to a settings key. The widget must have the same ID as
@@ -129,6 +136,12 @@ var PreferencesDialog = class PreferencesDialog {
settingsKey, this._builder.get_object(settingsKey), property,
Gio.SettingsBindFlags.DEFAULT);
+ this._bindResetButton(settingsKey);
+ }
+
+ // Searches for a reset button for the given settings key and make it reset the settings
+ // key when clicked.
+ _bindResetButton(settingsKey) {
const resetButton = this._builder.get_object('reset-' + settingsKey);
if (resetButton) {
resetButton.connect('clicked', () => {
diff --git a/resources/ui/gtk4.ui b/resources/ui/gtk4.ui
index 170b315..01046c9 100644
--- a/resources/ui/gtk4.ui
+++ b/resources/ui/gtk4.ui
@@ -283,6 +283,199 @@
+
+
+
+
+
+
+
+
+ none
+ 1
+
+
+
+
+ 0
+
+
+
+
+ Matrix Scale
+ 0
+ start
+ center
+ 1
+
+
+
+
+ end
+ center
+ 1
+ 0
+ left
+ 300
+
+
+ 50
+ 5
+ 1
+ 4
+
+
+
+
+
+
+ edit-clear-symbolic
+ Reset to Default Value
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Matrix Randomness
+ 0
+ start
+ center
+ 1
+
+
+
+
+ end
+ center
+ 1
+ 2
+ left
+ 300
+
+
+ 1.0
+ 0.0
+ 0.01
+ 0.1
+
+
+
+
+
+
+ edit-clear-symbolic
+ Reset to Default Value
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Trail Color
+ 0
+ start
+ center
+ 1
+
+
+
+
+ 0
+ 1
+
+
+
+
+ edit-clear-symbolic
+ Reset to Default Value
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Tip Color
+ 0
+ start
+ center
+ 1
+
+
+
+
+ 0
+ 1
+
+
+
+
+ edit-clear-symbolic
+ Reset to Default Value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml
index dc4e287..6ff4329 100644
--- a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml
@@ -51,6 +51,31 @@
The fifth color of the fire gradient.
+
+
+ 20
+ Matrix Scale
+ The size of the matrix letters.
+
+
+
+ 1.0
+ Matrix Randomness
+ The randomness of the matrix effect.
+
+
+
+ "rgb(255, 255, 255)"
+ Matrix Tip Color
+ The color of the matrix trail tips.
+
+
+
+ "rgb(25, 255, 89)"
+ Matrix Trail Color
+ The color matrix trails.
+
+
\ No newline at end of file
diff --git a/src/extension/MatrixShader.js b/src/extension/MatrixShader.js
index 0f453e8..d6df16d 100644
--- a/src/extension/MatrixShader.js
+++ b/src/extension/MatrixShader.js
@@ -36,6 +36,11 @@ var MatrixShader = GObject.registerClass({Properties: {}, Signals: {}},
fontData.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888,
fontData.width, fontData.height, fontData.rowstride);
+ const trailColor =
+ Clutter.Color.from_string(settings.get_string('matrix-trail-color'))[1];
+ const tipColor =
+ Clutter.Color.from_string(settings.get_string('matrix-tip-color'))[1];
+
// This is partially based on https://www.shadertoy.com/view/ldccW4 (CC-BY-NC-SA).
this.set_shader_source(`
@@ -51,9 +56,9 @@ var MatrixShader = GObject.registerClass({Properties: {}, Signals: {}},
const float TRAIL_LENGTH = 0.2;
const float FINAL_FADE_START_TIME = 0.8;
const float LETTER_TILES = 16.0;
- const float LETTER_SIZE = 20.0;
+ const float LETTER_SIZE = ${settings.get_int('matrix-scale')};
const float LETTER_FLICKER_SPEED = 2.0;
- const float RANDOMNESS = 1.0;
+ const float RANDOMNESS = ${settings.get_double('matrix-randomness')};
// This returns a flickering grid of random letters.
float getText(vec2 fragCoord) {
@@ -106,8 +111,12 @@ var MatrixShader = GObject.registerClass({Properties: {}, Signals: {}},
rainAlpha *= clamp((uSizeY - pos.y) / EDGE_FADE, 0, 1);
// Add the matrix effect to the window.
- vec3 trailColor = vec3(0.1,1,0.35);
- vec3 tipColor = vec3(1,1,1);
+ vec3 trailColor = vec3(${trailColor.red / 255},
+ ${trailColor.green / 255},
+ ${trailColor.blue / 255});
+ vec3 tipColor = vec3(${tipColor.red / 255},
+ ${tipColor.green / 255},
+ ${tipColor.blue / 255});
cogl_color_out.rgb += mix(trailColor, tipColor, pow(rainAlpha, 5)) * rainAlpha * text;
// These are pretty useful for understanding how this works.