Skip to content

Commit ef955c6

Browse files
Grim-Raidclaude
andcommitted
fix(kicad): Open in KiCad works on macOS
The Mac package has no bin/ launcher and macOS has no setsid, so the button always failed there. On Darwin, open the project in the package's KiCad.app (pcbnew.app or eeschema.app for a lone board or schematic) with open -a; Linux is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent c1041b4 commit ef955c6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/server/kicad.bend‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,16 @@ def KiCad.open.k(fork: Bool, +cli: String, +fs: Files) -> IO(String):
552552
case True{} Files{+pro, +pcb, +sch, _}:
553553
do IO<String>:
554554
r : P.Ran <- P.Proc.run("sh", ["-c",
555-
"r=\"$1\"; if [ -n \"$2\" ]; then set -- kicad \"$2\"; elif [ -n \"$3\" ]; then set -- pcbnew \"$3\"; elif [ -n \"$4\" ]; then set -- eeschema \"$4\"; else echo \"no KiCad project here\"; exit 1; fi; [ -x \"$r/bin/$1\" ] || { echo \"Backplane KiCad has no $1\"; exit 1; }; setsid -f \"$r/bin/$1\" \"$2\" </dev/null >/dev/null 2>&1",
555+
"r=\"$1\"; if [ -n \"$2\" ]; then set -- kicad \"$2\"; elif [ -n \"$3\" ]; then set -- pcbnew \"$3\"; elif [ -n \"$4\" ]; then set -- eeschema \"$4\"; else echo \"no KiCad project here\"; exit 1; fi; if [ \"$(uname)\" = Darwin ]; then a=\"$r/KiCad.app\"; [ \"$1\" = kicad ] || a=\"$a/Contents/Applications/$1.app\"; [ -d \"$a\" ] || { echo \"Backplane KiCad has no $1\"; exit 1; }; exec open -a \"$a\" \"$2\"; fi; [ -x \"$r/bin/$1\" ] || { echo \"Backplane KiCad has no $1\"; exit 1; }; setsid -f \"$r/bin/$1\" \"$2\" </dev/null >/dev/null 2>&1",
556556
"sh", Rt.root(cli), pro, pcb, sch], "/")
557557
return KiCad.open.said(r)
558558
case False{} _:
559559
IO.pure(String, "Install Backplane KiCad (Settings) to open projects in it")
560560

561561
# open a project's .kicad_pro in the bundled KiCad (its board or schematic
562562
# editor when there is no .kicad_pro), detached; answers "" or an error.
563+
# macOS has no bin/ launcher: the editors are apps in KiCad.app, opened
564+
# with open -a.
563565
# Only the Backplane fork: its launcher brings the official libraries
564566
def KiCad.open(rt: Rt, +fs: Files) -> IO(String):
565567
match rt:

0 commit comments

Comments
 (0)