1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-14 16:22:46 -04:00

workspaces/niri: fix scrolling to use ID instead of Index

fixes #2212
This commit is contained in:
bbedward
2026-05-14 10:02:34 -04:00
parent a33c7e0250
commit 79fe956058
3 changed files with 14 additions and 14 deletions
@@ -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();
@@ -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}`);
+4 -4
View File
@@ -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
}
}
}