From 79fe95605886eacbc6f70feb1d53f6c18d669032 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 14 May 2026 10:02:34 -0400 Subject: [PATCH] workspaces/niri: fix scrolling to use ID instead of Index fixes #2212 --- quickshell/Modules/DankBar/DankBarContent.qml | 4 ++-- .../DankBar/Widgets/WorkspaceSwitcher.qml | 16 ++++++++-------- quickshell/Services/NiriService.qml | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/quickshell/Modules/DankBar/DankBarContent.qml b/quickshell/Modules/DankBar/DankBarContent.qml index 6a9a46a2..1602e039 100644 --- a/quickshell/Modules/DankBar/DankBarContent.qml +++ b/quickshell/Modules/DankBar/DankBarContent.qml @@ -267,10 +267,10 @@ Item { if (nextIndex !== validIndex) { const nextWorkspace = realWorkspaces[nextIndex]; - if (!nextWorkspace || nextWorkspace.idx === undefined) { + if (!nextWorkspace || nextWorkspace.id === undefined) { return; } - NiriService.switchToWorkspace(nextWorkspace.idx); + NiriService.switchToWorkspace(nextWorkspace.id); } } else if (CompositorService.isHyprland) { const currentWs = getCurrentWorkspace(); diff --git a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml index 3721e350..490b3c34 100644 --- a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml +++ b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml @@ -590,8 +590,8 @@ Item { switch (CompositorService.compositor) { case "niri": - if (data.idx !== undefined) - NiriService.switchToWorkspace(data.idx); + if (data.id !== undefined) + NiriService.switchToWorkspace(data.id); break; case "hyprland": if (data.id) @@ -665,10 +665,10 @@ Item { } const nextWorkspace = realWorkspaces[nextIndex]; - if (!nextWorkspace || nextWorkspace.idx === undefined) { + if (!nextWorkspace || nextWorkspace.id === undefined) { return; } - NiriService.switchToWorkspace(nextWorkspace.idx); + NiriService.switchToWorkspace(nextWorkspace.id); } else if (CompositorService.isHyprland) { const realWorkspaces = getRealWorkspaces(); if (realWorkspaces.length < 2) { @@ -1296,9 +1296,9 @@ Item { const sourceWs = root.workspaceList[root.dragSourceIndex]; const targetWs = root.workspaceList[root.dragTargetIndex]; - if (sourceWs && targetWs && sourceWs.idx !== undefined && targetWs.idx !== undefined) { + if (sourceWs && targetWs && sourceWs.id !== undefined && targetWs.idx !== undefined) { root.suppressShiftAnimation = true; - NiriService.moveWorkspaceToIndex(sourceWs.idx, targetWs.idx); + NiriService.moveWorkspaceToIndex(sourceWs.id, targetWs.idx); Qt.callLater(() => root.suppressShiftAnimation = false); } } @@ -1316,8 +1316,8 @@ Item { if (root.useExtWorkspace && (modelData?.id || modelData?.name)) { ExtWorkspaceService.activateWorkspace(modelData.id || modelData.name, modelData.groupID || ""); } else if (CompositorService.isNiri) { - if (modelData && modelData.idx !== undefined) { - NiriService.switchToWorkspace(modelData.idx); + if (modelData && modelData.id !== undefined) { + NiriService.switchToWorkspace(modelData.id); } } else if (CompositorService.isHyprland && modelData?.id) { Hyprland.dispatch(`workspace ${modelData.id}`); diff --git a/quickshell/Services/NiriService.qml b/quickshell/Services/NiriService.qml index b82064c5..c717ec86 100644 --- a/quickshell/Services/NiriService.qml +++ b/quickshell/Services/NiriService.qml @@ -734,12 +734,12 @@ Singleton { }); } - function switchToWorkspace(workspaceIndex) { + function switchToWorkspace(workspaceId) { return send({ "Action": { "FocusWorkspace": { "reference": { - "Index": workspaceIndex + "Id": workspaceId } } } @@ -1449,13 +1449,13 @@ Singleton { }); } - function moveWorkspaceToIndex(workspaceIdx, targetIndex) { + function moveWorkspaceToIndex(workspaceId, targetIndex) { return send({ "Action": { "MoveWorkspaceToIndex": { "index": targetIndex, "reference": { - "Index": workspaceIdx + "Id": workspaceId } } }