add!: add new workspace manipulation commands
This commit is contained in:
parent
d202ca5cc5
commit
8f085b5c36
1 changed files with 11 additions and 18 deletions
|
|
@ -34,26 +34,19 @@ Scope {
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomShortcut {
|
CustomShortcut {
|
||||||
name: "newWorkspace"
|
name: "newworkspace"
|
||||||
description: "Go to a new workspace"
|
description: "Go to a new workspace"
|
||||||
onPressed: root.newWorkspace();
|
onPressed: root.newWorkspace();
|
||||||
}
|
}
|
||||||
Timer {
|
|
||||||
id: newWorkspaceTimer
|
function moveToNewWorkspace(): void {
|
||||||
running: false
|
Hypr.dispatch(`hy3:movetoworkspace ${nextWorkspace()}`);
|
||||||
interval: Hypr.arbitraryRaceConditionDelay
|
}
|
||||||
onTriggered: {
|
|
||||||
const uiState = States.getForActive();
|
CustomShortcut {
|
||||||
const workspace = Hypr.focusedWorkspace;
|
name: "movetonewworkspace"
|
||||||
// Add workspace if not already added during delay
|
description: "Move the current window to a new workspace"
|
||||||
let found = false;
|
onPressed: root.moveToNewWorkspace();
|
||||||
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 goToWorkspace(index: int): void {
|
function goToWorkspace(index: int): void {
|
||||||
|
|
@ -87,7 +80,7 @@ Scope {
|
||||||
} else {
|
} else {
|
||||||
id = uiState.workspaces.get(index).workspace.id;
|
id = uiState.workspaces.get(index).workspace.id;
|
||||||
}
|
}
|
||||||
Hypr.dispatch(`movetoworkspace ${id}`);
|
Hypr.dispatch(`hy3:movetoworkspace ${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
Instantiator {
|
Instantiator {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue