This commit is contained in:
ari committed 2026-10-27 13:12:37 -04:00
1 parent b127fc2256
commit 0f42427f94
8 files changed
+600 -323

No files matched your search

+27 -8
View File
@@ -10,7 +10,7 @@ Item {
required property Theme theme
required property real radius
required property color tint
// Blue tint and a glowing blue rim.
// Amber tint, a yellow rim and, with a shadow, a yellow glow.
required property bool selected
// Soft shadow underneath. Off where the window is too small to hold it.
required property bool shadow
@@ -21,15 +21,23 @@ Item {
color: root.selected ? root.theme.glassSelectedTint : root.tint
antialiasing: true
Behavior on color {
ColorAnimation {
duration: root.theme.glassFadeDuration
}
}
// A GPU shadow instead of a hand-drawn one, so it stays cheap even
// with many glass panels on screen and animating at once.
// with many glass panels on screen and animating at once. Selected
// glass turns it into a yellow glow all round.
layer.enabled: root.shadow
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: root.theme.glassShadow
shadowVerticalOffset: root.theme.glassShadowOffset
shadowBlur: 1.0
blurMax: root.theme.glassShadowBlur
shadowColor: root.selected ? root.theme.glassGlow : root.theme.glassShadow
shadowVerticalOffset: root.selected ? 0 : root.theme.glassShadowOffset
// blurMax stays fixed, so the effect is not rebuilt on select.
shadowBlur: root.selected ? 1.0 : root.theme.glassShadowBlur / root.theme.glassGlowBlur
blurMax: root.theme.glassGlowBlur
}
}
@@ -55,12 +63,23 @@ Item {
Canvas {
id: edge
readonly property color rimTop: root.selected ? root.theme.fieldBorder : root.theme.glassRimTop
readonly property color rimBottom: root.selected ? root.theme.glassSelectedRimBottom : root.theme.glassRimBottom
property color rimTop: root.selected ? root.theme.accentColor : root.theme.glassRimTop
property color rimBottom: root.selected ? root.theme.glassSelectedRimBottom : root.theme.glassRimBottom
readonly property real rimWidth: root.selected ? 2 : 1
anchors.fill: parent
Behavior on rimTop {
ColorAnimation {
duration: root.theme.glassFadeDuration
}
}
Behavior on rimBottom {
ColorAnimation {
duration: root.theme.glassFadeDuration
}
}
onWidthChanged: edge.requestPaint()
onHeightChanged: edge.requestPaint()
onRimTopChanged: edge.requestPaint()
+156
View File
@@ -0,0 +1,156 @@
import QtQuick
// A glass sphere with lines of latitude and longitude that turn with it.
// Used for the big workspace globe and the small planet in the window loop.
// Set width and height to the same size.
Item {
id: root
required property Theme theme
// How far the sphere has turned sideways and down, in radians.
required property real yaw
required property real pitch
// Space between grid lines, in radians. 0 or less leaves those out.
required property real lonStep
required property real latStep
// Same as for the cards on it, so the lines curve the same way.
required property real focalLength
onYawChanged: grid.requestPaint()
onPitchChanged: grid.requestPaint()
onLonStepChanged: grid.requestPaint()
onLatStepChanged: grid.requestPaint()
onFocalLengthChanged: grid.requestPaint()
// The body: dark glass, lighter toward the middle, an amber glow at the
// edge, a shine at the top left and a rim. Only painted when resized.
Canvas {
id: body
anchors.fill: parent
onWidthChanged: body.requestPaint()
onHeightChanged: body.requestPaint()
onPaint: {
const ctx = body.getContext("2d");
ctx.reset();
const r = Math.min(body.width, body.height) / 2;
if (r <= 2)
return;
const cx = body.width / 2;
const cy = body.height / 2;
const fill = ctx.createRadialGradient(cx - r * 0.3, cy - r * 0.35, 0, cx, cy, r);
fill.addColorStop(0, root.theme.globeCore);
fill.addColorStop(0.75, root.theme.globeTint);
fill.addColorStop(1, root.theme.globeEdge);
ctx.fillStyle = fill;
ctx.beginPath();
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
ctx.fill();
const sx = cx - r * 0.35;
const sy = cy - r * 0.45;
const shine = ctx.createRadialGradient(sx, sy, 0, sx, sy, r * 0.6);
shine.addColorStop(0, root.theme.glassShine);
shine.addColorStop(1, "rgba(255, 255, 255, 0)");
ctx.fillStyle = shine;
ctx.beginPath();
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
ctx.fill();
const rim = ctx.createLinearGradient(0, cy - r, 0, cy + r);
rim.addColorStop(0, root.theme.globeRimTop);
rim.addColorStop(1, root.theme.globeRimBottom);
ctx.strokeStyle = rim;
ctx.lineWidth = 1.5;
ctx.beginPath();
ctx.arc(cx, cy, r - 1, 0, 2 * Math.PI);
ctx.stroke();
}
}
// The grid lines, painted again whenever the sphere turns. Lines sit
// halfway between the cards, so they do not run through them.
Canvas {
id: grid
anchors.fill: parent
onWidthChanged: grid.requestPaint()
onHeightChanged: grid.requestPaint()
onPaint: {
const ctx = grid.getContext("2d");
ctx.reset();
const r = Math.min(grid.width, grid.height) / 2;
const f = root.focalLength;
if (r <= 2 || f <= r)
return;
const cx = grid.width / 2;
const cy = grid.height / 2;
// Radius of the sphere itself, so its edge is drawn at r.
const big = r * f / (f - r);
const cosP = Math.cos(root.pitch);
const sinP = Math.sin(root.pitch);
const samples = 48;
// Draws a line along the sphere, given the longitude and
// latitude at each point from 0 to 1. Skips the back half.
function trace(pointAt) {
let drawing = false;
for (let i = 0; i <= samples; i++) {
const p = pointAt(i / samples);
const x = Math.cos(p.lat) * Math.sin(p.lon);
const y0 = Math.sin(p.lat);
const z0 = Math.cos(p.lat) * Math.cos(p.lon);
// Turn down by the pitch. z is 1 at the front.
const y = y0 * cosP - z0 * sinP;
const z = y0 * sinP + z0 * cosP;
if (z <= 0.02) {
drawing = false;
continue;
}
const s = f / (f + big * (1 - z));
const px = cx + big * x * s;
const py = cy + big * y * s;
if (drawing)
ctx.lineTo(px, py);
else
ctx.moveTo(px, py);
drawing = true;
}
}
ctx.strokeStyle = root.theme.globeGrid;
ctx.lineWidth = 1;
ctx.beginPath();
// Lines of longitude, from pole to pole.
if (root.lonStep > 0) {
const half = Math.ceil(Math.PI / root.lonStep);
const first = Math.round(root.yaw / root.lonStep) - half;
for (let k = first; k < first + 2 * half; k++) {
const lon = (k + 0.5) * root.lonStep - root.yaw;
trace(t => ({
lon: lon,
lat: (t - 0.5) * Math.PI
}));
}
}
// Lines of latitude, each a full circle.
if (root.latStep > 0) {
const count = Math.floor(Math.PI / 2 / root.latStep);
for (let j = -count; j < count; j++) {
const lat = (j + 0.5) * root.latStep;
trace(t => ({
lon: t * 2 * Math.PI,
lat: lat
}));
}
}
ctx.stroke();
}
}
}
+190 -171
View File
@@ -63,12 +63,6 @@ PanelWindow {
property int loopWorkspaceId: -1
// Escape folds the loop back into the carousel, instead of closing.
property bool canCollapse: true
// Half the shown height of a workspace right above or below the loop,
// after its shrink and its tilt.
readonly property real neighbourHalfHeight: {
const shrink = 1 - Math.min(root.theme.carouselScaleStep, root.theme.carouselMaxScaleReduction);
return root.theme.cardHeight / 2 * shrink * Math.cos(root.theme.loopTiltX * Math.PI / 180);
}
function workspaceIndexAt(index: int): int {
const list = root.workspaceIndices;
@@ -532,8 +526,8 @@ PanelWindow {
color: root.theme.textColor
font.pixelSize: root.theme.fontSize
selectByMouse: true
selectionColor: root.theme.fieldBorder
selectedTextColor: root.theme.buttonText
selectionColor: root.theme.accentColor
selectedTextColor: root.theme.accentText
clip: true
focus: false
@@ -563,7 +557,7 @@ PanelWindow {
Text {
id: matchText
anchors.verticalCenter: parent.verticalCenter
color: root.matchCount > 0 ? root.theme.labelColor : root.theme.fieldBorder
color: root.matchCount > 0 ? root.theme.labelColor : root.theme.warnColor
font.pixelSize: root.theme.fontSize
text: {
if (searchInput.text.length === 0)
@@ -721,202 +715,227 @@ PanelWindow {
}
}
Repeater {
model: root.compositor.monitors
// ── globe ───────────────────────────────────────────────────────
// One column per monitor, with its workspaces top to bottom.
Item {
id: column
// The glass globe and the workspace cards on it. While the window
// loop is open it moves aside, shrinks and fades, making room for
// the planet.
Item {
id: globeView
required property var modelData
required property int index
// Sideways turn, in monitor steps. Follows the selected monitor.
property real lonTurn: root.monitorIndex
// Up or down turn of the grid lines, in radians. Blends the
// turns of the two columns nearest the front.
readonly property real gridPitch: {
const count = columns.count;
if (count === 0)
return 0;
const at = Math.max(0, Math.min(globeView.lonTurn, count - 1));
const low = Math.floor(at);
const high = Math.min(low + 1, count - 1);
const a = columns.itemAt(low);
const b = columns.itemAt(high);
const turnA = a ? a.latTurn : 0;
const turnB = b ? b.latTurn : turnA;
return (turnA + (turnB - turnA) * (at - low)) * root.theme.globeLatStep;
}
readonly property int columnIndex: index
readonly property int selectedWs: root.workspaceIndexAt(columnIndex)
readonly property var workspaces: modelData.workspaces ?? []
readonly property bool isCurrentColumn: column.columnIndex === root.monitorIndex
// Other columns turn to face the middle while the loop is open.
readonly property real tiltY: root.windowsOpen && !column.isCurrentColumn ? -Math.sign(column.columnIndex - root.monitorIndex) * root.theme.loopTiltY : 0
width: focusScope.width
height: focusScope.height
x: root.windowsOpen ? focusScope.width * (root.theme.globeAsideCenterShare - 0.5) : 0
scale: root.windowsOpen ? root.theme.globeAsideScale : 1
opacity: root.windowsOpen ? root.theme.globeAsideFade : 1
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: root.theme.cardWidth
// While the loop is open, the current column draws over it,
// so the workspace above stays visible over the back windows.
z: column.isCurrentColumn ? (root.windowsOpen ? 3 : 1) : 0
opacity: {
const fade = 1 - Math.min(Math.abs(column.columnIndex - root.monitorIndex) * root.theme.carouselMonitorFadeStep, root.theme.carouselMonitorMaxFade);
return root.windowsOpen && !column.isCurrentColumn ? fade * root.theme.loopHiddenFade : fade;
Behavior on lonTurn {
enabled: root.animate
NumberAnimation {
duration: root.theme.carouselDuration
easing.type: Easing.OutCubic
}
// While the loop is open, the nearest column on each side sits
// just past the loop's edge. Further columns keep the normal step.
anchors.horizontalCenterOffset: {
const steps = column.columnIndex - root.monitorIndex;
if (!root.windowsOpen || steps === 0)
return steps * root.theme.carouselStepX;
const nearest = windowLoop.reachX + root.theme.cardWidth / 2 + root.theme.loopEdgeGap;
return Math.sign(steps) * (nearest + (Math.abs(steps) - 1) * root.theme.carouselStepX);
}
Behavior on x {
enabled: root.animate
NumberAnimation {
duration: root.theme.loopExpandDuration
easing.type: Easing.OutCubic
}
Behavior on anchors.horizontalCenterOffset {
enabled: root.animate
NumberAnimation {
duration: root.theme.carouselDuration
easing.type: Easing.OutCubic
}
}
Behavior on scale {
enabled: root.animate
NumberAnimation {
duration: root.theme.loopExpandDuration
easing.type: Easing.OutCubic
}
Behavior on opacity {
enabled: root.animate
NumberAnimation {
duration: root.theme.carouselDuration
}
}
Behavior on opacity {
enabled: root.animate
NumberAnimation {
duration: root.theme.loopExpandDuration
}
}
transform: Rotation {
origin.x: column.width / 2
origin.y: column.height / 2
axis {
x: 0
y: 1
z: 0
}
angle: column.tiltY
Globe {
anchors.centerIn: parent
width: root.theme.globeDrawRadius * 2
height: root.theme.globeDrawRadius * 2
z: -2
theme: root.theme
yaw: globeView.lonTurn * root.theme.globeLonStep
pitch: globeView.gridPitch
lonStep: root.theme.globeLonStep
latStep: root.theme.globeLatStep
focalLength: root.theme.globeFocalLength
}
Behavior on angle {
Repeater {
id: columns
model: root.compositor.monitors
// One column per monitor, running from pole to pole, with
// its workspaces top to bottom.
Item {
id: column
required property var modelData
required property int index
readonly property int columnIndex: index
readonly property int selectedWs: root.workspaceIndexAt(columnIndex)
readonly property var workspaces: modelData.workspaces ?? []
readonly property bool isCurrentColumn: column.columnIndex === root.monitorIndex
// Up or down turn, in workspace steps. Follows the
// selected workspace, so each column turns on its own.
property real latTurn: column.selectedWs
// Place round the globe, in radians. 0 is at the front.
readonly property real lon: (column.columnIndex - globeView.lonTurn) * root.theme.globeLonStep
readonly property real fade: 1 - Math.min(Math.abs(column.columnIndex - globeView.lonTurn) * root.theme.carouselMonitorFadeStep, root.theme.carouselMonitorMaxFade)
anchors.fill: parent
z: Math.cos(column.lon)
Behavior on latTurn {
enabled: root.animate
NumberAnimation {
duration: root.theme.carouselDuration
easing.type: Easing.OutCubic
}
}
}
// Monitor name, above the search bar.
Item {
id: monitorName
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: root.theme.monitorLabelTop
z: 2
width: Math.min(nameText.implicitWidth + root.theme.monitorNamePadding * 10, column.width)
height: nameText.implicitHeight + root.theme.monitorNamePadding
// Monitor name, above the search bar, over its column.
Item {
id: monitorName
Glass {
anchors.fill: parent
theme: root.theme
radius: monitorName.height / 4
tint: root.theme.barBg
selected: column.isCurrentColumn
shadow: true
readonly property real depthScale: root.theme.globeFocalLength / (root.theme.globeFocalLength + root.theme.globeRadius * (1 - Math.cos(column.lon)))
x: column.width / 2 + root.theme.globeRadius * Math.sin(column.lon) * monitorName.depthScale - monitorName.width / 2
y: root.theme.monitorLabelTop
z: 2
width: Math.min(nameText.implicitWidth + root.theme.monitorNamePadding * 10, root.theme.cardWidth)
height: nameText.implicitHeight + root.theme.monitorNamePadding
visible: Math.cos(column.lon) > root.theme.globeHideFacing
opacity: column.fade
Glass {
anchors.fill: parent
theme: root.theme
radius: monitorName.height / 4
tint: root.theme.barBg
selected: column.isCurrentColumn
shadow: true
}
Text {
id: nameText
anchors.centerIn: parent
width: parent.width - root.theme.monitorNamePadding * 2
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
color: column.isCurrentColumn ? root.theme.textColor : root.theme.labelColor
font.pixelSize: root.theme.monitorNameSize
font.bold: true
text: column.modelData.name.length > 0 ? column.modelData.name : "screen"
}
}
Text {
id: nameText
anchors.centerIn: parent
width: parent.width - root.theme.monitorNamePadding * 2
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
color: column.isCurrentColumn ? root.theme.textColor : root.theme.labelColor
font.pixelSize: root.theme.monitorNameSize
font.bold: true
text: column.modelData.name.length > 0 ? column.modelData.name : "screen"
}
}
Repeater {
model: column.workspaces
Repeater {
model: column.workspaces
WorkspaceCard {
id: card
WorkspaceCard {
id: card
required property var modelData
required property int index
required property var modelData
required property int index
// Place up or down the globe, in radians. Down is positive.
readonly property real lat: (card.index - column.latTurn) * root.theme.globeLatStep
// 1 facing the viewer, 0 edge-on, below 0 on the back.
readonly property real facing: Math.cos(card.lat) * Math.cos(column.lon)
// Simple perspective: cards farther away get smaller.
readonly property real depthScale: root.theme.globeFocalLength / (root.theme.globeFocalLength + root.theme.globeRadius * (1 - card.facing))
readonly property real stepFade: 1 - Math.min(Math.abs(card.index - column.latTurn) * root.theme.carouselFadeStep, root.theme.carouselMaxFade)
// Fades out as it turns toward the edge of the globe.
readonly property real edgeFade: Math.max(0, Math.min(1, (card.facing - root.theme.globeHideFacing) / (root.theme.globeFadeFacing - root.theme.globeHideFacing)))
readonly property int distance: Math.abs(index - column.selectedWs)
// This card turns into the window loop.
readonly property bool opensLoop: root.windowsOpen && card.selected
// Cards above and below the loop move so the nearest
// ones sit a small gap from the front window. Cards
// further out keep the normal step from those.
readonly property real spreadY: {
const steps = index - column.selectedWs;
if (!root.windowsOpen || !column.isCurrentColumn || steps === 0)
return 0;
const nearest = steps < 0 ? windowLoop.frontTop - root.theme.loopWorkspaceGapAbove - root.neighbourHalfHeight : windowLoop.frontBottom + root.theme.loopWorkspaceGapBelow + root.neighbourHalfHeight;
return nearest - Math.sign(steps) * root.theme.carouselStepY;
}
// They also lean back: the top edge away above the
// loop, the bottom edge away below it.
readonly property real tiltX: root.windowsOpen && column.isCurrentColumn ? -Math.sign(index - column.selectedWs) * root.theme.loopTiltX : 0
readonly property real baseOpacity: 1 - Math.min(card.distance * root.theme.carouselFadeStep, root.theme.carouselMaxFade)
readonly property real baseScale: 1 - Math.min(card.distance * root.theme.carouselScaleStep, root.theme.carouselMaxScaleReduction)
theme: root.theme
workspaceName: modelData.name
workspaceIndex: modelData.idx
selected: column.isCurrentColumn && index === column.selectedWs
current: modelData.focused === true
windows: modelData.windows ?? []
theme: root.theme
workspaceName: modelData.name
workspaceIndex: modelData.idx
selected: column.isCurrentColumn && index === column.selectedWs
current: modelData.focused === true
animateMoves: root.animate
windows: modelData.windows ?? []
x: column.width / 2 + root.theme.globeRadius * Math.cos(card.lat) * Math.sin(column.lon) * card.depthScale - card.width / 2
y: column.height / 2 + root.theme.globeRadius * Math.sin(card.lat) * card.depthScale - card.height / 2
z: card.facing
scale: card.depthScale
opacity: card.stepFade * column.fade * card.edgeFade
visible: card.facing > root.theme.globeHideFacing
enabled: !root.windowsOpen
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenterOffset: (index - column.selectedWs) * root.theme.carouselStepY + card.spreadY
opacity: {
if (card.opensLoop)
return 0;
if (!root.windowsOpen)
return card.baseOpacity;
if (!column.isCurrentColumn)
return card.baseOpacity * root.theme.loopHiddenFade;
// The two right next to the loop skip the fade by distance.
if (card.distance === 1)
return root.theme.loopNeighbourFade;
return card.baseOpacity * root.theme.loopNeighbourFade;
}
scale: card.opensLoop ? 1 / root.theme.loopStartScale : card.baseScale
z: card.selected ? 1 : 0
enabled: !root.windowsOpen
transform: Rotation {
origin.x: card.width / 2
origin.y: card.height / 2
axis {
x: 1
y: 0
z: 0
}
angle: card.tiltX
Behavior on angle {
enabled: root.animate
NumberAnimation {
duration: root.theme.carouselDuration
easing.type: Easing.OutCubic
// Lie flat on the globe: lean back by the
// latitude, then turn by the longitude.
transform: [
Rotation {
origin.x: card.width / 2
origin.y: card.height / 2
axis {
x: 1
y: 0
z: 0
}
angle: -card.lat * 180 / Math.PI
},
Rotation {
origin.x: card.width / 2
origin.y: card.height / 2
axis {
x: 0
y: 1
z: 0
}
angle: -column.lon * 180 / Math.PI
}
}
}
]
onActivated: root.activateAt(column.columnIndex, index)
onActivated: root.activateAt(column.columnIndex, index)
}
}
}
}
// Under the selected workspace, which always sits in the
// middle of the column and is as wide as it.
KeyHint {
anchors.right: parent.right
anchors.top: parent.verticalCenter
anchors.topMargin: root.theme.cardHeight / 2 + root.theme.hintGap
z: 3
theme: root.theme
hint: root.config.windowsHintText
shown: root.config.showHints && column.isCurrentColumn && !root.windowsOpen && column.workspaces.length > 0
}
// Under the selected workspace, which always sits at the front.
KeyHint {
id: workspaceHint
x: globeView.width / 2 + root.theme.cardWidth / 2 - workspaceHint.width
y: globeView.height / 2 + root.theme.cardHeight / 2 + root.theme.hintGap
z: 3
theme: root.theme
hint: root.config.windowsHintText
shown: root.config.showHints && !root.windowsOpen && root.selectedWorkspace() !== null
}
}
// Sits where the selected card was and grows out of it.
// Grows out of the selected card and moves right, beside the globe.
WindowLoop {
id: windowLoop
anchors.fill: parent
+87 -41
View File
@@ -1,30 +1,41 @@
import QtQuick
QtObject {
readonly property color barBg: "#731a1e2a"
readonly property color barBorder: "#40ffffff"
readonly property color textColor: "#ffffff"
readonly property color labelColor: "#a9b1d6"
readonly property color fieldBg: "#4d0b0e14"
readonly property color fieldBorder: "#7aa2f7"
readonly property color cardBg: "#661a1e2a"
readonly property color buttonBg: "#7aa2f7"
readonly property color buttonText: "#0b0e14"
// Smoky black glass with a yellow accent.
readonly property color barBg: "#a60a0a0c"
readonly property color textColor: "#fff8e1"
readonly property color labelColor: "#c9b98a"
readonly property color fieldBg: "#66000000"
readonly property color cardBg: "#8c0d0d10"
// Selection, the focused field and other things that should stand out.
readonly property color accentColor: "#f5c518"
// Text drawn on top of the accent color.
readonly property color accentText: "#0a0a0c"
// Something went wrong or found nothing, like "no match".
readonly property color warnColor: "#ff8a5c"
// ── glass ───────────────────────────────────────────────────────────
// Bars and cards are see-through glass. A rim catches the light along
// the top and fades toward the bottom, a soft shine lies over the top
// half, and a shadow sits underneath.
readonly property color glassRimTop: "#8cffffff"
readonly property color glassRimTop: "#80fff1c4"
readonly property color glassRimBottom: "#14ffffff"
readonly property color glassShine: "#29ffffff"
// Selected glass: a blue tint and a blue rim.
readonly property color glassSelectedTint: "#66283a5e"
readonly property color glassSelectedRimBottom: "#807aa2f7"
readonly property color glassShadow: "#59000000"
readonly property color glassShine: "#1fffffff"
// Selected glass: an amber tint, a yellow rim and a yellow glow.
readonly property color glassSelectedTint: "#593d2f00"
readonly property color glassSelectedRimBottom: "#80f5c518"
readonly property color glassGlow: "#a6f5c518"
readonly property color glassShadow: "#80000000"
readonly property real glassShadowBlur: 24
readonly property real glassGlowBlur: 32
readonly property real glassShadowOffset: 8
// Selected glass fades in and out this fast.
readonly property int glassFadeDuration: 160
// The "current" badge on a workspace card.
readonly property real pillFontSize: 13
readonly property real pillPadding: 8
readonly property real cornerRadius: 12
readonly property real barHeight: 84
@@ -39,7 +50,7 @@ QtObject {
// Fullscreen dim behind the workspace carousel.
readonly property color backdrop: "#0d0b0e14"
readonly property color backdrop: "#40000000"
readonly property real cardWidth: 280
readonly property real cardHeight: 220
@@ -60,8 +71,6 @@ QtObject {
readonly property real carouselStepY: cardHeight + cardSpacing
readonly property real carouselFadeStep: 0.35
readonly property real carouselMaxFade: 0.85
readonly property real carouselScaleStep: 0.08
readonly property real carouselMaxScaleReduction: 0.3
readonly property real carouselMonitorFadeStep: 0.4
readonly property real carouselMonitorMaxFade: 0.72
readonly property int carouselDuration: 220
@@ -92,31 +101,24 @@ QtObject {
readonly property bool snapshotPreviewsHyprland: true
readonly property bool snapshotPreviewsNiri: true
// While the loop is open, other monitors sit this far past its edge,
// and workspaces above and below sit this far from the front window.
// The gap below leaves room for the key hint under the window.
readonly property real loopEdgeGap: 40
readonly property real loopWorkspaceGapAbove: 10
readonly property real loopWorkspaceGapBelow: 30
// Extra fade on those cards while the loop is open. The workspaces
// right above and below use loopNeighbourFade.
readonly property real loopHiddenFade: 0.75
readonly property real loopNeighbourFade: 0.9
// Tilt in degrees while the loop is open, so the other cards look part
// of the same 3D scene. Workspaces above and below lean back as if on a
// drum; other monitors turn to face the middle.
readonly property real loopTiltX: 35
readonly property real loopTiltY: 30
// While the loop is open, its right edge sits this far from the
// screen edge, as long as there is room.
readonly property real loopScreenGap: 40
// Size the loop grows from as it appears.
readonly property real loopStartScale: 0.6
readonly property int loopExpandDuration: 280
readonly property color loopCardBg: "#991a1e2a"
// With this many windows or fewer there is no planet or loop, just
// flat cards side by side, this far apart.
readonly property int loopFlatMaxWindows: 2
readonly property real loopFlatGap: 40
readonly property color loopCardBg: "#b30d0d10"
readonly property real loopCardWidth: 440
readonly property real loopCardHeight: 320
readonly property real loopCardRadius: 16
readonly property real loopCardPadding: 14
readonly property color loopPreviewBg: "#660b0e14"
readonly property color loopPreviewBg: "#80000000"
readonly property real loopPreviewRadius: 8
// Big icon shown in the preview area when there is no picture.
readonly property real loopIconSize: 96
@@ -132,7 +134,8 @@ QtObject {
readonly property real loopCardGap: 60
readonly property real loopMinRadius: 260
// Share of the screen width the loop may take on each side of center.
readonly property real loopMaxRadiusShare: 0.42
// Kept small so the loop fits beside the globe.
readonly property real loopMaxRadiusShare: 0.27
// About how far round the loop, in degrees, a card turns edge-on and
// flips to its inner face. It is moved to fall between two cards, so
@@ -147,6 +150,7 @@ QtObject {
readonly property real loopBackOpacity: 0.35
// Extra darkening of the back half, 0 to 1.
readonly property real loopBackShade: 0.55
readonly property color loopBackShadeColor: "#000000"
readonly property int loopTurnDuration: 320
@@ -157,13 +161,55 @@ QtObject {
readonly property int loopSwitchDuration: 400
readonly property int loopCollapseDuration: 300
// Size of that box, next to a full window. It stays at least as big as
// the workspace cards right above and below the loop.
readonly property real loopBoxScale: {
const shrink = 1 - Math.min(carouselScaleStep, carouselMaxScaleReduction);
return Math.max(cardWidth * shrink / loopCardWidth, cardHeight * shrink / loopCardHeight);
}
// a workspace card.
readonly property real loopBoxScale: Math.max(cardWidth / loopCardWidth, cardHeight / loopCardHeight)
// The new windows start opening this long after the old ones start folding.
readonly property int loopExpandDelay: 150
// A window preview grows out from its icon once the picture is ready.
readonly property int loopPreviewGrowDuration: 700
// ── globe ───────────────────────────────────────────────────────────
// Workspace cards sit on a glass globe. Monitors go round it sideways
// and workspaces go up and down.
readonly property real globeRadius: 620
// How strongly far cards shrink. Bigger means a flatter globe.
readonly property real globeFocalLength: 1600
// Angle between two monitors and between two workspaces, in radians.
// At the front this keeps the carousel steps.
readonly property real globeLonStep: carouselStepX / globeRadius
readonly property real globeLatStep: carouselStepY / globeRadius
// Size of the drawn sphere: where cards turn edge-on.
readonly property real globeDrawRadius: globeRadius * globeFocalLength / (globeFocalLength + globeRadius)
// Cards fade out as they turn away, from globeFadeFacing down to
// globeHideFacing, where they are hidden. 1 faces the viewer, 0 is
// edge-on.
readonly property real globeFadeFacing: 0.6
readonly property real globeHideFacing: 0.2
// While the window loop is open, the globe moves so its middle sits at
// this share of the screen width, and shrinks and fades.
readonly property real globeAsideCenterShare: 0.17
readonly property real globeAsideScale: 0.45
readonly property real globeAsideFade: 0.85
// Sphere colors: a lighter core, dark glass and an amber glow at the
// edge, with a rim and faint yellow grid lines.
readonly property color globeCore: "#4d2a2410"
readonly property color globeTint: "#80080809"
readonly property color globeEdge: "#66c9a012"
readonly property color globeRimTop: "#b3ffd84d"
readonly property color globeRimBottom: "#26f5c518"
readonly property color globeGrid: "#2ef5c518"
// ── planet ──────────────────────────────────────────────────────────
// A small globe in the middle of the window loop. Its size next to the
// loop radius.
readonly property real planetRadiusShare: 0.5
// The loop is seen from a little above, so the planet leans toward the
// viewer this much, in radians.
readonly property real planetPitch: -0.35
// Space between its lines of latitude, in radians.
readonly property real planetLatStep: 0.5
}
+2 -2
View File
@@ -177,7 +177,7 @@ Item {
Text {
width: parent.width
elide: Text.ElideRight
color: root.current ? root.theme.fieldBorder : root.theme.labelColor
color: root.current ? root.theme.accentColor : root.theme.labelColor
font.pixelSize: root.theme.loopAppSize
text: {
const name = root.app.length > 0 ? root.app : "unknown app";
@@ -191,7 +191,7 @@ Item {
Rectangle {
anchors.fill: parent
radius: root.theme.loopCardRadius
color: "black"
color: root.theme.loopBackShadeColor
opacity: root.shade * root.theme.loopBackShade
}
+84 -68
View File
@@ -1,9 +1,10 @@
import QtQuick
// The windows of one workspace sit on a strip bent into a closed loop, seen
// from a little above. The front half shows the outside of the strip, the
// back half shows the inside, so the far windows wrap around behind and
// face the viewer too.
// The windows of one workspace orbit a small planet on a strip bent into a
// closed loop, seen from a little above. The front half shows the outside
// of the strip, the back half shows the inside, so the far windows wrap
// around behind and face the viewer too. With only a few windows they sit
// flat, side by side. The loop sits right of the middle, beside the globe.
Item {
id: root
@@ -30,9 +31,10 @@ Item {
// included.
readonly property real reachX: ring.reachX
// Top and bottom edges of the front window, from the middle of the view.
readonly property real frontTop: root.theme.loopBackLift / 2 - root.theme.loopCardHeight / 2
readonly property real frontBottom: root.theme.loopBackLift / 2 + root.theme.loopCardHeight / 2
// How far right of the middle the loop sits while open, so its right
// edge stays loopScreenGap from the screen edge. It starts in the
// middle, where the selected workspace was.
property real shiftX: root.expanded ? Math.max(0, root.width / 2 - root.reachX - root.theme.loopScreenGap) : 0
// Selected step. It is not wrapped, so the loop can keep turning the
// same way. Use selectedIndex for the position in the window list.
@@ -74,6 +76,12 @@ Item {
easing.type: Easing.OutCubic
}
}
Behavior on shiftX {
NumberAnimation {
duration: root.theme.loopExpandDuration
easing.type: Easing.OutCubic
}
}
Behavior on turn {
enabled: root.animate
NumberAnimation {
@@ -214,75 +222,83 @@ Item {
root.activateAt(root.selectedIndex);
}
Text {
anchors.centerIn: parent
anchors.verticalCenterOffset: root.slideY
opacity: root.switchFade
visible: root.count === 0
color: root.theme.labelColor
font.pixelSize: root.theme.loopEmptySize
text: "No windows on this workspace"
}
// Zero sized point at the loop center. Pushed down by half the lift
// so the loop as a whole sits in the middle.
// Moved sideways by shiftX.
Item {
id: stage
anchors.centerIn: parent
anchors.verticalCenterOffset: root.theme.loopBackLift / 2
id: content
width: root.width
height: root.height
x: root.shiftX
// The old workspace, folding away.
WindowRing {
id: leavingRing
y: root.leavingY
z: 0
opacity: root.leavingFade
visible: leavingRing.opacity > 0
enabled: false
compositor: root.compositor
theme: root.theme
windows: root.leavingWindows
maxRadius: root.width * root.theme.loopMaxRadiusShare
turn: root.leavingTurn
selectedIndex: root.leavingIndex
live: root.expanded
// Its previews are already out, so they should not grow again.
growPreview: false
gather: root.leavingGather
}
WindowRing {
id: ring
y: root.slideY
z: 1
Text {
anchors.centerIn: parent
anchors.verticalCenterOffset: root.slideY
opacity: root.switchFade
enabled: root.expanded
compositor: root.compositor
theme: root.theme
windows: root.windows
maxRadius: root.width * root.theme.loopMaxRadiusShare
turn: root.turn
selectedIndex: root.selectedIndex
live: root.expanded
growPreview: true
gather: root.gather
onActivated: index => root.activateAt(index)
visible: root.count === 0
color: root.theme.labelColor
font.pixelSize: root.theme.loopEmptySize
text: "No windows on this workspace"
}
// Under the front window, above both rings.
// Zero sized point in the middle. Each ring is pushed down by half
// the lift, unless flat, so it sits in the middle as a whole.
Item {
y: root.slideY
z: 2
opacity: root.switchFade
id: stage
anchors.centerIn: parent
KeyHint {
id: exitHintText
x: root.theme.loopCardWidth / 2 - exitHintText.width
y: root.theme.loopCardHeight / 2 + root.theme.hintGap
// The old workspace, folding away.
WindowRing {
id: leavingRing
y: root.leavingY + (leavingRing.flat ? 0 : root.theme.loopBackLift / 2)
z: 0
opacity: root.leavingFade
visible: leavingRing.opacity > 0
enabled: false
compositor: root.compositor
theme: root.theme
hint: root.exitHint
shown: root.count > 0
windows: root.leavingWindows
maxRadius: root.width * root.theme.loopMaxRadiusShare
turn: root.leavingTurn
selectedIndex: root.leavingIndex
live: root.expanded
// Its previews are already out, so they should not grow again.
growPreview: false
gather: root.leavingGather
}
WindowRing {
id: ring
y: root.slideY + (ring.flat ? 0 : root.theme.loopBackLift / 2)
z: 1
opacity: root.switchFade
enabled: root.expanded
compositor: root.compositor
theme: root.theme
windows: root.windows
maxRadius: root.width * root.theme.loopMaxRadiusShare
turn: root.turn
selectedIndex: root.selectedIndex
live: root.expanded
growPreview: true
gather: root.gather
onActivated: index => root.activateAt(index)
}
// Under the front window, or under the middle of a flat row,
// above both rings.
Item {
y: ring.y
z: 2
opacity: root.switchFade
KeyHint {
id: exitHintText
x: ring.flat ? -exitHintText.width / 2 : root.theme.loopCardWidth / 2 - exitHintText.width
y: root.theme.loopCardHeight / 2 + root.theme.hintGap
theme: root.theme
hint: root.exitHint
shown: root.count > 0
}
}
}
}
+39 -8
View File
@@ -1,8 +1,9 @@
import QtQuick
// One set of window cards on the loop. While Up/Down switch workspaces the
// loop shows two of these: the old one folding away and the new one opening.
// Zero sized, placed at the loop center.
// One set of window cards orbiting a small planet. With only a few windows
// there is no planet, just flat cards side by side. While Up/Down switch
// workspaces the loop shows two of these: the old one folding away and the
// new one opening. Zero sized, placed at the front window's center.
Item {
id: root
@@ -26,6 +27,8 @@ Item {
signal activated(int index)
readonly property int count: root.windows.length
// Few windows: flat cards side by side, no planet.
readonly property bool flat: root.count <= root.theme.loopFlatMaxWindows
// Angle between two neighbours on the loop.
readonly property real angleStep: root.count > 0 ? 2 * Math.PI / root.count : 0
// The loop is as long as the cards side by side, within limits.
@@ -40,6 +43,8 @@ Item {
const half = root.theme.loopCardWidth / 2;
if (root.count <= 1)
return half;
if (root.flat)
return root.count * half + (root.count - 1) * root.theme.loopFlatGap / 2;
const focal = root.theme.loopFocalLength;
let widest = half;
for (let i = 1; i <= 16; i++) {
@@ -87,6 +92,30 @@ Item {
return -side * (turn - 180);
}
// The planet, in the middle of the loop. The back windows pass behind
// it and the front ones in front. It spins as the loop turns.
Globe {
id: planet
readonly property real size: 2 * root.radius * root.theme.planetRadiusShare
x: -planet.size / 2
y: -root.theme.loopBackLift / 2 - planet.size / 2
z: 0
width: planet.size
height: planet.size
visible: !root.flat && planet.opacity > 0
// Folds away with the cards.
opacity: 1 - root.gather
scale: 1 - root.gather
theme: root.theme
yaw: root.turn * root.angleStep
pitch: root.theme.planetPitch
lonStep: root.angleStep
latStep: root.theme.planetLatStep
focalLength: root.theme.loopFocalLength
}
Repeater {
model: root.windows
@@ -98,13 +127,15 @@ Item {
readonly property real angle: root.angleOf(card.index)
readonly property real cosA: Math.cos(card.angle)
// 0 at the front, 1 at the very back.
readonly property real back: (1 - card.cosA) / 2
// 0 at the front, 1 at the very back. Flat cards are all at the front.
readonly property real back: root.flat ? 0 : (1 - card.cosA) / 2
// Simple perspective: cards farther away get smaller.
readonly property real depthScale: root.theme.loopFocalLength / (root.theme.loopFocalLength + 2 * root.radius * card.back)
// Turn so each card roughly lies along the loop, less so
// at the sides, so they can still be seen.
readonly property real faceAngle: root.faceTurn(card.angle)
readonly property real faceAngle: root.flat ? 0 : root.faceTurn(card.angle)
// Place in a flat row, from the middle of the row.
readonly property real flatX: (card.index - (root.count - 1) / 2) * (root.theme.loopCardWidth + root.theme.loopFlatGap)
// 1 when open, 0 when folded into the box.
readonly property real open: 1 - root.gather
@@ -121,9 +152,9 @@ Item {
previewVersion: root.compositor.previewVersion
// Folding pulls every card into the middle, facing front.
x: root.radius * card.open * Math.sin(card.angle) * card.depthScale - card.width / 2
x: (root.flat ? card.flatX : root.radius * Math.sin(card.angle) * card.depthScale) * card.open - card.width / 2
y: -root.theme.loopBackLift * card.back * card.open - card.height / 2
z: card.cosA
z: root.flat ? 1 : card.cosA
scale: card.depthScale + (root.theme.loopBoxScale - card.depthScale) * root.gather
opacity: 1 - (1 - root.theme.loopBackOpacity) * card.back
+15 -25
View File
@@ -10,7 +10,6 @@ Item {
required property int workspaceIndex
required property bool selected
required property bool current
required property bool animateMoves
required property var windows
signal activated
@@ -22,26 +21,6 @@ Item {
width: root.theme.cardWidth
height: root.theme.cardHeight
Behavior on anchors.verticalCenterOffset {
enabled: root.animateMoves
NumberAnimation {
duration: root.theme.carouselDuration
easing.type: Easing.OutCubic
}
}
Behavior on opacity {
enabled: root.animateMoves
NumberAnimation {
duration: root.theme.carouselDuration
}
}
Behavior on scale {
enabled: root.animateMoves
NumberAnimation {
duration: root.theme.carouselDuration
}
}
Glass {
anchors.fill: parent
theme: root.theme
@@ -77,11 +56,22 @@ Item {
text: String(root.workspaceIndex)
}
Text {
// A small yellow badge.
Rectangle {
visible: root.current
color: root.theme.fieldBorder
font.pixelSize: root.theme.monitorLabelSize
text: "current"
implicitWidth: currentText.implicitWidth + root.theme.pillPadding * 2
implicitHeight: currentText.implicitHeight + root.theme.pillPadding / 2
radius: height / 2
color: root.theme.accentColor
Text {
id: currentText
anchors.centerIn: parent
color: root.theme.accentText
font.pixelSize: root.theme.pillFontSize
font.bold: true
text: "current"
}
}
}