Files
2026-10-27 13:35:31 -04:00

935 lines
36 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
PanelWindow {
id: root
required property bool shellOpen
required property Compositor compositor
required property Theme theme
required property Config config
// Open the search bar as soon as the carousel has its data.
required property bool searchOnOpen
// Open the window loop on the focused workspace as soon as the carousel
// has its data. Escape then closes everything.
required property bool openWindowsOnOpen
// Enter, or a click on a card: the workspace was chosen.
signal requestClose
// Escape, or a click on the backdrop: leave without switching.
signal requestBack
visible: root.shellOpen
color: "transparent"
exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell:workspace-manager-goto"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
anchors {
top: true
left: true
right: true
bottom: true
}
property int monitorIndex: 0
// One selected workspace index per monitor. Reassigned as a whole so
// the carousel notices the change. Parallel to compositor.monitors.
property var workspaceIndices: []
property bool seedPending: false
property bool animate: false
// The search bar is open and taking typed text.
property bool searchActive: false
// Last accepted search, used by n and N.
property string searchQuery: ""
// Matches for the text in the search bar, and which one is shown.
// matchIndex is -1 when none is shown.
property int matchCount: 0
property int matchIndex: -1
// Where the view was when the search bar opened. Escape goes back here.
property int originMonitor: 0
property list<int> originIndices: []
// -1 when the window loop was closed.
property int originWindowIndex: -1
property bool originCanCollapse: true
// The window loop is open on top of the selected workspace.
property bool windowsOpen: false
// Workspace the window loop shows.
property int loopWorkspaceId: -1
// Escape folds the loop back into the carousel, instead of closing.
property bool canCollapse: true
function workspaceIndexAt(index: int): int {
const list = root.workspaceIndices;
if (!list || index < 0 || index >= list.length)
return 0;
const value = list[index];
if (value === undefined || value === null)
return 0;
return value;
}
function seedSelection(): void {
const mons = root.compositor.monitors ?? [];
const indices = [];
let focusedMonitor = 0;
for (let i = 0; i < mons.length; i++) {
const workspaces = mons[i].workspaces ?? [];
let activeIndex = 0;
let focusedIndex = -1;
for (let j = 0; j < workspaces.length; j++) {
if (workspaces[j].active)
activeIndex = j;
if (workspaces[j].focused) {
focusedIndex = j;
focusedMonitor = i;
}
}
indices.push(focusedIndex >= 0 ? focusedIndex : activeIndex);
}
root.monitorIndex = mons.length === 0 ? 0 : focusedMonitor;
root.workspaceIndices = indices;
}
function moveWorkspace(delta: int): void {
root.animate = true;
const mons = root.compositor.monitors ?? [];
if (root.monitorIndex < 0 || root.monitorIndex >= mons.length)
return;
const count = (mons[root.monitorIndex].workspaces ?? []).length;
if (count === 0)
return;
const current = root.workspaceIndexAt(root.monitorIndex);
const next = (current + delta + count) % count;
const copy = root.workspaceIndices.slice();
while (copy.length <= root.monitorIndex)
copy.push(0);
copy[root.monitorIndex] = next;
root.workspaceIndices = copy;
}
function moveMonitor(delta: int): void {
root.animate = true;
const count = (root.compositor.monitors ?? []).length;
if (count === 0)
return;
const next = root.monitorIndex + delta;
if (next < 0 || next >= count)
return;
root.monitorIndex = next;
}
function activateAt(monitorAt: int, workspaceAt: int): void {
const mons = root.compositor.monitors ?? [];
if (monitorAt < 0 || monitorAt >= mons.length) {
root.requestClose();
return;
}
const workspaces = mons[monitorAt].workspaces ?? [];
if (workspaceAt < 0 || workspaceAt >= workspaces.length) {
root.requestClose();
return;
}
const ws = workspaces[workspaceAt];
root.compositor.focusWorkspace(root.compositor.asString(mons[monitorAt].name), ws.idx, ws.id);
root.requestClose();
}
function activateSelection(): void {
root.activateAt(root.monitorIndex, root.workspaceIndexAt(root.monitorIndex));
}
// A workspace from parsed JSON, so this stays untyped.
function selectedWorkspace(): var {
const mons = root.compositor.monitors ?? [];
if (root.monitorIndex < 0 || root.monitorIndex >= mons.length)
return null;
const wsList = mons[root.monitorIndex].workspaces ?? [];
const idx = root.workspaceIndexAt(root.monitorIndex);
if (idx < 0 || idx >= wsList.length)
return null;
return wsList[idx];
}
// ── window loop helpers ─────────────────────────────────────────────
function isWindowsKey(event): bool {
return root.config.matches(event, root.config.windowsKey);
}
// Open the loop on the selected workspace. The other cards move away.
function expandWindows(collapsible: bool): void {
const ws = root.selectedWorkspace();
if (!ws)
return;
root.animate = true;
root.canCollapse = collapsible;
root.loopWorkspaceId = ws.id;
root.windowsOpen = true;
windowLoop.seed();
}
// Up/Down while the loop is open: move to the next workspace on this
// monitor and show its windows.
function switchWindows(delta: int): void {
const before = root.selectedWorkspace();
root.moveWorkspace(delta);
const ws = root.selectedWorkspace();
if (!ws || ws === before)
return;
windowLoop.holdLeaving();
root.loopWorkspaceId = ws.id;
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;
}
// Escape or a backdrop click while the loop is open.
function leaveWindows(): void {
if (root.canCollapse)
root.collapseWindows();
else
root.requestBack();
}
// ── search ──────────────────────────────────────────────────────────
function noCtrlOrAlt(event): bool {
return !(event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier));
}
function isSearchKey(event): bool {
return event.text === "/" && root.noCtrlOrAlt(event);
}
// n goes forward (1), N goes back (-1), anything else is 0.
function nextMatchDirection(event): int {
if (event.key !== Qt.Key_N || !root.noCtrlOrAlt(event))
return 0;
return (event.modifiers & Qt.ShiftModifier) ? -1 : 1;
}
// Selected window in the loop, or -1 when the loop is closed.
function currentWindowIndex(): int {
return root.windowsOpen ? windowLoop.selectedIndex : -1;
}
// Order: monitor, then workspace, then window. A closed loop (-1)
// comes before every window of its workspace.
function comparePositions(monitorA: int, workspaceA: int, windowA: int, monitorB: int, workspaceB: int, windowB: int): int {
if (monitorA !== monitorB)
return monitorA - monitorB;
if (workspaceA !== workspaceB)
return workspaceA - workspaceB;
return windowA - windowB;
}
// Like vim's smartcase: any capital letter makes the search match case.
// The window is parsed JSON, so it stays untyped.
function windowMatches(w, query: string): bool {
const exact = query !== query.toLowerCase();
const fold = text => exact ? text : text.toLowerCase();
const wanted = fold(query);
return fold(w.title ?? "").includes(wanted) || fold(w.app ?? "").includes(wanted);
}
// Every window whose title or app matches, in carousel order, as
// { monitor, workspace, window } list positions.
function findMatches(query: string): var {
const found = [];
if (query.length === 0)
return found;
const mons = root.compositor.monitors ?? [];
for (let i = 0; i < mons.length; i++) {
const wsList = mons[i].workspaces ?? [];
for (let j = 0; j < wsList.length; j++) {
const wins = wsList[j].windows ?? [];
for (let k = 0; k < wins.length; k++) {
if (root.windowMatches(wins[k], query))
found.push({
monitor: i,
workspace: j,
window: k
});
}
}
}
return found;
}
// The first match after the given place (direction 1) or the last one
// before it (direction -1), wrapping round. -1 when there is none.
function pickMatch(matches, monitorAt: int, workspaceAt: int, windowAt: int, direction: int): int {
if (matches.length === 0)
return -1;
if (direction > 0) {
for (let i = 0; i < matches.length; i++) {
const m = matches[i];
if (root.comparePositions(m.monitor, m.workspace, m.window, monitorAt, workspaceAt, windowAt) > 0)
return i;
}
return 0;
}
for (let i = matches.length - 1; i >= 0; i--) {
const m = matches[i];
if (root.comparePositions(m.monitor, m.workspace, m.window, monitorAt, workspaceAt, windowAt) < 0)
return i;
}
return matches.length - 1;
}
// Move the view to a workspace, and to one of its windows unless
// windowAt is -1, which closes the loop.
function showPosition(monitorAt: int, workspaceAt: int, windowAt: int): void {
const mons = root.compositor.monitors ?? [];
if (monitorAt < 0 || monitorAt >= mons.length)
return;
const wsList = mons[monitorAt].workspaces ?? [];
if (workspaceAt < 0 || workspaceAt >= wsList.length)
return;
const ws = wsList[workspaceAt];
const forward = root.comparePositions(monitorAt, workspaceAt, windowAt, root.monitorIndex, root.workspaceIndexAt(root.monitorIndex), root.currentWindowIndex()) >= 0;
root.animate = true;
root.monitorIndex = monitorAt;
const copy = root.workspaceIndices.slice();
while (copy.length <= monitorAt)
copy.push(0);
copy[monitorAt] = workspaceAt;
root.workspaceIndices = copy;
if (windowAt < 0) {
if (root.windowsOpen)
root.collapseWindows();
return;
}
if (!root.windowsOpen) {
root.expandWindows(true);
} else if (root.loopWorkspaceId !== ws.id) {
windowLoop.holdLeaving();
root.loopWorkspaceId = ws.id;
windowLoop.switchIn(forward ? 1 : -1);
}
windowLoop.selectIndex(windowAt);
}
function restoreOrigin(): void {
const indices = Array.from(root.originIndices);
const workspaceAt = root.originMonitor < indices.length ? indices[root.originMonitor] : 0;
root.showPosition(root.originMonitor, workspaceAt, root.originWindowIndex);
root.workspaceIndices = indices;
root.canCollapse = root.originCanCollapse;
}
function enterSearch(): void {
root.originMonitor = root.monitorIndex;
root.originIndices = root.workspaceIndices.slice();
root.originWindowIndex = root.currentWindowIndex();
root.originCanCollapse = root.canCollapse;
root.matchCount = 0;
root.matchIndex = -1;
// Clear before turning on, so the cleared text does not search.
searchInput.text = "";
root.searchActive = true;
searchInput.forceActiveFocus();
}
function leaveSearch(): void {
root.searchActive = false;
searchInput.focus = false;
Qt.callLater(() => focusScope.forceActiveFocus());
}
// Called as the search text changes. Jumps to the first match after
// where the search started, or back there when nothing matches.
function updateSearch(query: string): void {
const matches = root.findMatches(query);
root.matchCount = matches.length;
const indices = Array.from(root.originIndices);
const workspaceAt = root.originMonitor < indices.length ? indices[root.originMonitor] : 0;
const index = root.pickMatch(matches, root.originMonitor, workspaceAt, root.originWindowIndex, 1);
root.matchIndex = index;
if (index < 0) {
root.restoreOrigin();
return;
}
const m = matches[index];
root.showPosition(m.monitor, m.workspace, m.window);
}
// Enter: keep the shown match and remember the text for n and N.
function acceptSearch(): void {
if (searchInput.text.length > 0)
root.searchQuery = searchInput.text;
root.leaveSearch();
}
// Escape: go back to where the search started.
function cancelSearch(): void {
root.restoreOrigin();
root.leaveSearch();
}
function jumpToMatch(direction: int): void {
const matches = root.findMatches(root.searchQuery);
const index = root.pickMatch(matches, root.monitorIndex, root.workspaceIndexAt(root.monitorIndex), root.currentWindowIndex(), direction);
root.matchCount = matches.length;
root.matchIndex = index;
if (index < 0)
return;
const m = matches[index];
root.showPosition(m.monitor, m.workspace, m.window);
}
// ── visibility handling ─────────────────────────────────────────────
onVisibleChanged: {
root.animate = false;
root.searchActive = false;
searchInput.focus = false;
root.windowsOpen = false;
if (!root.visible) {
root.seedPending = false;
return;
}
root.seedPending = true;
root.compositor.refresh();
Qt.callLater(() => focusScope.forceActiveFocus());
}
Connections {
target: root.compositor
function onRefreshed(): void {
if (!root.visible || !root.seedPending)
return;
if (root.compositor.refreshQueued)
return;
root.seedPending = false;
root.seedSelection();
if (root.openWindowsOnOpen)
root.expandWindows(false);
if (root.searchOnOpen)
root.enterSearch();
}
}
// ── backdrop ────────────────────────────────────────────────────────
Rectangle {
id: backdrop
anchors.fill: parent
color: root.theme.backdrop
MouseArea {
anchors.fill: parent
onClicked: {
if (root.searchActive)
root.cancelSearch();
else if (root.windowsOpen)
root.leaveWindows();
else
root.requestBack();
}
}
}
// ── search bar (shown while searching) ──────────────────────────────
Item {
id: searchBar
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: root.theme.searchBarTop
width: root.theme.barWidth
height: root.theme.barHeight
z: 10
opacity: root.searchActive ? 1 : 0
// Shown at once when opened, so the field can take focus.
visible: root.searchActive || searchBar.opacity > 0
Behavior on opacity {
NumberAnimation {
duration: root.theme.hintFadeDuration
}
}
Glass {
anchors.fill: parent
theme: root.theme
radius: root.theme.cornerRadius
tint: root.theme.barBg
selected: false
shadow: true
}
Item {
anchors.fill: parent
Row {
anchors.fill: parent
anchors.margins: root.theme.barPadding
spacing: root.theme.barSpacing
Image {
width: root.theme.logoSize
height: root.theme.logoSize
anchors.verticalCenter: parent.verticalCenter
source: root.compositor.logoSource
visible: root.compositor.logoSource !== ""
sourceSize.width: root.theme.logoSize * 2
sourceSize.height: root.theme.logoSize * 2
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: true
}
Text {
id: prompt
anchors.verticalCenter: parent.verticalCenter
text: "/"
color: root.theme.labelColor
font.pixelSize: root.theme.fontSize
font.bold: true
}
Item {
id: field
anchors.verticalCenter: parent.verticalCenter
width: parent.width - prompt.width - matchText.width - root.theme.logoSize - root.theme.barSpacing * 3
height: root.theme.barHeight - root.theme.barPadding * 2
Glass {
anchors.fill: parent
theme: root.theme
radius: root.theme.cornerRadius / 2
tint: root.theme.fieldBg
selected: searchInput.activeFocus
shadow: false
}
TextInput {
id: searchInput
anchors.fill: parent
anchors.leftMargin: root.theme.fieldPadding
anchors.rightMargin: root.theme.fieldPadding
verticalAlignment: TextInput.AlignVCenter
color: root.theme.textColor
font.pixelSize: root.theme.fontSize
selectByMouse: true
selectionColor: root.theme.accentColor
selectedTextColor: root.theme.accentText
clip: true
focus: false
onTextChanged: {
if (root.searchActive)
root.updateSearch(searchInput.text);
}
onAccepted: root.acceptSearch()
Keys.onEscapePressed: event => {
root.cancelSearch();
event.accepted = true;
}
// Backspace on an empty search closes it, like in vim.
Keys.onPressed: event => {
if (event.key === Qt.Key_Backspace && searchInput.text.length === 0) {
root.cancelSearch();
event.accepted = true;
return;
}
event.accepted = false;
}
}
}
// "2/5" while there are matches, "no match" when none.
Text {
id: matchText
anchors.verticalCenter: parent.verticalCenter
color: root.matchCount > 0 ? root.theme.labelColor : root.theme.warnColor
font.pixelSize: root.theme.fontSize
text: {
if (searchInput.text.length === 0)
return "";
if (root.matchCount === 0)
return "no match";
return (root.matchIndex + 1) + "/" + root.matchCount;
}
}
}
}
}
// Where the search bar opens, while it is closed.
KeyHint {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: root.theme.searchBarTop
z: 10
theme: root.theme
hint: root.config.searchHint
shown: root.config.showHints && !root.searchActive
}
// ── carousel ────────────────────────────────────────────────────────
FocusScope {
id: focusScope
anchors.fill: parent
focus: root.visible
Keys.onPressed: event => {
// / opens the search bar, n and N go to the next or previous match.
if (root.isSearchKey(event)) {
root.enterSearch();
event.accepted = true;
return;
}
const direction = root.nextMatchDirection(event);
if (direction !== 0) {
root.jumpToMatch(direction);
event.accepted = true;
return;
}
// The windows key opens or folds the window loop on the selected workspace.
if (root.isWindowsKey(event)) {
if (root.windowsOpen)
root.collapseWindows();
else
root.expandWindows(true);
event.accepted = true;
return;
}
if (root.windowsOpen) {
switch (event.key) {
case Qt.Key_Left:
case Qt.Key_Backtab:
windowLoop.step(-1);
break;
case Qt.Key_Right:
case Qt.Key_Tab:
windowLoop.step(1);
break;
case Qt.Key_Return:
case Qt.Key_Enter:
windowLoop.activateSelected();
break;
case Qt.Key_Escape:
root.leaveWindows();
break;
case Qt.Key_Up:
root.switchWindows(-1);
break;
case Qt.Key_Down:
root.switchWindows(1);
break;
default:
return;
}
event.accepted = true;
return;
}
switch (event.key) {
case Qt.Key_Up:
root.moveWorkspace(-1);
break;
case Qt.Key_Down:
root.moveWorkspace(1);
break;
case Qt.Key_Left:
root.moveMonitor(-1);
break;
case Qt.Key_Right:
root.moveMonitor(1);
break;
case Qt.Key_Return:
case Qt.Key_Enter:
root.activateSelection();
break;
case Qt.Key_Escape:
root.requestBack();
break;
default:
return;
}
event.accepted = true;
}
WheelHandler {
id: swipeHandler
target: focusScope
property real accX: 0
property real accY: 0
// Vertical swipes move between workspaces, both in the carousel
// and in the loop. Horizontal ones move between monitors, or
// turn the loop while it is open.
function stepVertical(delta: int): void {
if (root.windowsOpen)
root.switchWindows(delta);
else
root.moveWorkspace(delta);
swipeHandler.accY = 0;
}
function stepHorizontal(delta: int): void {
if (root.windowsOpen)
windowLoop.step(delta);
else
root.moveMonitor(delta);
swipeHandler.accX = 0;
}
onWheel: event => {
const px = event.pixelDelta;
const ang = event.angleDelta;
const dx = px.x !== 0 ? px.x : ang.x;
const dy = px.y !== 0 ? px.y : ang.y;
if (Math.abs(dy) >= Math.abs(dx)) {
swipeHandler.accY += dy;
if (swipeHandler.accY <= -root.theme.swipeThreshold)
swipeHandler.stepVertical(1);
else if (swipeHandler.accY >= root.theme.swipeThreshold)
swipeHandler.stepVertical(-1);
} else {
swipeHandler.accX += dx;
if (swipeHandler.accX <= -root.theme.swipeThreshold)
swipeHandler.stepHorizontal(1);
else if (swipeHandler.accX >= root.theme.swipeThreshold)
swipeHandler.stepHorizontal(-1);
}
}
}
// ── globe ───────────────────────────────────────────────────────
// 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
// 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;
}
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
Behavior on lonTurn {
enabled: root.animate
NumberAnimation {
duration: root.theme.carouselDuration
easing.type: Easing.OutCubic
}
}
Behavior on x {
enabled: root.animate
NumberAnimation {
duration: root.theme.loopExpandDuration
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.loopExpandDuration
}
}
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
}
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, over its column.
Item {
id: monitorName
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"
}
}
Repeater {
model: column.workspaces
GlobeCard {
id: card
required property var modelData
required property int index
anchors.fill: parent
z: card.facing
theme: root.theme
// Place up or down the globe, in radians. Down is positive.
lat: (card.index - column.latTurn) * root.theme.globeLatStep
lon: column.lon
fade: (1 - Math.min(Math.abs(card.index - column.latTurn) * root.theme.carouselFadeStep, root.theme.carouselMaxFade)) * column.fade
workspaceName: modelData.name
workspaceIndex: modelData.idx
selected: column.isCurrentColumn && index === column.selectedWs
current: modelData.focused === true
windows: modelData.windows ?? []
enabled: !root.windowsOpen
onActivated: root.activateAt(column.columnIndex, index)
}
}
}
}
// 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
}
}
// Grows out of the selected card and moves right, beside the globe.
WindowLoop {
id: windowLoop
anchors.fill: parent
z: 2
compositor: root.compositor
theme: root.theme
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)
}
}
}