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 {
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue