MCPcopy
hub / github.com/wavetermdev/waveterm / getDefaultNewBlockDef

Function getDefaultNewBlockDef

frontend/app/store/keymodel.ts:344–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

342}
343
344function getDefaultNewBlockDef(): BlockDef {
345 const adnbAtom = getSettingsKeyAtom("app:defaultnewblock");
346 const adnb = globalStore.get(adnbAtom) ?? "term";
347 if (adnb == "launcher") {
348 return {
349 meta: {
350 view: "launcher",
351 },
352 };
353 }
354 // "term", blank, anything else, fall back to terminal
355 const termBlockDef: BlockDef = {
356 meta: {
357 view: "term",
358 controller: "shell",
359 },
360 };
361 const layoutModel = getLayoutModelForStaticTab();
362 const focusedNode = globalStore.get(layoutModel.focusedNode);
363 if (focusedNode != null) {
364 const blockAtom = WOS.getWaveObjectAtom<Block>(WOS.makeORef("block", focusedNode.data?.blockId));
365 const blockData = globalStore.get(blockAtom);
366 if (blockData?.meta?.view == "term") {
367 if (blockData?.meta?.["cmd:cwd"] != null) {
368 termBlockDef.meta["cmd:cwd"] = blockData.meta["cmd:cwd"];
369 }
370 }
371 if (blockData?.meta?.connection != null) {
372 termBlockDef.meta.connection = blockData.meta.connection;
373 }
374 }
375 return termBlockDef;
376}
377
378async function handleCmdN() {
379 const blockDef = getDefaultNewBlockDef();

Callers 3

handleCmdNFunction · 0.85
handleSplitHorizontalFunction · 0.85
handleSplitVerticalFunction · 0.85

Calls 3

getSettingsKeyAtomFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected