Skip to content

feat: default the T3 home to XDG_DATA_HOME on Linux - #2

Merged
PixelHabits merged 1 commit into
devfrom
xdg-home
Sep 15, 2026
Merged

PixelHabits merged 1 commit into
devfrom
xdg-home

Conversation

@PixelHabits

Copy link
Copy Markdown
Owner

Change

Fork-only. Stacked on #1, so the diff shows both commits until that one merges.

When T3CODE_HOME and the base-dir flags are unset, Linux resolves the T3 home to ${XDG_DATA_HOME:-~/.local/share}/t3code instead of ~/.t3. Precedence:

  1. T3CODE_HOME or --base-dir / --home-dir
  2. the XDG directory, if it exists
  3. an existing ~/.t3
  4. the XDG directory

macOS and Windows keep ~/.t3. Nothing is moved automatically.

Where

  • packages/shared/src/defaultT3Home.ts: one pure resolver plus a host wrapper that reads platform and env through HostProcessPlatform / HostProcessEnvironment.
  • Server resolveBaseDir, desktop resolveDesktopBaseDir and early Electron startup, the two dev database scripts.
  • Remote SSH scripts apply the same default before honoring T3CODE_HOME.
  • Session scanner also skips t3code/worktrees.
  • Docs that stated the old default.

Not covered

~/.t3/device in the mobile device hub script and the WSL runtime paths.

Verification

  • 14 test files, 168 tests passed (shared, desktop, server, ssh, scanner)
  • lint clean on changed files, typecheck clean for @t3tools/shared, @t3tools/desktop, t3, @t3tools/ssh

When T3CODE_HOME and the base-dir flags are unset, Linux now resolves the
T3 home to ${XDG_DATA_HOME:-~/.local/share}/t3code instead of ~/.t3.
An existing ~/.t3 keeps winning when the XDG directory does not exist,
so current installs are not moved. macOS and Windows keep ~/.t3.

One pure resolver in @t3tools/shared/defaultT3Home feeds the server
resolveBaseDir, the desktop resolveDesktopBaseDir and early startup, and
the two dev database scripts. The remote SSH scripts apply the same
default before honoring T3CODE_HOME. The session scanner also skips
t3code/worktrees. Docs that stated the old default are updated.
@PixelHabits
PixelHabits merged this pull request into dev Sep 15, 2026
@PixelHabits
PixelHabits deleted the xdg-home branch September 15, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant