From 4a27852fd115bcbd4134da512c72a9c7e2fd523b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Thu, 8 Oct 2026 20:50:28 +0800 Subject: [PATCH] fix(tuios): create sessions with cwd before attaching (#418) --- home/base/tui/tuios/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/home/base/tui/tuios/default.nix b/home/base/tui/tuios/default.nix index de0328d9..34f29f5f 100644 --- a/home/base/tui/tuios/default.nix +++ b/home/base/tui/tuios/default.nix @@ -24,11 +24,18 @@ in programs.nushell.extraConfig = '' # auto start tuios if $nu.is-interactive and (not ("TUIOS_SESSION" in $env)) { + let sessions = (^tuios ls --json | from json | get name) let work_root = ($nu.home-dir | path join "work") if $env.PWD == $work_root or ($env.PWD | str starts-with $"($work_root)/") { - ^tuios attach work -c --cwd $work_root + if "work" not-in $sessions { + ^tuios new work --detach --cwd $work_root + } + ^tuios attach work } else { - ^tuios attach personal -c --cwd $nu.home-dir + if "personal" not-in $sessions { + ^tuios new personal --detach --cwd $nu.home-dir + } + ^tuios attach personal } } '';