From 2443ee6faf77d02dac3dc6af94f8b0ddb89c9c2e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 18 Jan 2024 13:42:11 -0800 Subject: [PATCH] Account for titlebar when tiling windows in zed-local --- script/zed-local | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/script/zed-local b/script/zed-local index b50a8dbb63..04679f39af 100755 --- a/script/zed-local +++ b/script/zed-local @@ -71,8 +71,9 @@ const mainDisplayResolution = if (!mainDisplayResolution) { throw new Error("Could not parse screen resolution"); } +const titleBarHeight = 24; const screenWidth = parseInt(mainDisplayResolution[1]); -let screenHeight = parseInt(mainDisplayResolution[2]); +let screenHeight = parseInt(mainDisplayResolution[2]) - titleBarHeight; if (isTop) { screenHeight = Math.floor(screenHeight / 2); @@ -114,12 +115,20 @@ if (isReleaseMode) { zedBinary = "target/release/Zed"; } -execFileSync("cargo", buildArgs, { stdio: "inherit" }); +try { + execFileSync("cargo", buildArgs, { stdio: "inherit" }); +} catch (e) { + process.exit(0); +} + setTimeout(() => { for (let i = 0; i < instanceCount; i++) { const row = Math.floor(i / columns); const column = i % columns; - const position = [column * instanceWidth, row * instanceHeight].join(","); + const position = [ + column * instanceWidth, + row * instanceHeight + titleBarHeight, + ].join(","); const size = [instanceWidth, instanceHeight].join(","); spawn(zedBinary, i == 0 ? args : [], {