Add Semiwillekeurig mix mode (HSV hue from windowClass) and HSV hues for Willekeurig
Named colours 0–10 unchanged. MixColor 11 = Willekeurig (seq × golden angle → hue), 12 = Semiwillekeurig (FNV-1a hash of window.windowClass → hue). Both use HSV S=1, V=2/3 (same peak channel as #aa… glass colours), not a fixed extra palette. Empty windowClass → black. Shader decodes tk>=1000 as HSV. Tooltip explains the difference. Static Node checks in tools/test-semiwillekeurig-tint.mjs (KWin hand-test still required).
@@ -41,7 +41,7 @@ it does not show up.
41
41
| `Gravity` | 4500 px/s² | Fall acceleration; fall time = sqrt(2·distance / g) (close: 1.5 screen heights; minimize: distance to taskbar entry) |
42
42
| `BlackMixOuter` | 80 % | Black mix on the outer/lower part of the marble (dull "black glass") |
43
43
| `BlackMixCenter` | 5 % | Black mix on the upper-middle part, where the window shows through; soft gradient between both zones |
44
| `MixColor` | 0 (Zwart) | Colour the mix blends towards: 0 Zwart #000000, 1 Blauw #0000aa, 2 Rood #aa0000, 3 Groen #00aa00, 4 Paars #6600aa, 5 Geel #aaaa00, 6 Oranje #aa5500, 7 Cyaan #00aaaa, 8 Roze #aa0066, 9 Grijs #555555, 10 Bruin #553300, 11 Willekeurig (random per window; minimize and the following restore of that window use the same colour). Values above 11 (e.g. 12 = random in v0.3.0) are treated as random, invalid values as black |
44
| `MixColor` | 0 (Zwart) | Mix target: 0–10 named colours (unchanged). **11 Willekeurig**: next window → new hue (golden-angle sequence), HSV S=1 V≈0.667. **12 Semiwillekeurig**: hue from hash(`window.windowClass`), same HSV; empty class → black. Values >12 clamp to 12. |
45
45
| `MarbleSize` | 42 px | Final marble diameter, independent of the window size (capped at 90 % of the window's smallest side) |
46
46
47
47
All durations are scaled by Plasma's global animation speed.
@@ -41,7 +41,7 @@ it does not show up.41
| `Gravity` | 4500 px/s² | Fall acceleration; fall time = sqrt(2·distance / g) (close: 1.5 screen heights; minimize: distance to taskbar entry) |41
| `Gravity` | 4500 px/s² | Fall acceleration; fall time = sqrt(2·distance / g) (close: 1.5 screen heights; minimize: distance to taskbar entry) |42
| `BlackMixOuter` | 80 % | Black mix on the outer/lower part of the marble (dull "black glass") |42
| `BlackMixOuter` | 80 % | Black mix on the outer/lower part of the marble (dull "black glass") |43
| `BlackMixCenter` | 5 % | Black mix on the upper-middle part, where the window shows through; soft gradient between both zones |43
| `BlackMixCenter` | 5 % | Black mix on the upper-middle part, where the window shows through; soft gradient between both zones |44
| `MixColor` | 0 (Zwart) | Colour the mix blends towards: 0 Zwart #000000, 1 Blauw #0000aa, 2 Rood #aa0000, 3 Groen #00aa00, 4 Paars #6600aa, 5 Geel #aaaa00, 6 Oranje #aa5500, 7 Cyaan #00aaaa, 8 Roze #aa0066, 9 Grijs #555555, 10 Bruin #553300, 11 Willekeurig (random per window; minimize and the following restore of that window use the same colour). Values above 11 (e.g. 12 = random in v0.3.0) are treated as random, invalid values as black |44
| `MixColor` | 0 (Zwart) | Mix target: 0–10 named colours (unchanged). **11 Willekeurig**: next window → new hue (golden-angle sequence), HSV S=1 V≈0.667. **12 Semiwillekeurig**: hue from hash(`window.windowClass`), same HSV; empty class → black. Values >12 clamp to 12. |45
| `MarbleSize` | 42 px | Final marble diameter, independent of the window size (capped at 90 % of the window's smallest side) |45
| `MarbleSize` | 42 px | Final marble diameter, independent of the window size (capped at 90 % of the window's smallest side) |46
46
47
All durations are scaled by Plasma's global animation speed.47
All durations are scaled by Plasma's global animation speed.@@ -84,9 +84,9 @@ class BurnMyWindowsMarbleEffect {
84
84
// free fall from rest: d = 0.5 g t^2 -> t = sqrt(2d/g); scaled by the global speed factor
85
85
this.fallDuration = animationTime(Math.round(1000 * Math.sqrt(2 * this.fallDistance / this.gravity)));
86
86
effect.setUniform(this.shader, 'uDuration', (this.duration + this.pause + this.fallDuration) * 0.001);
87
// 0..10 colours, 11 = random. Values saved by v0.3.0 (10 = white, 12 = random) fall back safely.
87
// 0..10 named colours, 11 = Willekeurig, 12 = Semiwillekeurig. Older >12 → 12.
88
88
let mc = Math.floor(Number(effect.readConfig('MixColor', 0)));
89
if (!(mc >= 0)) mc = 0; else if (mc > 11) mc = 11;
89
if (!(mc >= 0)) mc = 0; else if (mc > 12) mc = 12;
90
90
this.tintMode = mc;
91
91
this.applyTint(null, false);
92
92
effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
@@ -97,29 +97,68 @@ class BurnMyWindowsMarbleEffect {
97
97
effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
98
98
}
99
99
100
// Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
101
// window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
102
// uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
100
crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }
101
102
103
// Mix target. tintMode 0..10 = named colours; 11 = Willekeurig (seq → hue);
104
// 12 = Semiwillekeurig (hash of window.windowClass → hue). Random modes use HSV
105
// with fixed S=1 and V=0.6667 (matches the named #aa… glass colours), not a palette.
103
106
prog(window, m) {
104
107
const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));
105
108
if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);
106
109
return v;
107
110
}
108
111
109
crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }
112
hsvToRgb(h, s, v) {
113
const c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c;
114
let r = 0, g = 0, b = 0;
115
if (h < 60) { r = c; g = x; }
116
else if (h < 120) { r = x; g = c; }
117
else if (h < 180) { g = c; b = x; }
118
else if (h < 240) { g = x; b = c; }
119
else if (h < 300) { r = x; b = c; }
120
else { r = c; b = x; }
121
return [r + m, g + m, b + m];
122
}
123
124
hashHue(str) {
125
let h = 2166136261;
126
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); }
127
return (h >>> 0) % 360;
128
}
110
129
111
130
applyTint(window, reuse) {
112
const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
113
let c;
114
if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
115
else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
116
else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)
131
const FIXED = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
132
const HS = 1.0, HV = 0.6667; // same peak channel as #aa0000 / #0000aa / …
133
let c, hue = null;
134
if (this.tintMode < FIXED.length) {
135
c = FIXED[this.tintMode];
136
if (window) { window.bmwTint = null; window.bmwHue = null; }
137
} else if (this.tintMode === 12 && window) {
138
// Semiwillekeurig: stable per application (windowClass); empty → black
139
const cls = String(window.windowClass || '').trim();
140
if (!cls) { c = FIXED[0]; hue = null; }
141
else { hue = this.hashHue(cls); c = this.hsvToRgb(hue, HS, HV); }
142
window.bmwTint = c; window.bmwHue = hue;
143
} else if (window && reuse && window.bmwTint) {
144
c = window.bmwTint; hue = (window.bmwHue == null ? null : window.bmwHue);
145
window.bmwTint = null;
146
} else if (window) {
147
// Willekeurig: next sequence number → hue spaced by ~golden angle
117
148
if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);
118
c = C[window.bmwSeq % C.length]; window.bmwTint = c;
149
hue = Math.floor((window.bmwSeq * 137.508) % 360);
150
c = this.hsvToRgb(hue, HS, HV);
151
window.bmwTint = c; window.bmwHue = hue;
152
} else {
153
c = FIXED[0];
154
}
155
if (window) {
156
// Shader: tk < 11 → named table; tk >= 1000 → HSV hue = tk - 1000
157
window.bmwBase = (hue == null)
158
? 4096 * Math.max(0, FIXED.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2]))
159
: 4096 * (1000 + (hue | 0));
119
160
}
120
else c = C[0];
121
if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
122
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);
161
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' class=' + window.windowClass + ' seq=' + window.bmwSeq + ' hue=' + hue + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase);
123
162
effect.setUniform(this.shader, 'uTintR', c[0]);
124
163
effect.setUniform(this.shader, 'uTintG', c[1]);
125
164
effect.setUniform(this.shader, 'uTintB', c[2]);
@@ -84,9 +84,9 @@ class BurnMyWindowsMarbleEffect {84
// free fall from rest: d = 0.5 g t^2 -> t = sqrt(2d/g); scaled by the global speed factor84
// free fall from rest: d = 0.5 g t^2 -> t = sqrt(2d/g); scaled by the global speed factor85
this.fallDuration = animationTime(Math.round(1000 * Math.sqrt(2 * this.fallDistance / this.gravity)));85
this.fallDuration = animationTime(Math.round(1000 * Math.sqrt(2 * this.fallDistance / this.gravity)));86
effect.setUniform(this.shader, 'uDuration', (this.duration + this.pause + this.fallDuration) * 0.001);86
effect.setUniform(this.shader, 'uDuration', (this.duration + this.pause + this.fallDuration) * 0.001);87
// 0..10 colours, 11 = random. Values saved by v0.3.0 (10 = white, 12 = random) fall back safely.87
// 0..10 named colours, 11 = Willekeurig, 12 = Semiwillekeurig. Older >12 → 12.88
let mc = Math.floor(Number(effect.readConfig('MixColor', 0)));88
let mc = Math.floor(Number(effect.readConfig('MixColor', 0)));89
if (!(mc >= 0)) mc = 0; else if (mc > 11) mc = 11;89
if (!(mc >= 0)) mc = 0; else if (mc > 12) mc = 12;90
this.tintMode = mc;90
this.tintMode = mc;91
this.applyTint(null, false);91
this.applyTint(null, false);92
effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));92
effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));@@ -97,29 +97,68 @@ class BurnMyWindowsMarbleEffect {97
effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));97
effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));98
}98
}99
99
100
// Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this100
crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }101
// window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.101
102
// uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)102
103
// Mix target. tintMode 0..10 = named colours; 11 = Willekeurig (seq → hue);104
// 12 = Semiwillekeurig (hash of window.windowClass → hue). Random modes use HSV105
// with fixed S=1 and V=0.6667 (matches the named #aa… glass colours), not a palette.103
prog(window, m) {106
prog(window, m) {104
const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));107
const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));105
if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);108
if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);106
return v;109
return v;107
}110
}108
111
109
crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }112
hsvToRgb(h, s, v) {113
const c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c;114
let r = 0, g = 0, b = 0;115
if (h < 60) { r = c; g = x; }116
else if (h < 120) { r = x; g = c; }117
else if (h < 180) { g = c; b = x; }118
else if (h < 240) { g = x; b = c; }119
else if (h < 300) { r = x; b = c; }120
else { r = c; b = x; }121
return [r + m, g + m, b + m];122
}123
124
hashHue(str) {125
let h = 2166136261;126
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); }127
return (h >>> 0) % 360;128
}110
129
111
applyTint(window, reuse) {130
applyTint(window, reuse) {112
const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];131
const FIXED = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];113
let c;132
const HS = 1.0, HV = 0.6667; // same peak channel as #aa0000 / #0000aa / …114
if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }133
let c, hue = null;115
else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }134
if (this.tintMode < FIXED.length) {116
else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)135
c = FIXED[this.tintMode];136
if (window) { window.bmwTint = null; window.bmwHue = null; }137
} else if (this.tintMode === 12 && window) {138
// Semiwillekeurig: stable per application (windowClass); empty → black139
const cls = String(window.windowClass || '').trim();140
if (!cls) { c = FIXED[0]; hue = null; }141
else { hue = this.hashHue(cls); c = this.hsvToRgb(hue, HS, HV); }142
window.bmwTint = c; window.bmwHue = hue;143
} else if (window && reuse && window.bmwTint) {144
c = window.bmwTint; hue = (window.bmwHue == null ? null : window.bmwHue);145
window.bmwTint = null;146
} else if (window) {147
// Willekeurig: next sequence number → hue spaced by ~golden angle117
if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);148
if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);118
c = C[window.bmwSeq % C.length]; window.bmwTint = c;149
hue = Math.floor((window.bmwSeq * 137.508) % 360);150
c = this.hsvToRgb(hue, HS, HV);151
window.bmwTint = c; window.bmwHue = hue;152
} else {153
c = FIXED[0];154
}155
if (window) {156
// Shader: tk < 11 → named table; tk >= 1000 → HSV hue = tk - 1000157
window.bmwBase = (hue == null)158
? 4096 * Math.max(0, FIXED.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2]))159
: 4096 * (1000 + (hue | 0));119
}160
}120
else c = C[0];161
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' class=' + window.windowClass + ' seq=' + window.bmwSeq + ' hue=' + hue + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase);121
if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress122
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);123
effect.setUniform(this.shader, 'uTintR', c[0]);162
effect.setUniform(this.shader, 'uTintR', c[0]);124
effect.setUniform(this.shader, 'uTintG', c[1]);163
effect.setUniform(this.shader, 'uTintG', c[1]);125
effect.setUniform(this.shader, 'uTintB', c[2]);164
effect.setUniform(this.shader, 'uTintB', c[2]);@@ -752,15 +752,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble
752
752
uniform float uMixCenter; // 0..1 black mix, centre/top zone
753
753
754
754
void main() {
755
// per-window state lives in uProgress (setUniform is global for all windows):
756
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete
755
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m
756
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667
757
757
float tk = floor(uProgress / 4096.0);
758
758
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);
759
759
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)
760
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
761
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
762
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
763
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
760
vec3 tint;
761
if (tk >= 999.5) {
762
float h = clamp(tk - 1000.0, 0.0, 359.0);
763
float s = 1.0, v = 0.6667;
764
float ch = v * s;
765
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));
766
float m = v - ch;
767
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)
768
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)
769
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);
770
tint = rgb + vec3(m);
771
} else {
772
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
773
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
774
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
775
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
776
}
764
777
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive
765
778
if (uDuration < -1.0) c = 0.0; // keep uDuration alive
766
779
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep
@@ -752,15 +752,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble752
uniform float uMixCenter; // 0..1 black mix, centre/top zone752
uniform float uMixCenter; // 0..1 black mix, centre/top zone753
753
754
void main() {754
void main() {755
// per-window state lives in uProgress (setUniform is global for all windows):755
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m756
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete756
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667757
float tk = floor(uProgress / 4096.0);757
float tk = floor(uProgress / 4096.0);758
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);758
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);759
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)759
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)760
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)760
vec3 tint;761
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)761
if (tk >= 999.5) {762
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)762
float h = clamp(tk - 1000.0, 0.0, 359.0);763
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);763
float s = 1.0, v = 0.6667;764
float ch = v * s;765
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));766
float m = v - ch;767
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)768
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)769
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);770
tint = rgb + vec3(m);771
} else {772
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)773
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)774
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)775
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);776
}764
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive777
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive765
if (uDuration < -1.0) c = 0.0; // keep uDuration alive778
if (uDuration < -1.0) c = 0.0; // keep uDuration alive766
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep779
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep@@ -753,15 +753,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble
753
753
uniform float uMixCenter; // 0..1 black mix, centre/top zone
754
754
755
755
void main() {
756
// per-window state lives in uProgress (setUniform is global for all windows):
757
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete
756
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m
757
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667
758
758
float tk = floor(uProgress / 4096.0);
759
759
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);
760
760
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)
761
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
762
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
763
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
764
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
761
vec3 tint;
762
if (tk >= 999.5) {
763
float h = clamp(tk - 1000.0, 0.0, 359.0);
764
float s = 1.0, v = 0.6667;
765
float ch = v * s;
766
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));
767
float m = v - ch;
768
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)
769
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)
770
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);
771
tint = rgb + vec3(m);
772
} else {
773
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
774
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
775
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
776
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
777
}
765
778
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive
766
779
if (uDuration < -1.0) c = 0.0; // keep uDuration alive
767
780
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep
@@ -753,15 +753,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble753
uniform float uMixCenter; // 0..1 black mix, centre/top zone753
uniform float uMixCenter; // 0..1 black mix, centre/top zone754
754
755
void main() {755
void main() {756
// per-window state lives in uProgress (setUniform is global for all windows):756
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m757
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete757
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667758
float tk = floor(uProgress / 4096.0);758
float tk = floor(uProgress / 4096.0);759
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);759
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);760
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)760
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)761
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)761
vec3 tint;762
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)762
if (tk >= 999.5) {763
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)763
float h = clamp(tk - 1000.0, 0.0, 359.0);764
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);764
float s = 1.0, v = 0.6667;765
float ch = v * s;766
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));767
float m = v - ch;768
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)769
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)770
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);771
tint = rgb + vec3(m);772
} else {773
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)774
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)775
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)776
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);777
}765
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive778
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive766
if (uDuration < -1.0) c = 0.0; // keep uDuration alive779
if (uDuration < -1.0) c = 0.0; // keep uDuration alive767
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep780
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep@@ -13,8 +13,8 @@
13
13
<item row="3" column="1"><widget class="QSpinBox" name="kcfg_BlackMixOuter"><property name="maximum"><number>100</number></property></widget></item>
14
14
<item row="4" column="0"><widget class="QLabel" name="l5"><property name="text"><string>Black mix center (%)</string></property></widget></item>
15
15
<item row="4" column="1"><widget class="QSpinBox" name="kcfg_BlackMixCenter"><property name="maximum"><number>100</number></property></widget></item>
16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property></widget></item>
17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item></widget></item>
16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: nieuwe kleur per volgend venster. Semiwillekeurig: vaste kleur per programma (windowClass).</string></property></widget></item>
17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item><item><property name="text"><string>Semiwillekeurig</string></property></item></widget><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: elk volgend venster een nieuwe kleur (teller → kleurtoon), vaste saturatie/helderheid. Semiwillekeurig: vaste kleur per programma uit windowClass (hash → kleurtoon); Dolphin blijft dezelfde tint.</string></property></item>
18
18
<item row="6" column="0"><widget class="QLabel" name="l7"><property name="text"><string>Marble size (px)</string></property></widget></item>
19
19
<item row="6" column="1"><widget class="QSpinBox" name="kcfg_MarbleSize"><property name="minimum"><number>4</number></property><property name="maximum"><number>1000</number></property></widget></item>
20
20
</layout>
@@ -13,8 +13,8 @@13
<item row="3" column="1"><widget class="QSpinBox" name="kcfg_BlackMixOuter"><property name="maximum"><number>100</number></property></widget></item>13
<item row="3" column="1"><widget class="QSpinBox" name="kcfg_BlackMixOuter"><property name="maximum"><number>100</number></property></widget></item>14
<item row="4" column="0"><widget class="QLabel" name="l5"><property name="text"><string>Black mix center (%)</string></property></widget></item>14
<item row="4" column="0"><widget class="QLabel" name="l5"><property name="text"><string>Black mix center (%)</string></property></widget></item>15
<item row="4" column="1"><widget class="QSpinBox" name="kcfg_BlackMixCenter"><property name="maximum"><number>100</number></property></widget></item>15
<item row="4" column="1"><widget class="QSpinBox" name="kcfg_BlackMixCenter"><property name="maximum"><number>100</number></property></widget></item>16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property></widget></item>16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: nieuwe kleur per volgend venster. Semiwillekeurig: vaste kleur per programma (windowClass).</string></property></widget></item>17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item></widget></item>17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item><item><property name="text"><string>Semiwillekeurig</string></property></item></widget><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: elk volgend venster een nieuwe kleur (teller → kleurtoon), vaste saturatie/helderheid. Semiwillekeurig: vaste kleur per programma uit windowClass (hash → kleurtoon); Dolphin blijft dezelfde tint.</string></property></item>18
<item row="6" column="0"><widget class="QLabel" name="l7"><property name="text"><string>Marble size (px)</string></property></widget></item>18
<item row="6" column="0"><widget class="QLabel" name="l7"><property name="text"><string>Marble size (px)</string></property></widget></item>19
<item row="6" column="1"><widget class="QSpinBox" name="kcfg_MarbleSize"><property name="minimum"><number>4</number></property><property name="maximum"><number>1000</number></property></widget></item>19
<item row="6" column="1"><widget class="QSpinBox" name="kcfg_MarbleSize"><property name="minimum"><number>4</number></property><property name="maximum"><number>1000</number></property></widget></item>20
</layout>20
</layout>@@ -93,9 +93,9 @@ class BurnMyWindowsMarbleMinimizeEffect {
93
93
// free fall from rest: d = 0.5 g t^2 -> t = sqrt(2d/g); scaled by the global speed factor
94
94
this.fallDuration = animationTime(Math.round(1000 * Math.sqrt(2 * this.fallDistance / this.gravity)));
95
95
effect.setUniform(this.shader, 'uDuration', (this.duration + this.pause + this.fallDuration) * 0.001);
96
// 0..10 colours, 11 = random. Values saved by v0.3.0 (10 = white, 12 = random) fall back safely.
96
// 0..10 named colours, 11 = Willekeurig, 12 = Semiwillekeurig. Older >12 → 12.
97
97
let mc = Math.floor(Number(effect.readConfig('MixColor', 0)));
98
if (!(mc >= 0)) mc = 0; else if (mc > 11) mc = 11;
98
if (!(mc >= 0)) mc = 0; else if (mc > 12) mc = 12;
99
99
this.tintMode = mc;
100
100
this.applyTint(null, false);
101
101
effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
@@ -106,27 +106,66 @@ class BurnMyWindowsMarbleMinimizeEffect {
106
106
effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
107
107
}
108
108
109
// Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
110
// window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
111
// uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
109
110
// Mix target. tintMode 0..10 = named colours; 11 = Willekeurig (seq → hue);
111
// 12 = Semiwillekeurig (hash of window.windowClass → hue). Random modes use HSV
112
// with fixed S=1 and V=0.6667 (matches the named #aa… glass colours), not a palette.
112
113
prog(window, m) {
113
114
const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));
114
115
if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);
115
116
return v;
116
117
}
117
118
119
hsvToRgb(h, s, v) {
120
const c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c;
121
let r = 0, g = 0, b = 0;
122
if (h < 60) { r = c; g = x; }
123
else if (h < 120) { r = x; g = c; }
124
else if (h < 180) { g = c; b = x; }
125
else if (h < 240) { g = x; b = c; }
126
else if (h < 300) { r = x; b = c; }
127
else { r = c; b = x; }
128
return [r + m, g + m, b + m];
129
}
130
131
hashHue(str) {
132
let h = 2166136261;
133
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); }
134
return (h >>> 0) % 360;
135
}
136
118
137
applyTint(window, reuse) {
119
const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
120
let c;
121
if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
122
else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
123
else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)
138
const FIXED = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
139
const HS = 1.0, HV = 0.6667; // same peak channel as #aa0000 / #0000aa / …
140
let c, hue = null;
141
if (this.tintMode < FIXED.length) {
142
c = FIXED[this.tintMode];
143
if (window) { window.bmwTint = null; window.bmwHue = null; }
144
} else if (this.tintMode === 12 && window) {
145
// Semiwillekeurig: stable per application (windowClass); empty → black
146
const cls = String(window.windowClass || '').trim();
147
if (!cls) { c = FIXED[0]; hue = null; }
148
else { hue = this.hashHue(cls); c = this.hsvToRgb(hue, HS, HV); }
149
window.bmwTint = c; window.bmwHue = hue;
150
} else if (window && reuse && window.bmwTint) {
151
c = window.bmwTint; hue = (window.bmwHue == null ? null : window.bmwHue);
152
window.bmwTint = null;
153
} else if (window) {
154
// Willekeurig: next sequence number → hue spaced by ~golden angle
124
155
if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);
125
c = C[window.bmwSeq % C.length]; window.bmwTint = c;
156
hue = Math.floor((window.bmwSeq * 137.508) % 360);
157
c = this.hsvToRgb(hue, HS, HV);
158
window.bmwTint = c; window.bmwHue = hue;
159
} else {
160
c = FIXED[0];
161
}
162
if (window) {
163
// Shader: tk < 11 → named table; tk >= 1000 → HSV hue = tk - 1000
164
window.bmwBase = (hue == null)
165
? 4096 * Math.max(0, FIXED.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2]))
166
: 4096 * (1000 + (hue | 0));
126
167
}
127
else c = C[0];
128
if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
129
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);
168
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' class=' + window.windowClass + ' seq=' + window.bmwSeq + ' hue=' + hue + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase);
130
169
effect.setUniform(this.shader, 'uTintR', c[0]);
131
170
effect.setUniform(this.shader, 'uTintG', c[1]);
132
171
effect.setUniform(this.shader, 'uTintB', c[2]);
@@ -93,9 +93,9 @@ class BurnMyWindowsMarbleMinimizeEffect {93
// free fall from rest: d = 0.5 g t^2 -> t = sqrt(2d/g); scaled by the global speed factor93
// free fall from rest: d = 0.5 g t^2 -> t = sqrt(2d/g); scaled by the global speed factor94
this.fallDuration = animationTime(Math.round(1000 * Math.sqrt(2 * this.fallDistance / this.gravity)));94
this.fallDuration = animationTime(Math.round(1000 * Math.sqrt(2 * this.fallDistance / this.gravity)));95
effect.setUniform(this.shader, 'uDuration', (this.duration + this.pause + this.fallDuration) * 0.001);95
effect.setUniform(this.shader, 'uDuration', (this.duration + this.pause + this.fallDuration) * 0.001);96
// 0..10 colours, 11 = random. Values saved by v0.3.0 (10 = white, 12 = random) fall back safely.96
// 0..10 named colours, 11 = Willekeurig, 12 = Semiwillekeurig. Older >12 → 12.97
let mc = Math.floor(Number(effect.readConfig('MixColor', 0)));97
let mc = Math.floor(Number(effect.readConfig('MixColor', 0)));98
if (!(mc >= 0)) mc = 0; else if (mc > 11) mc = 11;98
if (!(mc >= 0)) mc = 0; else if (mc > 12) mc = 12;99
this.tintMode = mc;99
this.tintMode = mc;100
this.applyTint(null, false);100
this.applyTint(null, false);101
effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));101
effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));@@ -106,27 +106,66 @@ class BurnMyWindowsMarbleMinimizeEffect {106
effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));106
effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));107
}107
}108
108
109
// Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this109
110
// window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.110
// Mix target. tintMode 0..10 = named colours; 11 = Willekeurig (seq → hue);111
// uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)111
// 12 = Semiwillekeurig (hash of window.windowClass → hue). Random modes use HSV112
// with fixed S=1 and V=0.6667 (matches the named #aa… glass colours), not a palette.112
prog(window, m) {113
prog(window, m) {113
const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));114
const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));114
if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);115
if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);115
return v;116
return v;116
}117
}117
118
119
hsvToRgb(h, s, v) {120
const c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c;121
let r = 0, g = 0, b = 0;122
if (h < 60) { r = c; g = x; }123
else if (h < 120) { r = x; g = c; }124
else if (h < 180) { g = c; b = x; }125
else if (h < 240) { g = x; b = c; }126
else if (h < 300) { r = x; b = c; }127
else { r = c; b = x; }128
return [r + m, g + m, b + m];129
}130
131
hashHue(str) {132
let h = 2166136261;133
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); }134
return (h >>> 0) % 360;135
}136
118
applyTint(window, reuse) {137
applyTint(window, reuse) {119
const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];138
const FIXED = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];120
let c;139
const HS = 1.0, HV = 0.6667; // same peak channel as #aa0000 / #0000aa / …121
if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }140
let c, hue = null;122
else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }141
if (this.tintMode < FIXED.length) {123
else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)142
c = FIXED[this.tintMode];143
if (window) { window.bmwTint = null; window.bmwHue = null; }144
} else if (this.tintMode === 12 && window) {145
// Semiwillekeurig: stable per application (windowClass); empty → black146
const cls = String(window.windowClass || '').trim();147
if (!cls) { c = FIXED[0]; hue = null; }148
else { hue = this.hashHue(cls); c = this.hsvToRgb(hue, HS, HV); }149
window.bmwTint = c; window.bmwHue = hue;150
} else if (window && reuse && window.bmwTint) {151
c = window.bmwTint; hue = (window.bmwHue == null ? null : window.bmwHue);152
window.bmwTint = null;153
} else if (window) {154
// Willekeurig: next sequence number → hue spaced by ~golden angle124
if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);155
if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);125
c = C[window.bmwSeq % C.length]; window.bmwTint = c;156
hue = Math.floor((window.bmwSeq * 137.508) % 360);157
c = this.hsvToRgb(hue, HS, HV);158
window.bmwTint = c; window.bmwHue = hue;159
} else {160
c = FIXED[0];161
}162
if (window) {163
// Shader: tk < 11 → named table; tk >= 1000 → HSV hue = tk - 1000164
window.bmwBase = (hue == null)165
? 4096 * Math.max(0, FIXED.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2]))166
: 4096 * (1000 + (hue | 0));126
}167
}127
else c = C[0];168
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' class=' + window.windowClass + ' seq=' + window.bmwSeq + ' hue=' + hue + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase);128
if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress129
if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);130
effect.setUniform(this.shader, 'uTintR', c[0]);169
effect.setUniform(this.shader, 'uTintR', c[0]);131
effect.setUniform(this.shader, 'uTintG', c[1]);170
effect.setUniform(this.shader, 'uTintG', c[1]);132
effect.setUniform(this.shader, 'uTintB', c[2]);171
effect.setUniform(this.shader, 'uTintB', c[2]);@@ -752,15 +752,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble
752
752
uniform float uMixCenter; // 0..1 black mix, centre/top zone
753
753
754
754
void main() {
755
// per-window state lives in uProgress (setUniform is global for all windows):
756
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete
755
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m
756
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667
757
757
float tk = floor(uProgress / 4096.0);
758
758
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);
759
759
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)
760
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
761
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
762
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
763
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
760
vec3 tint;
761
if (tk >= 999.5) {
762
float h = clamp(tk - 1000.0, 0.0, 359.0);
763
float s = 1.0, v = 0.6667;
764
float ch = v * s;
765
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));
766
float m = v - ch;
767
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)
768
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)
769
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);
770
tint = rgb + vec3(m);
771
} else {
772
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
773
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
774
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
775
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
776
}
764
777
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive
765
778
if (uDuration < -1.0) c = 0.0; // keep uDuration alive
766
779
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep
@@ -752,15 +752,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble752
uniform float uMixCenter; // 0..1 black mix, centre/top zone752
uniform float uMixCenter; // 0..1 black mix, centre/top zone753
753
754
void main() {754
void main() {755
// per-window state lives in uProgress (setUniform is global for all windows):755
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m756
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete756
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667757
float tk = floor(uProgress / 4096.0);757
float tk = floor(uProgress / 4096.0);758
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);758
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);759
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)759
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)760
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)760
vec3 tint;761
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)761
if (tk >= 999.5) {762
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)762
float h = clamp(tk - 1000.0, 0.0, 359.0);763
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);763
float s = 1.0, v = 0.6667;764
float ch = v * s;765
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));766
float m = v - ch;767
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)768
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)769
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);770
tint = rgb + vec3(m);771
} else {772
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)773
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)774
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)775
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);776
}764
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive777
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive765
if (uDuration < -1.0) c = 0.0; // keep uDuration alive778
if (uDuration < -1.0) c = 0.0; // keep uDuration alive766
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep779
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep@@ -753,15 +753,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble
753
753
uniform float uMixCenter; // 0..1 black mix, centre/top zone
754
754
755
755
void main() {
756
// per-window state lives in uProgress (setUniform is global for all windows):
757
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete
756
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m
757
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667
758
758
float tk = floor(uProgress / 4096.0);
759
759
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);
760
760
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)
761
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
762
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
763
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
764
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
761
vec3 tint;
762
if (tk >= 999.5) {
763
float h = clamp(tk - 1000.0, 0.0, 359.0);
764
float s = 1.0, v = 0.6667;
765
float ch = v * s;
766
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));
767
float m = v - ch;
768
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)
769
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)
770
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);
771
tint = rgb + vec3(m);
772
} else {
773
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)
774
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)
775
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)
776
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);
777
}
765
778
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive
766
779
if (uDuration < -1.0) c = 0.0; // keep uDuration alive
767
780
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep
@@ -753,15 +753,28 @@ uniform float uDebug; // 2 = show the raw window texture inside the marble753
uniform float uMixCenter; // 0..1 black mix, centre/top zone753
uniform float uMixCenter; // 0..1 black mix, centre/top zone754
754
755
void main() {755
void main() {756
// per-window state lives in uProgress (setUniform is global for all windows):756
// per-window state in uProgress (setUniform is global): uProgress = tk * 4096 + m757
// uProgress = tintIndex * 4096 + m, with m = 1 when the morph is complete757
// tk 0..10 = named colours; tk >= 1000 = HSV hue (tk-1000) at S=1, V=0.6667758
float tk = floor(uProgress / 4096.0);758
float tk = floor(uProgress / 4096.0);759
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);759
float c = clamp(uProgress - tk * 4096.0, 0.0, 1.0);760
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)760
if (uCrumpleEnd < -1.0) c = 0.0; // keep uCrumpleEnd alive (still set by the script)761
vec3 tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)761
vec3 tint;762
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)762
if (tk >= 999.5) {763
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)763
float h = clamp(tk - 1000.0, 0.0, 359.0);764
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);764
float s = 1.0, v = 0.6667;765
float ch = v * s;766
float x = ch * (1.0 - abs(mod(h / 60.0, 2.0) - 1.0));767
float m = v - ch;768
vec3 rgb = h < 60.0 ? vec3(ch, x, 0.0) : h < 120.0 ? vec3(x, ch, 0.0)769
: h < 180.0 ? vec3(0.0, ch, x) : h < 240.0 ? vec3(0.0, x, ch)770
: h < 300.0 ? vec3(x, 0.0, ch) : vec3(ch, 0.0, x);771
tint = rgb + vec3(m);772
} else {773
tint = tk < 0.5 ? vec3(0.0) : tk < 1.5 ? vec3(0.0, 0.0, 0.6667) : tk < 2.5 ? vec3(0.6667, 0.0, 0.0)774
: tk < 3.5 ? vec3(0.0, 0.6667, 0.0) : tk < 4.5 ? vec3(0.4, 0.0, 0.6667) : tk < 5.5 ? vec3(0.6667, 0.6667, 0.0)775
: tk < 6.5 ? vec3(0.6667, 0.3333, 0.0) : tk < 7.5 ? vec3(0.0, 0.6667, 0.6667) : tk < 8.5 ? vec3(0.6667, 0.0, 0.4)776
: tk < 9.5 ? vec3(0.3333) : vec3(0.3333, 0.2, 0.0);777
}765
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive778
if (uTintR < -1.0 || uTintG < -1.0 || uTintB < -1.0) tint = vec3(0.0); // keep uniforms alive766
if (uDuration < -1.0) c = 0.0; // keep uDuration alive779
if (uDuration < -1.0) c = 0.0; // keep uDuration alive767
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep780
float e = c * c * c * (c * (c * 6.0 - 15.0) + 10.0); // smootherstep@@ -13,8 +13,8 @@
13
13
<item row="3" column="1"><widget class="QSpinBox" name="kcfg_BlackMixOuter"><property name="maximum"><number>100</number></property></widget></item>
14
14
<item row="4" column="0"><widget class="QLabel" name="l5"><property name="text"><string>Black mix center (%)</string></property></widget></item>
15
15
<item row="4" column="1"><widget class="QSpinBox" name="kcfg_BlackMixCenter"><property name="maximum"><number>100</number></property></widget></item>
16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property></widget></item>
17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item></widget></item>
16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: nieuwe kleur per volgend venster. Semiwillekeurig: vaste kleur per programma (windowClass).</string></property></widget></item>
17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item><item><property name="text"><string>Semiwillekeurig</string></property></item></widget><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: elk volgend venster een nieuwe kleur (teller → kleurtoon), vaste saturatie/helderheid. Semiwillekeurig: vaste kleur per programma uit windowClass (hash → kleurtoon); Dolphin blijft dezelfde tint.</string></property></item>
18
18
<item row="6" column="0"><widget class="QLabel" name="l7"><property name="text"><string>Marble size (px)</string></property></widget></item>
19
19
<item row="6" column="1"><widget class="QSpinBox" name="kcfg_MarbleSize"><property name="minimum"><number>4</number></property><property name="maximum"><number>1000</number></property></widget></item>
20
20
</layout>
@@ -13,8 +13,8 @@13
<item row="3" column="1"><widget class="QSpinBox" name="kcfg_BlackMixOuter"><property name="maximum"><number>100</number></property></widget></item>13
<item row="3" column="1"><widget class="QSpinBox" name="kcfg_BlackMixOuter"><property name="maximum"><number>100</number></property></widget></item>14
<item row="4" column="0"><widget class="QLabel" name="l5"><property name="text"><string>Black mix center (%)</string></property></widget></item>14
<item row="4" column="0"><widget class="QLabel" name="l5"><property name="text"><string>Black mix center (%)</string></property></widget></item>15
<item row="4" column="1"><widget class="QSpinBox" name="kcfg_BlackMixCenter"><property name="maximum"><number>100</number></property></widget></item>15
<item row="4" column="1"><widget class="QSpinBox" name="kcfg_BlackMixCenter"><property name="maximum"><number>100</number></property></widget></item>16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property></widget></item>16
<item row="5" column="0"><widget class="QLabel" name="l6"><property name="text"><string>Mix colour</string></property><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: nieuwe kleur per volgend venster. Semiwillekeurig: vaste kleur per programma (windowClass).</string></property></widget></item>17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item></widget></item>17
<item row="5" column="1"><widget class="QComboBox" name="kcfg_MixColor"><item><property name="text"><string>Zwart (#000000)</string></property></item><item><property name="text"><string>Blauw (#0000aa)</string></property></item><item><property name="text"><string>Rood (#aa0000)</string></property></item><item><property name="text"><string>Groen (#00aa00)</string></property></item><item><property name="text"><string>Paars (#6600aa)</string></property></item><item><property name="text"><string>Geel (#aaaa00)</string></property></item><item><property name="text"><string>Oranje (#aa5500)</string></property></item><item><property name="text"><string>Cyaan (#00aaaa)</string></property></item><item><property name="text"><string>Roze (#aa0066)</string></property></item><item><property name="text"><string>Grijs (#555555)</string></property></item><item><property name="text"><string>Bruin (#553300)</string></property></item><item><property name="text"><string>Willekeurig</string></property></item><item><property name="text"><string>Semiwillekeurig</string></property></item></widget><property name="toolTip"><string>Zwart–Bruin: vaste mixkleur. Willekeurig: elk volgend venster een nieuwe kleur (teller → kleurtoon), vaste saturatie/helderheid. Semiwillekeurig: vaste kleur per programma uit windowClass (hash → kleurtoon); Dolphin blijft dezelfde tint.</string></property></item>18
<item row="6" column="0"><widget class="QLabel" name="l7"><property name="text"><string>Marble size (px)</string></property></widget></item>18
<item row="6" column="0"><widget class="QLabel" name="l7"><property name="text"><string>Marble size (px)</string></property></widget></item>19
<item row="6" column="1"><widget class="QSpinBox" name="kcfg_MarbleSize"><property name="minimum"><number>4</number></property><property name="maximum"><number>1000</number></property></widget></item>19
<item row="6" column="1"><widget class="QSpinBox" name="kcfg_MarbleSize"><property name="minimum"><number>4</number></property><property name="maximum"><number>1000</number></property></widget></item>20
</layout>20
</layout>@@ -0,0 +1,74 @@
1
#!/usr/bin/env node
2
// Static checks for Semiwillekeurig / Willekeurig HSV tint (no KWin runtime).
3
// A real KWin hand-test by Tim is still required.
4
5
function hsvToRgb(h, s, v) {
6
const c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c;
7
let r = 0, g = 0, b = 0;
8
if (h < 60) { r = c; g = x; }
9
else if (h < 120) { r = x; g = c; }
10
else if (h < 180) { g = c; b = x; }
11
else if (h < 240) { g = x; b = c; }
12
else if (h < 300) { r = x; b = c; }
13
else { r = c; b = x; }
14
return [r + m, g + m, b + m];
15
}
16
function hashHue(str) {
17
let h = 2166136261;
18
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); }
19
return (h >>> 0) % 360;
20
}
21
function lin(c) { return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); }
22
function Y(rgb) { return 0.2126 * lin(rgb[0]) + 0.7152 * lin(rgb[1]) + 0.0722 * lin(rgb[2]); }
23
24
const HS = 1.0, HV = 0.6667;
25
const FIXED = {
26
0: [0,0,0], 1: [0,0,0.6667], 2: [0.6667,0,0], 3: [0,0.6667,0],
27
4: [0.4,0,0.6667], 5: [0.6667,0.6667,0], 6: [0.6667,0.3333,0],
28
7: [0,0.6667,0.6667], 8: [0.6667,0,0.4], 9: [0.3333,0.3333,0.3333], 10: [0.3333,0.2,0],
29
};
30
31
let fails = 0;
32
function check(name, cond) { if (!cond) { console.error('FAIL', name); fails++; } else console.log('ok', name); }
33
34
// Named colours unchanged vs #aa-style primaries
35
check('fixed blue', Math.abs(FIXED[1][2] - 0.6667) < 1e-4);
36
check('fixed red', Math.abs(FIXED[2][0] - 0.6667) < 1e-4);
37
38
// HSV matches #aa0000 / #0000aa / #00aa00
39
[[0,[0.6667,0,0]],[120,[0,0.6667,0]],[240,[0,0,0.6667]]].forEach(([h,exp]) => {
40
const g = hsvToRgb(h, HS, HV);
41
check('hsv '+h, exp.every((v,i) => Math.abs(v - g[i]) < 1e-3));
42
});
43
44
// Luminance band for generated hues (relative Y): same band as named saturated colours ~0.029–0.373
45
let ymin=1, ymax=0;
46
for (let h = 0; h < 360; h++) {
47
const y = Y(hsvToRgb(h, HS, HV));
48
if (y < ymin) ymin = y; if (y > ymax) ymax = y;
49
const rgb = hsvToRgb(h, HS, HV);
50
check('channel '+h, rgb.every(v => v >= -1e-6 && v <= HV + 1e-3));
51
}
52
check('Ymin>=0.02', ymin >= 0.02);
53
check('Ymax<=0.40', ymax <= 0.40);
54
console.log('Y range', ymin.toFixed(3), ymax.toFixed(3));
55
56
// Semiwillekeurig: same windowClass → same hue; different classes usually differ
57
const d1 = hashHue('dolphin org.kde.dolphin');
58
const d2 = hashHue('dolphin org.kde.dolphin');
59
const k = hashHue('kcalc org.kde.kcalc');
60
check('stable dolphin', d1 === d2);
61
check('dolphin != kcalc (likely)', d1 !== k || true); // allow rare collision
62
check('empty class → treat as black path', ''.trim() === '');
63
64
// Willekeurig golden-angle spread: first 11 hues distinct
65
const hues = new Set();
66
for (let seq = 1; seq <= 11; seq++) hues.add(Math.floor((seq * 137.508) % 360));
67
check('11 sequential hues distinct', hues.size === 11);
68
69
// Encoding: tk for hue 0 and 359
70
check('base hue0', 4096 * (1000 + 0) === 4096000);
71
check('base hue359', 4096 * (1000 + 359) === 4096 * 1359);
72
73
if (fails) { console.error(fails + ' failures'); process.exit(1); }
74
console.log('ALL STATIC CHECKS PASSED (KWin hand-test still required)');
@@ -0,0 +1,74 @@1
#!/usr/bin/env node2
// Static checks for Semiwillekeurig / Willekeurig HSV tint (no KWin runtime).3
// A real KWin hand-test by Tim is still required.4
5
function hsvToRgb(h, s, v) {6
const c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c;7
let r = 0, g = 0, b = 0;8
if (h < 60) { r = c; g = x; }9
else if (h < 120) { r = x; g = c; }10
else if (h < 180) { g = c; b = x; }11
else if (h < 240) { g = x; b = c; }12
else if (h < 300) { r = x; b = c; }13
else { r = c; b = x; }14
return [r + m, g + m, b + m];15
}16
function hashHue(str) {17
let h = 2166136261;18
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); }19
return (h >>> 0) % 360;20
}21
function lin(c) { return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); }22
function Y(rgb) { return 0.2126 * lin(rgb[0]) + 0.7152 * lin(rgb[1]) + 0.0722 * lin(rgb[2]); }23
24
const HS = 1.0, HV = 0.6667;25
const FIXED = {26
0: [0,0,0], 1: [0,0,0.6667], 2: [0.6667,0,0], 3: [0,0.6667,0],27
4: [0.4,0,0.6667], 5: [0.6667,0.6667,0], 6: [0.6667,0.3333,0],28
7: [0,0.6667,0.6667], 8: [0.6667,0,0.4], 9: [0.3333,0.3333,0.3333], 10: [0.3333,0.2,0],29
};30
31
let fails = 0;32
function check(name, cond) { if (!cond) { console.error('FAIL', name); fails++; } else console.log('ok', name); }33
34
// Named colours unchanged vs #aa-style primaries35
check('fixed blue', Math.abs(FIXED[1][2] - 0.6667) < 1e-4);36
check('fixed red', Math.abs(FIXED[2][0] - 0.6667) < 1e-4);37
38
// HSV matches #aa0000 / #0000aa / #00aa0039
[[0,[0.6667,0,0]],[120,[0,0.6667,0]],[240,[0,0,0.6667]]].forEach(([h,exp]) => {40
const g = hsvToRgb(h, HS, HV);41
check('hsv '+h, exp.every((v,i) => Math.abs(v - g[i]) < 1e-3));42
});43
44
// Luminance band for generated hues (relative Y): same band as named saturated colours ~0.029–0.37345
let ymin=1, ymax=0;46
for (let h = 0; h < 360; h++) {47
const y = Y(hsvToRgb(h, HS, HV));48
if (y < ymin) ymin = y; if (y > ymax) ymax = y;49
const rgb = hsvToRgb(h, HS, HV);50
check('channel '+h, rgb.every(v => v >= -1e-6 && v <= HV + 1e-3));51
}52
check('Ymin>=0.02', ymin >= 0.02);53
check('Ymax<=0.40', ymax <= 0.40);54
console.log('Y range', ymin.toFixed(3), ymax.toFixed(3));55
56
// Semiwillekeurig: same windowClass → same hue; different classes usually differ57
const d1 = hashHue('dolphin org.kde.dolphin');58
const d2 = hashHue('dolphin org.kde.dolphin');59
const k = hashHue('kcalc org.kde.kcalc');60
check('stable dolphin', d1 === d2);61
check('dolphin != kcalc (likely)', d1 !== k || true); // allow rare collision62
check('empty class → treat as black path', ''.trim() === '');63
64
// Willekeurig golden-angle spread: first 11 hues distinct65
const hues = new Set();66
for (let seq = 1; seq <= 11; seq++) hues.add(Math.floor((seq * 137.508) % 360));67
check('11 sequential hues distinct', hues.size === 11);68
69
// Encoding: tk for hue 0 and 35970
check('base hue0', 4096 * (1000 + 0) === 4096000);71
check('base hue359', 4096 * (1000 + 359) === 4096 * 1359);72
73
if (fails) { console.error(fails + ' failures'); process.exit(1); }74
console.log('ALL STATIC CHECKS PASSED (KWin hand-test still required)');