Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"vite": "^8.2.1"
},
"dependencies": {
"@zenbu-labs/pixel": "0.0.23",
"@zenbu-labs/pixel": "0.2.10",
"react": "^18.3.1"
},
"allowScripts": {
"@zenbu-labs/pixel@0.0.23": true
"@zenbu-labs/pixel@0.2.10": true
}
}
19 changes: 17 additions & 2 deletions src/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import net from "node:net";
import os from "node:os";
import path from "node:path";

import { callerTty, canSplit, cannotOpenPanes, checkTerminal, detect, findOwner, unsupportedGraphicsMessage } from "@zenbu-labs/pixel/terminal";
import { UNSUPPORTED_ENV, callerTty, canSplit, cannotOpenPanes, checkTerminal, detect, findOwner } from "@zenbu-labs/pixel/terminal";
import type { Direction } from "@zenbu-labs/pixel/terminal";

import { ask, connectDaemon, linesOf, sleep } from "./app/control";
Expand Down Expand Up @@ -56,6 +56,20 @@ function hosted(tty: string): boolean {
return Boolean(process.env.PIXEL_EMBED) || findOwner(tty) !== null;
}

function unsupportedGraphicsMessage(color: boolean): string {
const sgr = (code: string, text: string) => (color ? `\x1b[${code}m${text}\x1b[0m` : text);
return [
"",
` ${sgr("1", "Unsupported terminal: this terminal cannot display graphics")}`,
"",
` ${sgr("2", "We recommend Ghostty:")}`,
` ${sgr("4", "https://ghostty.org/download")}`,
"",
` ${sgr("2", "Note: any terminal that supports the kitty graphics protocol is supported")}`,
"",
].join("\n");
}

function windowTty(): string | null {
return process.env.PIXEL_TTY ?? callerTty().path;
}
Expand Down Expand Up @@ -129,7 +143,8 @@ function attachWindow(url: string, options: LaunchOptions): { exited: Promise<nu
cmd: "open",
tty,
url,
env: process.env,
// The graphics check already ran above; pixel's root would exit the whole daemon on this flag.
env: Object.fromEntries(Object.entries(process.env).filter(([key]) => key !== UNSUPPORTED_ENV)),
proxy: options.proxy,
partition: options.partition,
timingFile: `${CSS_FILE}.timing.json`,
Expand Down
Loading