René's URL Explorer Experiment


Title: here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd only · Issue #1031 · tmux-python/tmuxp · GitHub

Open Graph Title: here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd only · Issue #1031 · tmux-python/tmuxp

X Title: here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd only · Issue #1031 · tmux-python/tmuxp

Description: Parent: #1030 Approach Match teamocil's --here strategy: minimize send_keys to only the unavoidable cd command. Use tmux primitives for everything else. Changes to builder.py:678-727 1. Environment: replace send_keys("export ...") with s...

Open Graph Description: Parent: #1030 Approach Match teamocil's --here strategy: minimize send_keys to only the unavoidable cd command. Use tmux primitives for everything else. Changes to builder.py:678-727 1. Environment...

X Description: Parent: #1030 Approach Match teamocil's --here strategy: minimize send_keys to only the unavoidable cd command. Use tmux primitives for everything else. Changes to builder.py:678-727 1. Environ...

Opengraph URL: https://github.com/tmux-python/tmuxp/issues/1031

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd only","articleBody":"Parent: #1030\n\n## Approach\n\nMatch teamocil's `--here` strategy: minimize `send_keys` to only the unavoidable `cd` command. Use tmux primitives for everything else.\n\n### Changes to [`builder.py:678-727`](https://github.com/tmux-python/tmuxp/blob/886e63d37dbfeeefab1e645f168178b13ff03b7f/src/tmuxp/workspace/builder.py#L678-L727)\n\n#### 1. Environment: replace `send_keys(\"export ...\")` with `session.set_environment()`\n\ntmuxp already uses `session.set_environment()` for session-level env vars at [`builder.py:557-559`](https://github.com/tmux-python/tmuxp/blob/886e63d37dbfeeefab1e645f168178b13ff03b7f/src/tmuxp/workspace/builder.py#L557-L559). Window-level env vars set on the session are inherited by all new panes.\n\n```python\n# Before (lines 708-715): send_keys for each env var\nfor _ekey, _eval in environment.items():\n    _here_pane.send_keys(f\"export {_ekey}={shlex.quote(str(_eval))}\", enter=True)\n\n# After: use tmux session environment (inherited by panes)\nif environment:\n    for _ekey, _eval in environment.items():\n        session.set_environment(_ekey, str(_eval))\n```\n\nThis matches how teamocil handles it — teamocil [does not inject env vars at all](https://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/tmux/window.rb#L67-L95). The session environment is the tmux-native mechanism.\n\n**Caveat**: `set_environment` only affects *new* shells spawned in the session. The already-running shell in the reused pane won't see them. This is acceptable because:\n- Subsequent panes (created via `split`) will inherit them\n- The reused pane can pick them up if the user starts a new shell\n- This is the same limitation teamocil has (it doesn't set env vars at all in `--here`)\n\n#### 2. Shell replacement: replace `send_keys(window_shell)` with `respawn-pane`\n\n```python\n# Before (lines 724-727): send_keys to type shell command\n_here_pane.send_keys(window_shell, enter=True)\n\n# After: use respawn-pane to restart pane with new shell\nif window_shell:\n    _here_pane = window.active_pane\n    if _here_pane is not None:\n        _here_pane.cmd(\"respawn-pane\", \"-k\", window_shell)\n```\n\n`respawn-pane -k` kills the current process and starts a new one in the same pane. Available since tmux 1.6, well within tmuxp's 3.2+ minimum. This also picks up the session environment set above.\n\n#### 3. Directory: keep `send_keys(\"cd ...\")` (same as teamocil)\n\n```python\n# Keep as-is (lines 695-701) — matches teamocil\nactive_pane.send_keys(f\"cd {shlex.quote(start_directory)}\", enter=True)\n```\n\nteamocil uses the [same approach](https://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/tmux/window.rb#L88-L95): `send_keys cd \"/path\"` for the reused window's first pane.\n\n### Result\n\n| Category | Before | After |\n|----------|--------|-------|\n| `cd` | `send_keys` | `send_keys` (same as teamocil) |\n| Environment | `send_keys export` (N calls) | `session.set_environment()` (tmux primitive) |\n| Shell replacement | `send_keys` (types into pane) | `respawn-pane -k` (tmux primitive) |\n\n`send_keys` surface reduced from 3 categories to 1, matching teamocil exactly.\n\n### Risk assessment\n\n- **Low risk**: `session.set_environment()` is already used in the same file\n- **Low risk**: `respawn-pane` is a stable tmux command (available since 1.6)\n- **Caveat**: env vars only visible to new shells, not the existing one — acceptable trade-off\n- **Remaining**: `send_keys cd` still assumes a shell prompt (same as teamocil)\n\n### Tests to add/update\n\n- Update `test_here_mode_provisions_environment` to verify `session.show_environment()` instead of pane output\n- Add test for `window_shell` via `respawn-pane`\n- Keep existing `test_here_mode_start_directory_special_chars` (still uses `send_keys cd`)","author":{"url":"https://github.com/tony","@type":"Person","name":"tony"},"datePublished":"2026-03-29T09:32:47Z","url":"https://github.com/tmux-python/tmuxp/issues/1031"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:aea60c2c-62b8-ec89-6d4f-8f05363f8e8f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDDA2:74B5:26F1AA:363E2A:6B0088AA
html-safe-nonce3edf42c603e33c6b12e001b5e7a2ebd7ade8a2e1bf693f5dd75af690ea656270
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREEyOjc0QjU6MjZGMUFBOjM2M0UyQTo2QjAwODhBQSIsInZpc2l0b3JfaWQiOiI4MDgxOTM1ODkwNzcyOTUzMjU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3988ba75ffa9eb46d58ecccee668aadd832b6f8974fad4bbf2250afbbd04ea92
hovercard-subject-tagissue:4163550619
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tmux-python/tmuxp/1031/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5ec452544e8b1b4e6d3bc3ff7205ed3c4d800f8511564f7c6a8c557ac331051a/tmux-python/tmuxp/issues/1031
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5ec452544e8b1b4e6d3bc3ff7205ed3c4d800f8511564f7c6a8c557ac331051a/tmux-python/tmuxp/issues/1031
og:image:altParent: #1030 Approach Match teamocil's --here strategy: minimize send_keys to only the unavoidable cd command. Use tmux primitives for everything else. Changes to builder.py:678-727 1. Environment...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametony
hostnamegithub.com
expected-hostnamegithub.com
None4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61
turbo-cache-controlno-preview
go-importgithub.com/tmux-python/tmuxp git https://github.com/tmux-python/tmuxp.git
octolytics-dimension-user_id37234308
octolytics-dimension-user_logintmux-python
octolytics-dimension-repository_id12398170
octolytics-dimension-repository_nwotmux-python/tmuxp
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id12398170
octolytics-dimension-repository_network_root_nwotmux-python/tmuxp
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasedb758f8e02b8257935fb03edf81a3e76eb3abd11
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/tmux-python/tmuxp/issues/1031#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftmux-python%2Ftmuxp%2Fissues%2F1031
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftmux-python%2Ftmuxp%2Fissues%2F1031
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=tmux-python%2Ftmuxp
Reloadhttps://github.com/tmux-python/tmuxp/issues/1031
Reloadhttps://github.com/tmux-python/tmuxp/issues/1031
Reloadhttps://github.com/tmux-python/tmuxp/issues/1031
tmux-pythonhttps://github.com/tmux-python
tmuxphttps://github.com/tmux-python/tmuxp
Codehttps://github.com/tmux-python/tmuxp
Issues113 (113)https://github.com/tmux-python/tmuxp/issues
Pull requests29 (29)https://github.com/tmux-python/tmuxp/pulls
Discussionshttps://github.com/tmux-python/tmuxp/discussions
Actionshttps://github.com/tmux-python/tmuxp/actions
Security and qualityhttps://github.com/tmux-python/tmuxp/security
Insightshttps://github.com/tmux-python/tmuxp/insights
https://github.com/tmux-python/tmuxp
New issuehttps://github.com/login?return_to=https://github.com/tmux-python/tmuxp/issues/1031
New issuehttps://github.com/login?return_to=https://github.com/tmux-python/tmuxp/issues/1031
#1046https://github.com/tmux-python/tmuxp/pull/1046
#1025https://github.com/tmux-python/tmuxp/pull/1025
here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd onlyhttps://github.com/tmux-python/tmuxp/issues/1031#top
#1046https://github.com/tmux-python/tmuxp/pull/1046
#1025https://github.com/tmux-python/tmuxp/pull/1025
https://github.com/tony
tonyhttps://github.com/tony
on Mar 29, 2026https://github.com/tmux-python/tmuxp/issues/1031#issue-4163550619
#1030https://github.com/tmux-python/tmuxp/issues/1030
builder.py:678-727https://github.com/tmux-python/tmuxp/blob/886e63d37dbfeeefab1e645f168178b13ff03b7f/src/tmuxp/workspace/builder.py#L678-L727
builder.py:557-559https://github.com/tmux-python/tmuxp/blob/886e63d37dbfeeefab1e645f168178b13ff03b7f/src/tmuxp/workspace/builder.py#L557-L559
does not inject env vars at allhttps://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/tmux/window.rb#L67-L95
same approachhttps://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/tmux/window.rb#L88-L95
tonyhttps://github.com/tony
on Mar 29, 2026https://github.com/tmux-python/tmuxp/issues/1031#event-24007910885
here mode: send_keys for env vars and shell replacement diverges from teamocil and is unsafe #1030https://github.com/tmux-python/tmuxp/issues/1030
tonyhttps://github.com/tony
on Mar 29, 2026https://github.com/tmux-python/tmuxp/issues/1031#event-24007990030
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/f5f490a8262e8dbc2c18cf6fbcdd9d16d0fd0454
https://docs.github.com/articles/closing-issues-via-commit-messages
f5f490ahttps://github.com/tmux-python/tmuxp/commit/f5f490a8262e8dbc2c18cf6fbcdd9d16d0fd0454
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/5cf4bb4f16e94711b26b35d6dfa55e67af8ec088
https://docs.github.com/articles/closing-issues-via-commit-messages
5cf4bb4https://github.com/tmux-python/tmuxp/commit/5cf4bb4f16e94711b26b35d6dfa55e67af8ec088
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/dc8df508aed8d33738236db6ba04f7c727cd45fa
https://docs.github.com/articles/closing-issues-via-commit-messages
dc8df50https://github.com/tmux-python/tmuxp/commit/dc8df508aed8d33738236db6ba04f7c727cd45fa
tonyhttps://github.com/tony
on Apr 26, 2026https://github.com/tmux-python/tmuxp/issues/1031#event-24878291354
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/91618bb3cf39e46cf308a339dec9bc4defc607ef
https://docs.github.com/articles/closing-issues-via-commit-messages
91618bbhttps://github.com/tmux-python/tmuxp/commit/91618bb3cf39e46cf308a339dec9bc4defc607ef
tonyhttps://github.com/tony
on Jun 6, 2026https://github.com/tmux-python/tmuxp/issues/1031#event-26420437482
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/2889d53bfbd03e0b30ab0d14e037e29731b4c94c
https://docs.github.com/articles/closing-issues-via-commit-messages
2889d53https://github.com/tmux-python/tmuxp/commit/2889d53bfbd03e0b30ab0d14e037e29731b4c94c
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/4fc03ac3453398b54cecb8db07b2595ba93835f2
https://docs.github.com/articles/closing-issues-via-commit-messages
4fc03achttps://github.com/tmux-python/tmuxp/commit/4fc03ac3453398b54cecb8db07b2595ba93835f2
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/1da0dec6accdbd19556f31138652873ec7c09dd8
https://docs.github.com/articles/closing-issues-via-commit-messages
1da0dechttps://github.com/tmux-python/tmuxp/commit/1da0dec6accdbd19556f31138652873ec7c09dd8
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/ccd216ad564287a7fd8081f4463b8e2e537f7533
https://docs.github.com/articles/closing-issues-via-commit-messages
ccd216ahttps://github.com/tmux-python/tmuxp/commit/ccd216ad564287a7fd8081f4463b8e2e537f7533
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/49669a2b39a7c173784283c66734a1343ddf7ca1
https://docs.github.com/articles/closing-issues-via-commit-messages
49669a2https://github.com/tmux-python/tmuxp/commit/49669a2b39a7c173784283c66734a1343ddf7ca1
fix(builder[here]): Use respawn-pane and set_environment instead of s…https://github.com/tmux-python/tmuxp/commit/2c76e6e7edb081645f314db2d40927de3080e2f1
https://docs.github.com/articles/closing-issues-via-commit-messages
2c76e6ehttps://github.com/tmux-python/tmuxp/commit/2c76e6e7edb081645f314db2d40927de3080e2f1
Sign up for freehttps://github.com/signup?return_to=https://github.com/tmux-python/tmuxp/issues/1031
Sign in to commenthttps://github.com/login?return_to=https://github.com/tmux-python/tmuxp/issues/1031
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.