add!: add new workspace manipulation commands

This commit is contained in:
Kiana Sheibani 2025-10-07 20:30:56 -04:00
parent d202ca5cc5
commit 8f085b5c36
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -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 {