diff --git a/modules/Commands.qml b/modules/Commands.qml index 7445ca6..6d2f02a 100644 --- a/modules/Commands.qml +++ b/modules/Commands.qml @@ -34,26 +34,19 @@ Scope { } CustomShortcut { - name: "newWorkspace" + name: "newworkspace" description: "Go to a new workspace" onPressed: root.newWorkspace(); } - Timer { - id: newWorkspaceTimer - running: false - interval: Hypr.arbitraryRaceConditionDelay - onTriggered: { - const uiState = States.getForActive(); - const workspace = Hypr.focusedWorkspace; - // Add workspace if not already added during delay - let found = false; - for (let i = 0; i < uiState.workspaces.count; i++) { - if (uiState.workspaces.get(i).workspace.id === workspace.id) - found = true; - } - if (!found) - uiState.workspaces.append({"workspace": workspace}); - } + + function moveToNewWorkspace(): void { + Hypr.dispatch(`hy3:movetoworkspace ${nextWorkspace()}`); + } + + CustomShortcut { + name: "movetonewworkspace" + description: "Move the current window to a new workspace" + onPressed: root.moveToNewWorkspace(); } function goToWorkspace(index: int): void { @@ -87,7 +80,7 @@ Scope { } else { id = uiState.workspaces.get(index).workspace.id; } - Hypr.dispatch(`movetoworkspace ${id}`); + Hypr.dispatch(`hy3:movetoworkspace ${id}`); } Instantiator {