Fix +new-window -e <command> inheriting forced shell integration from the running GTK application.

Arguments after -e are now marked as an explicit command that requires shell detection. That marker is propagated with the existing command override to the new surface for both the current +new-window and +new-tab GTK paths. When the override is applied, forced shell integration becomes detect; an explicit none remains disabled.

This is scoped to the GTK -e path. It does not change the generic forced shell-integration behavior, so configured integration continues to support shell executables with non-standard names.

Fixes #12378.
This commit is contained in:
PRIHLOP
2026-08-13 01:22:15 +02:00
parent fad7f854e8
commit 3650bef4ec
7 changed files with 118 additions and 11 deletions

View File

@@ -120,10 +120,11 @@ pub const Options = struct {
/// and `--surface-id` flag) will be sent to the remote Ghostty instance and
/// will be parsed as command line flags. These flags will override certain
/// settings when creating the first surface in the new tab. Currently, only
/// `--working-directory`, `--command`, and `--title` are supported. `-e` will
/// also work as an alias for `--command`, except that if `-e` is found on the
/// command line all following arguments will become part of the command and no
/// more arguments will be parsed for configuration settings.
/// `--working-directory`, `--command`, `--shell-integration=<mode>`, and
/// `--title` are supported. `-e` will also work as an alias for `--command`, except that if
/// `-e` is found on the command line all following arguments will become part
/// of the command and no more arguments will be parsed for configuration
/// settings.
///
/// If `--working-directory` is found on the command line and is a relative
/// path (i.e. doesn't start with `/`) it will be resolved to an absolute
@@ -164,6 +165,10 @@ pub const Options = struct {
///
/// * `--command`: The command to be executed in the first surface of the new tab.
///
/// * `--shell-integration=<mode>`: Whether to enable shell integration and
/// which shell to use. See the main configuration documentation for
/// supported values.
///
/// * `--working-directory=<directory>`: The working directory to pass to Ghostty.
///
/// * `--title`: A title that will override the title of the first surface in

View File

@@ -119,10 +119,11 @@ pub const Options = struct {
/// `--class` flag) will be sent to the remote Ghostty instance and will be
/// parsed as command line flags. These flags will override certain settings
/// when creating the first surface in the new window. Currently, only
/// `--working-directory`, `--command`, and `--title` are supported. `-e` will
/// also work as an alias for `--command`, except that if `-e` is found on the
/// command line all following arguments will become part of the command and no
/// more arguments will be parsed for configuration settings.
/// `--working-directory`, `--command`, `--shell-integration=<mode>`, and
/// `--title` are supported. `-e` will also work as an alias for `--command`, except that if
/// `-e` is found on the command line all following arguments will become part
/// of the command and no more arguments will be parsed for configuration
/// settings.
///
/// If `--working-directory` is found on the command line and is a relative
/// path (i.e. doesn't start with `/`) it will be resolved to an absolute path
@@ -158,6 +159,10 @@ pub const Options = struct {
///
/// * `--command`: The command to be executed in the first surface of the new window.
///
/// * `--shell-integration=<mode>`: Whether to enable shell integration and
/// which shell to use. See the main configuration documentation for
/// supported values.
///
/// * `--working-directory=<directory>`: The working directory to pass to Ghostty.
///
/// * `--title`: A title that will override the title of the first surface in