1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-15 00:32:47 -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) { if (nextIndex !== validIndex) {
const nextWorkspace = realWorkspaces[nextIndex]; const nextWorkspace = realWorkspaces[nextIndex];
if (!nextWorkspace || nextWorkspace.idx === undefined) { if (!nextWorkspace || nextWorkspace.id === undefined) {
return; return;
} }
NiriService.switchToWorkspace(nextWorkspace.idx); NiriService.switchToWorkspace(nextWorkspace.id);
} }
} else if (CompositorService.isHyprland) { } else if (CompositorService.isHyprland) {
const currentWs = getCurrentWorkspace(); const currentWs = getCurrentWorkspace();
@@ -590,8 +590,8 @@ Item {
switch (CompositorService.compositor) { switch (CompositorService.compositor) {
case "niri": case "niri":
if (data.idx !== undefined) if (data.id !== undefined)
NiriService.switchToWorkspace(data.idx); NiriService.switchToWorkspace(data.id);
break; break;
case "hyprland": case "hyprland":
if (data.id) if (data.id)
@@ -665,10 +665,10 @@ Item {
} }
const nextWorkspace = realWorkspaces[nextIndex]; const nextWorkspace = realWorkspaces[nextIndex];
if (!nextWorkspace || nextWorkspace.idx === undefined) { if (!nextWorkspace || nextWorkspace.id === undefined) {
return; return;
} }
NiriService.switchToWorkspace(nextWorkspace.idx); NiriService.switchToWorkspace(nextWorkspace.id);
} else if (CompositorService.isHyprland) { } else if (CompositorService.isHyprland) {
const realWorkspaces = getRealWorkspaces(); const realWorkspaces = getRealWorkspaces();
if (realWorkspaces.length < 2) { if (realWorkspaces.length < 2) {
@@ -1296,9 +1296,9 @@ Item {
const sourceWs = root.workspaceList[root.dragSourceIndex]; const sourceWs = root.workspaceList[root.dragSourceIndex];
const targetWs = root.workspaceList[root.dragTargetIndex]; 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; root.suppressShiftAnimation = true;
NiriService.moveWorkspaceToIndex(sourceWs.idx, targetWs.idx); NiriService.moveWorkspaceToIndex(sourceWs.id, targetWs.idx);
Qt.callLater(() => root.suppressShiftAnimation = false); Qt.callLater(() => root.suppressShiftAnimation = false);
} }
} }
@@ -1316,8 +1316,8 @@ Item {
if (root.useExtWorkspace && (modelData?.id || modelData?.name)) { if (root.useExtWorkspace && (modelData?.id || modelData?.name)) {
ExtWorkspaceService.activateWorkspace(modelData.id || modelData.name, modelData.groupID || ""); ExtWorkspaceService.activateWorkspace(modelData.id || modelData.name, modelData.groupID || "");
} else if (CompositorService.isNiri) { } else if (CompositorService.isNiri) {
if (modelData && modelData.idx !== undefined) { if (modelData && modelData.id !== undefined) {
NiriService.switchToWorkspace(modelData.idx); NiriService.switchToWorkspace(modelData.id);
} }
} else if (CompositorService.isHyprland && modelData?.id) { } else if (CompositorService.isHyprland && modelData?.id) {
Hyprland.dispatch(`workspace ${modelData.id}`); Hyprland.dispatch(`workspace ${modelData.id}`);
+4 -4
View File
@@ -734,12 +734,12 @@ Singleton {
}); });
} }
function switchToWorkspace(workspaceIndex) { function switchToWorkspace(workspaceId) {
return send({ return send({
"Action": { "Action": {
"FocusWorkspace": { "FocusWorkspace": {
"reference": { "reference": {
"Index": workspaceIndex "Id": workspaceId
} }
} }
} }
@@ -1449,13 +1449,13 @@ Singleton {
}); });
} }
function moveWorkspaceToIndex(workspaceIdx, targetIndex) { function moveWorkspaceToIndex(workspaceId, targetIndex) {
return send({ return send({
"Action": { "Action": {
"MoveWorkspaceToIndex": { "MoveWorkspaceToIndex": {
"index": targetIndex, "index": targetIndex,
"reference": { "reference": {
"Index": workspaceIdx "Id": workspaceId
} }
} }
} }