diff --git a/workspace-manager/GotoView.qml b/workspace-manager/GotoView.qml index 4122fed..9d4ded1 100644 --- a/workspace-manager/GotoView.qml +++ b/workspace-manager/GotoView.qml @@ -188,6 +188,22 @@ PanelWindow { windowLoop.switchIn(delta); } + // The workspace delta steps from the selected one on its monitor, + // wrapping round, or null for none. With only two workspaces the other + // one is shown once, on the side it really is. From parsed JSON, so + // this stays untyped. + function neighbourWorkspace(delta: int): var { + const mons = root.compositor.monitors ?? []; + if (root.monitorIndex < 0 || root.monitorIndex >= mons.length) + return null; + const wsList = mons[root.monitorIndex].workspaces ?? []; + const count = wsList.length; + const at = root.workspaceIndexAt(root.monitorIndex) + delta; + if (count < 2 || (count === 2 && (at < 0 || at >= count))) + return null; + return wsList[((at % count) + count) % count]; + } + function collapseWindows(): void { root.animate = true; root.windowsOpen = false; @@ -909,7 +925,10 @@ PanelWindow { workspaceId: root.loopWorkspaceId expanded: root.windowsOpen exitHint: root.config.showHints ? root.config.exitWindowsHintText : "" + aboveWorkspace: root.windowsOpen ? root.neighbourWorkspace(-1) : null + belowWorkspace: root.windowsOpen ? root.neighbourWorkspace(1) : null onWindowChosen: root.requestClose() + onNeighbourChosen: delta => root.switchWindows(delta) } } } diff --git a/workspace-manager/Theme.qml b/workspace-manager/Theme.qml index a57b592..f2d0a37 100644 --- a/workspace-manager/Theme.qml +++ b/workspace-manager/Theme.qml @@ -1,14 +1,14 @@ import QtQuick QtObject { - // Smoky black glass with a yellow accent. + // Smoky black glass with a soft gold accent. readonly property color barBg: "#a60a0a0c" - readonly property color textColor: "#fff8e1" - readonly property color labelColor: "#c9b98a" + readonly property color textColor: "#f7f3ea" + readonly property color labelColor: "#bdb39a" 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" + readonly property color accentColor: "#d8b85a" // Text drawn on top of the accent color. readonly property color accentText: "#0a0a0c" // Something went wrong or found nothing, like "no match". @@ -22,10 +22,10 @@ QtObject { readonly property color glassRimTop: "#80fff1c4" readonly property color glassRimBottom: "#14ffffff" 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" + // Selected glass: a warm tint, a gold rim and a gold glow. + readonly property color glassSelectedTint: "#4d2e2814" + readonly property color glassSelectedRimBottom: "#66d8b85a" + readonly property color glassGlow: "#66d8b85a" readonly property color glassShadow: "#80000000" readonly property real glassShadowBlur: 24 readonly property real glassGlowBlur: 32 @@ -199,23 +199,37 @@ QtObject { 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" + // Sphere colors: a lighter core, dark glass and a faint warm glow at + // the edge, with a rim and faint gold grid lines. + readonly property color globeCore: "#40262420" 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" + readonly property color globeEdge: "#40a08a3c" + readonly property color globeRimTop: "#99e8d49a" + readonly property color globeRimBottom: "#1fd8b85a" + readonly property color globeGrid: "#24d8b85a" // ── planet ────────────────────────────────────────────────────────── - // A small globe in the middle of the window loop. Its size next to the - // loop radius. - readonly property real planetRadiusShare: 0.5 + // A globe in the middle of the window loop. Its size next to the loop + // radius, and the most it may be across. + readonly property real planetRadiusShare: 0.75 + readonly property real planetMaxSize: 460 + // It pops out, a little past full size, as the loop opens. + readonly property int planetPopDuration: 450 // 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 + + // ── moons ─────────────────────────────────────────────────────────── + + // Small previews of the workspaces above and below, over and under the + // window loop. Distance from the loop's middle to each moon's middle. + readonly property real moonSize: 110 + readonly property real moonDistance: 380 + // Window icons shown on a moon, before "+N". + readonly property int moonMaxIcons: 4 + readonly property real moonIconSize: 24 + readonly property real moonLabelSize: 14 } diff --git a/workspace-manager/WindowLoop.qml b/workspace-manager/WindowLoop.qml index 6c5c544..f361ab9 100644 --- a/workspace-manager/WindowLoop.qml +++ b/workspace-manager/WindowLoop.qml @@ -4,7 +4,8 @@ import QtQuick // 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. +// flat, side by side. The loop sits right of the middle, beside the globe, +// with small moons above and below for the workspaces next to this one. Item { id: root @@ -15,9 +16,15 @@ Item { required property bool expanded // Shown under the front window, "" for none. required property string exitHint + // Workspaces shown as moons above and below, from parsed JSON, so + // these stay untyped. null for none. + required property var aboveWorkspace + required property var belowWorkspace // A window was focused. signal windowChosen + // A moon was clicked: -1 for the one above, 1 for the one below. + signal neighbourChosen(int delta) // Windows of the shown workspace, from parsed JSON, so this stays untyped. readonly property var windows: { @@ -60,6 +67,9 @@ Item { readonly property int selectedIndex: root.wrapIndex(root.targetStep) + // Size of the planet, which pops out as the loop opens. + property real planetPop: 1 + opacity: root.expanded ? 1 : 0 scale: root.expanded ? 1 : root.theme.loopStartScale visible: root.opacity > 0 @@ -90,6 +100,21 @@ Item { } } + onExpandedChanged: { + if (root.expanded) + popAnim.restart(); + } + + NumberAnimation { + id: popAnim + target: root + property: "planetPop" + from: root.theme.loopStartScale + to: 1 + duration: root.theme.planetPopDuration + easing.type: Easing.OutBack + } + ParallelAnimation { id: switchAnim @@ -239,6 +264,34 @@ Item { text: "No windows on this workspace" } + // The workspaces next to this one, as moons. Each moon's middle + // sits moonDistance from the loop's middle; its name hangs below. + WorkspaceMoon { + id: aboveMoon + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -root.theme.moonDistance + (aboveMoon.height - root.theme.moonSize) / 2 + z: 3 + opacity: root.switchFade + enabled: root.expanded + theme: root.theme + workspace: root.aboveWorkspace + onActivated: root.neighbourChosen(-1) + } + + WorkspaceMoon { + id: belowMoon + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: root.theme.moonDistance + (belowMoon.height - root.theme.moonSize) / 2 + z: 3 + opacity: root.switchFade + enabled: root.expanded + theme: root.theme + workspace: root.belowWorkspace + onActivated: root.neighbourChosen(1) + } + // 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 { @@ -263,6 +316,7 @@ Item { // Its previews are already out, so they should not grow again. growPreview: false gather: root.leavingGather + planetGrow: 1 } WindowRing { @@ -280,6 +334,7 @@ Item { live: root.expanded growPreview: true gather: root.gather + planetGrow: root.planetPop onActivated: index => root.activateAt(index) } diff --git a/workspace-manager/WindowRing.qml b/workspace-manager/WindowRing.qml index ebf3645..5021319 100644 --- a/workspace-manager/WindowRing.qml +++ b/workspace-manager/WindowRing.qml @@ -22,6 +22,8 @@ Item { required property bool growPreview // 0 for the open loop, 1 with every card folded into one small box. required property real gather + // Size of the planet, 1 for full size. Goes a little past 1 as it pops out. + required property real planetGrow // A card was clicked. signal activated(int index) @@ -97,7 +99,7 @@ Item { Globe { id: planet - readonly property real size: 2 * root.radius * root.theme.planetRadiusShare + readonly property real size: Math.min(2 * root.radius * root.theme.planetRadiusShare, root.theme.planetMaxSize) x: -planet.size / 2 y: -root.theme.loopBackLift / 2 - planet.size / 2 @@ -107,7 +109,7 @@ Item { visible: !root.flat && planet.opacity > 0 // Folds away with the cards. opacity: 1 - root.gather - scale: 1 - root.gather + scale: root.planetGrow * (1 - root.gather) theme: root.theme yaw: root.turn * root.angleStep pitch: root.theme.planetPitch diff --git a/workspace-manager/WorkspaceMoon.qml b/workspace-manager/WorkspaceMoon.qml new file mode 100644 index 0000000..8f9bb5a --- /dev/null +++ b/workspace-manager/WorkspaceMoon.qml @@ -0,0 +1,94 @@ +import QtQuick +import Quickshell + +// A small preview of a nearby workspace: a little glass moon with the icons +// of its windows on it and its name underneath. Click it to go there. +Item { + id: root + + required property Theme theme + // A workspace from parsed JSON, so this stays untyped. null for none. + required property var workspace + + signal activated + + readonly property var windows: root.workspace ? (root.workspace.windows ?? []) : [] + readonly property var shownWindows: root.windows.slice(0, root.theme.moonMaxIcons) + readonly property int hiddenCount: Math.max(0, root.windows.length - root.theme.moonMaxIcons) + + width: root.theme.moonSize + height: root.theme.moonSize + label.implicitHeight + root.theme.hintGap + visible: root.workspace !== null + + Globe { + id: moon + width: root.theme.moonSize + height: root.theme.moonSize + theme: root.theme + yaw: 0 + pitch: root.theme.planetPitch + lonStep: root.theme.planetLatStep + latStep: root.theme.planetLatStep + focalLength: root.theme.loopFocalLength + } + + // Window icons, two to a row, on the face of the moon. + Column { + anchors.centerIn: moon + spacing: 2 + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + spacing: 4 + + Repeater { + model: root.shownWindows + + Image { + required property var modelData + + width: root.theme.moonIconSize + height: root.theme.moonIconSize + source: Quickshell.iconPath(modelData.app.length > 0 ? modelData.app : "window") + sourceSize.width: root.theme.moonIconSize * 2 + sourceSize.height: root.theme.moonIconSize * 2 + fillMode: Image.PreserveAspectFit + smooth: true + } + } + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + visible: root.hiddenCount > 0 || root.windows.length === 0 + color: root.theme.labelColor + font.pixelSize: root.theme.moonLabelSize - 2 + text: root.windows.length === 0 ? "empty" : "+" + root.hiddenCount + } + } + + Text { + id: label + anchors.top: moon.bottom + anchors.topMargin: root.theme.hintGap + anchors.horizontalCenter: moon.horizontalCenter + width: root.theme.moonSize * 2 + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight + color: root.theme.labelColor + font.pixelSize: root.theme.moonLabelSize + text: { + if (!root.workspace) + return ""; + const name = root.workspace.name ?? ""; + return name.length > 0 ? name : String(root.workspace.idx); + } + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: root.activated() + } +}