blob: 6d5fef376eb6ee19196dbb86758baf89a56c8be7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
pragma Singleton
import Quickshell
Singleton {
id: root
function doLayout(windowList, outerWidth, outerHeight) {
var N = windowList.length
if (N === 0) return []
// Safe Area (90%)
var contentScale = 0.90
var useW = outerWidth * contentScale
var useH = outerHeight * contentScale
var offX = (outerWidth - useW) / 2
var offY = (outerHeight - useH) / 2
var centerX = offX + useW / 2
var centerY = offY + useH / 2
// Maximum radius (distance from center to the furthest edge of safe area)
var maxRadius = Math.min(useW, useH) / 2
var result = []
// --- THE VORTEX CONFIGURATION ---
var goldenAngle = Math.PI * (3 - Math.sqrt(5))
// PARAMETER TWEAK 1: from 0.3 to 0.5 to keep distant windows readable
var minScale = 0.4
// PARAMETER TWEAK 2: from 0.4 to 0.6 (60% of screen height)
var baseSizeFactor = 0.5
for (var i = 0; i < N; i++) {
var item = windowList[i]
var t = i / Math.max(1, N - 1)
if (N === 1) t = 0
// PARAMETER TWEAK 3: from 0.9 instead of 0.8 to accommodate larger thumbs
var currentRadius = (maxRadius * 0.85) * Math.sqrt(t)
var currentAngle = i * goldenAngle
var scale = 1.0 - (t * (1.0 - minScale))
var tilt = (Math.cos(currentAngle) * 8)
// Coordinates (Polar to Cartesian)
var cx = centerX + currentRadius * Math.cos(currentAngle)
var cy = centerY + currentRadius * Math.sin(currentAngle)
// Dimensions (Aspect Fit)
var w0 = (item.width > 0) ? item.width : 100
var h0 = (item.height > 0) ? item.height : 100
var baseBoxSize = Math.min(useW, useH) * baseSizeFactor
var aspect = w0 / h0
var thumbW, thumbH
if (aspect > 1) {
thumbW = baseBoxSize * scale
thumbH = thumbW / aspect
} else {
thumbH = baseBoxSize * scale
thumbW = thumbH * aspect
}
result.push({
win: item.win,
x: cx - (thumbW / 2),
y: cy - (thumbH / 2),
width: thumbW,
height: thumbH,
rotation: tilt,
zIndex: N - i
})
}
return result
}
}
|