mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-08 22:33:20 +00:00
feat: add SSH integration wrapper for shell integration
- Implements opt-in SSH wrapper following sudo pattern - Supports term_only, basic, and full integration levels - Fixes xterm-ghostty TERM compatibility on remote systems - Propagates shell integration environment variables - Allows for automatic installation of terminfo if desired - Addresses GitHub discussions #5892 and #4156
This commit is contained in:
@@ -45,6 +45,7 @@ pub fn setup(
|
||||
env: *EnvMap,
|
||||
force_shell: ?Shell,
|
||||
features: config.ShellIntegrationFeatures,
|
||||
ssh_integration: config.SSHIntegration,
|
||||
) !?ShellIntegration {
|
||||
const exe = if (force_shell) |shell| switch (shell) {
|
||||
.bash => "bash",
|
||||
@@ -70,8 +71,9 @@ pub fn setup(
|
||||
exe,
|
||||
);
|
||||
|
||||
// Setup our feature env vars
|
||||
// Setup our feature env vars and SSH integration
|
||||
try setupFeatures(env, features);
|
||||
try setupSSHIntegration(env, ssh_integration);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -159,6 +161,7 @@ test "force shell" {
|
||||
&env,
|
||||
shell,
|
||||
.{},
|
||||
.off,
|
||||
);
|
||||
try testing.expectEqual(shell, result.?.shell);
|
||||
}
|
||||
@@ -224,6 +227,15 @@ test "setup features" {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn setupSSHIntegration(
|
||||
env: *EnvMap,
|
||||
ssh_integration: config.SSHIntegration,
|
||||
) !void {
|
||||
if (ssh_integration != .off) {
|
||||
try env.put("GHOSTTY_SSH_INTEGRATION", @tagName(ssh_integration));
|
||||
}
|
||||
}
|
||||
|
||||
/// Setup the bash automatic shell integration. This works by
|
||||
/// starting bash in POSIX mode and using the ENV environment
|
||||
/// variable to load our bash integration script. This prevents
|
||||
|
||||
Reference in New Issue
Block a user