From bd2573242815ab0a892db4ac8431b18afbbfdf85 Mon Sep 17 00:00:00 2001 From: mpabi Date: Mon, 11 May 2026 23:35:30 +0200 Subject: [PATCH] Use named shell prompt for tmux containers --- rvctl.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/rvctl.py b/rvctl.py index 6c03f24..3dd67a5 100755 --- a/rvctl.py +++ b/rvctl.py @@ -3376,8 +3376,11 @@ def build_container_command( selector_slug = slug_value(selector.replace("/", "-"), "card selector") window_slug = slug_value(window_name, "tmux window name") user_name = current_user_slug() + host_uid = str(os.getuid()) + host_gid = str(os.getgid()) container_name_parts = [selector_slug, window_slug, profile, user_name] container_name = "-".join(container_name_parts) + shell_rcfile = tool_root / "configs" / "rv-shell.bashrc" env_parts = [ f"WORKSPACE_ROOT={shlex.quote(str(config.workspace_root))}", f"RV_CARDS_ROOT={shlex.quote(str(config.series_root))}", @@ -3387,6 +3390,9 @@ def build_container_command( f"RV_REPO_HOST={shlex.quote(str(card_path))}", f"RV_CARD={shlex.quote(selector)}", f"RV_INSTANCE={shlex.quote(instance)}", + f"RV_HOST_USER={shlex.quote(user_name)}", + f"RV_HOST_UID={host_uid}", + f"RV_HOST_GID={host_gid}", "RV_CODEX=0", ] compose_args = [ @@ -3405,6 +3411,16 @@ def build_container_command( "-e", f"HOME={home_dir}", "-e", + f"USER={user_name}", + "-e", + f"LOGNAME={user_name}", + "-e", + f"RV_HOST_USER={user_name}", + "-e", + f"RV_HOST_UID={host_uid}", + "-e", + f"RV_HOST_GID={host_gid}", + "-e", f"RV_REPO={card_path_text}", "-e", f"WORKSPACE_ROOT={config.workspace_root}", @@ -3422,9 +3438,12 @@ def build_container_command( "RV_CODEX=0", "-v", f"{card_path_text}:{card_path_text}", - service, - "shell", ] + shell_args = [service, "shell"] + if shell_rcfile.is_file(): + compose_args.extend(["-v", f"{shell_rcfile}:/tmp/rv-shell.bashrc:ro"]) + shell_args.extend(["--rcfile", "/tmp/rv-shell.bashrc"]) + compose_args.extend(shell_args) return " && ".join( [ f"cd {shlex.quote(str(tool_root))}",