Handle init failure surfacing and empty XDG_CONFIG_HOME

- Attach a rejection handler to the terminal WASM init so a load
  failure logs, shows a message in the viewport, and clears on retry
  instead of leaving a blank pane and an unhandled rejection
- Treat an empty XDG_CONFIG_HOME as unset per the XDG spec instead of
  resolving the Ghostty config relative to the server cwd
This commit is contained in:
Pixel Perfect authored and Julius Marminge committed 2026-07-20 18:05:01 +02:00
1 parent 7266fafbf6
commit c1caaa3520
2 files changed
+20 -5

No files matched your search

+6 -1
View File
@@ -187,7 +187,12 @@ export const loadGhosttyTerminalStyle: Effect.Effect<
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const home = NodeOS.homedir();
const xdgConfigHome = process.env["XDG_CONFIG_HOME"] ?? path.join(home, ".config");
// Per the XDG spec an empty XDG_CONFIG_HOME must be treated as unset.
const xdgConfigHomeEnv = process.env["XDG_CONFIG_HOME"];
const xdgConfigHome =
xdgConfigHomeEnv !== undefined && xdgConfigHomeEnv.length > 0
? xdgConfigHomeEnv
: path.join(home, ".config");
const readFirstExisting = (candidates: ReadonlyArray<string>) =>
Effect.gen(function* () {