fix: proper focus changes

This commit is contained in:
2026-04-10 10:18:15 -04:00
Unverified
parent 93a340693d
commit 19f522fa8e
2 changed files with 31 additions and 11 deletions

View File

@@ -4,7 +4,21 @@ import { showFailureToast } from "@raycast/utils";
export default async function Command() {
try {
const { stderr } = await runYabaiCommand(`-m space --destroy`);
const { stdout: spaceOutput } = await runYabaiCommand(`-m query --spaces --space mouse`);
const currentSpace = JSON.parse(spaceOutput);
let moveFocusIndex = currentSpace.index - 1;
if (currentSpace.index === 0) {
moveFocusIndex = currentSpace.index + 1;
}
const { stderr: stderr3 } = await runYabaiCommand(`-m space --focus ${moveFocusIndex}`);
if (stderr3) {
console.log(stderr3);
throw new Error(stderr3);
}
const { stderr } = await runYabaiCommand(`-m space --destroy ${currentSpace.index}`);
if (stderr) {
throw new Error(stderr);