nicer globe
This commit is contained in:
1 parent
ee1d5a1170
commit
98f34b8328
5 files changed
+205
-21
No files matched your search
@@ -188,6 +188,22 @@ PanelWindow {
|
|||||||
windowLoop.switchIn(delta);
|
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 {
|
function collapseWindows(): void {
|
||||||
root.animate = true;
|
root.animate = true;
|
||||||
root.windowsOpen = false;
|
root.windowsOpen = false;
|
||||||
@@ -909,7 +925,10 @@ PanelWindow {
|
|||||||
workspaceId: root.loopWorkspaceId
|
workspaceId: root.loopWorkspaceId
|
||||||
expanded: root.windowsOpen
|
expanded: root.windowsOpen
|
||||||
exitHint: root.config.showHints ? root.config.exitWindowsHintText : ""
|
exitHint: root.config.showHints ? root.config.exitWindowsHintText : ""
|
||||||
|
aboveWorkspace: root.windowsOpen ? root.neighbourWorkspace(-1) : null
|
||||||
|
belowWorkspace: root.windowsOpen ? root.neighbourWorkspace(1) : null
|
||||||
onWindowChosen: root.requestClose()
|
onWindowChosen: root.requestClose()
|
||||||
|
onNeighbourChosen: delta => root.switchWindows(delta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+32
-18
@@ -1,14 +1,14 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
// Smoky black glass with a yellow accent.
|
// Smoky black glass with a soft gold accent.
|
||||||
readonly property color barBg: "#a60a0a0c"
|
readonly property color barBg: "#a60a0a0c"
|
||||||
readonly property color textColor: "#fff8e1"
|
readonly property color textColor: "#f7f3ea"
|
||||||
readonly property color labelColor: "#c9b98a"
|
readonly property color labelColor: "#bdb39a"
|
||||||
readonly property color fieldBg: "#66000000"
|
readonly property color fieldBg: "#66000000"
|
||||||
readonly property color cardBg: "#8c0d0d10"
|
readonly property color cardBg: "#8c0d0d10"
|
||||||
// Selection, the focused field and other things that should stand out.
|
// 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.
|
// Text drawn on top of the accent color.
|
||||||
readonly property color accentText: "#0a0a0c"
|
readonly property color accentText: "#0a0a0c"
|
||||||
// Something went wrong or found nothing, like "no match".
|
// Something went wrong or found nothing, like "no match".
|
||||||
@@ -22,10 +22,10 @@ QtObject {
|
|||||||
readonly property color glassRimTop: "#80fff1c4"
|
readonly property color glassRimTop: "#80fff1c4"
|
||||||
readonly property color glassRimBottom: "#14ffffff"
|
readonly property color glassRimBottom: "#14ffffff"
|
||||||
readonly property color glassShine: "#1fffffff"
|
readonly property color glassShine: "#1fffffff"
|
||||||
// Selected glass: an amber tint, a yellow rim and a yellow glow.
|
// Selected glass: a warm tint, a gold rim and a gold glow.
|
||||||
readonly property color glassSelectedTint: "#593d2f00"
|
readonly property color glassSelectedTint: "#4d2e2814"
|
||||||
readonly property color glassSelectedRimBottom: "#80f5c518"
|
readonly property color glassSelectedRimBottom: "#66d8b85a"
|
||||||
readonly property color glassGlow: "#a6f5c518"
|
readonly property color glassGlow: "#66d8b85a"
|
||||||
readonly property color glassShadow: "#80000000"
|
readonly property color glassShadow: "#80000000"
|
||||||
readonly property real glassShadowBlur: 24
|
readonly property real glassShadowBlur: 24
|
||||||
readonly property real glassGlowBlur: 32
|
readonly property real glassGlowBlur: 32
|
||||||
@@ -199,23 +199,37 @@ QtObject {
|
|||||||
readonly property real globeAsideScale: 0.45
|
readonly property real globeAsideScale: 0.45
|
||||||
readonly property real globeAsideFade: 0.85
|
readonly property real globeAsideFade: 0.85
|
||||||
|
|
||||||
// Sphere colors: a lighter core, dark glass and an amber glow at the
|
// Sphere colors: a lighter core, dark glass and a faint warm glow at
|
||||||
// edge, with a rim and faint yellow grid lines.
|
// the edge, with a rim and faint gold grid lines.
|
||||||
readonly property color globeCore: "#4d2a2410"
|
readonly property color globeCore: "#40262420"
|
||||||
readonly property color globeTint: "#80080809"
|
readonly property color globeTint: "#80080809"
|
||||||
readonly property color globeEdge: "#66c9a012"
|
readonly property color globeEdge: "#40a08a3c"
|
||||||
readonly property color globeRimTop: "#b3ffd84d"
|
readonly property color globeRimTop: "#99e8d49a"
|
||||||
readonly property color globeRimBottom: "#26f5c518"
|
readonly property color globeRimBottom: "#1fd8b85a"
|
||||||
readonly property color globeGrid: "#2ef5c518"
|
readonly property color globeGrid: "#24d8b85a"
|
||||||
|
|
||||||
// ── planet ──────────────────────────────────────────────────────────
|
// ── planet ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
// A small globe in the middle of the window loop. Its size next to the
|
// A globe in the middle of the window loop. Its size next to the loop
|
||||||
// loop radius.
|
// radius, and the most it may be across.
|
||||||
readonly property real planetRadiusShare: 0.5
|
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
|
// The loop is seen from a little above, so the planet leans toward the
|
||||||
// viewer this much, in radians.
|
// viewer this much, in radians.
|
||||||
readonly property real planetPitch: -0.35
|
readonly property real planetPitch: -0.35
|
||||||
// Space between its lines of latitude, in radians.
|
// Space between its lines of latitude, in radians.
|
||||||
readonly property real planetLatStep: 0.5
|
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
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,8 @@ import QtQuick
|
|||||||
// closed loop, seen from a little above. The front half shows the outside
|
// 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
|
// 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
|
// 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 {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
@@ -15,9 +16,15 @@ Item {
|
|||||||
required property bool expanded
|
required property bool expanded
|
||||||
// Shown under the front window, "" for none.
|
// Shown under the front window, "" for none.
|
||||||
required property string exitHint
|
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.
|
// A window was focused.
|
||||||
signal windowChosen
|
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.
|
// Windows of the shown workspace, from parsed JSON, so this stays untyped.
|
||||||
readonly property var windows: {
|
readonly property var windows: {
|
||||||
@@ -60,6 +67,9 @@ Item {
|
|||||||
|
|
||||||
readonly property int selectedIndex: root.wrapIndex(root.targetStep)
|
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
|
opacity: root.expanded ? 1 : 0
|
||||||
scale: root.expanded ? 1 : root.theme.loopStartScale
|
scale: root.expanded ? 1 : root.theme.loopStartScale
|
||||||
visible: root.opacity > 0
|
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 {
|
ParallelAnimation {
|
||||||
id: switchAnim
|
id: switchAnim
|
||||||
|
|
||||||
@@ -239,6 +264,34 @@ Item {
|
|||||||
text: "No windows on this workspace"
|
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
|
// 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.
|
// the lift, unless flat, so it sits in the middle as a whole.
|
||||||
Item {
|
Item {
|
||||||
@@ -263,6 +316,7 @@ Item {
|
|||||||
// Its previews are already out, so they should not grow again.
|
// Its previews are already out, so they should not grow again.
|
||||||
growPreview: false
|
growPreview: false
|
||||||
gather: root.leavingGather
|
gather: root.leavingGather
|
||||||
|
planetGrow: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowRing {
|
WindowRing {
|
||||||
@@ -280,6 +334,7 @@ Item {
|
|||||||
live: root.expanded
|
live: root.expanded
|
||||||
growPreview: true
|
growPreview: true
|
||||||
gather: root.gather
|
gather: root.gather
|
||||||
|
planetGrow: root.planetPop
|
||||||
|
|
||||||
onActivated: index => root.activateAt(index)
|
onActivated: index => root.activateAt(index)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ Item {
|
|||||||
required property bool growPreview
|
required property bool growPreview
|
||||||
// 0 for the open loop, 1 with every card folded into one small box.
|
// 0 for the open loop, 1 with every card folded into one small box.
|
||||||
required property real gather
|
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.
|
// A card was clicked.
|
||||||
signal activated(int index)
|
signal activated(int index)
|
||||||
@@ -97,7 +99,7 @@ Item {
|
|||||||
Globe {
|
Globe {
|
||||||
id: planet
|
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
|
x: -planet.size / 2
|
||||||
y: -root.theme.loopBackLift / 2 - planet.size / 2
|
y: -root.theme.loopBackLift / 2 - planet.size / 2
|
||||||
@@ -107,7 +109,7 @@ Item {
|
|||||||
visible: !root.flat && planet.opacity > 0
|
visible: !root.flat && planet.opacity > 0
|
||||||
// Folds away with the cards.
|
// Folds away with the cards.
|
||||||
opacity: 1 - root.gather
|
opacity: 1 - root.gather
|
||||||
scale: 1 - root.gather
|
scale: root.planetGrow * (1 - root.gather)
|
||||||
theme: root.theme
|
theme: root.theme
|
||||||
yaw: root.turn * root.angleStep
|
yaw: root.turn * root.angleStep
|
||||||
pitch: root.theme.planetPitch
|
pitch: root.theme.planetPitch
|
||||||
|
|||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user