From 3423cfdc7156939321f6ab5ddc3cb3874a94d787 Mon Sep 17 00:00:00 2001 From: Yappaholic Date: Tue, 25 Feb 2025 23:17:00 +0300 Subject: [PATCH] Fix elvish sudo integration and update documentation --- src/shell-integration/README.md | 14 +++++++++++++- .../elvish/lib/ghostty-integration.elv | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/shell-integration/README.md b/src/shell-integration/README.md index 3d5159c71..1fd11091d 100644 --- a/src/shell-integration/README.md +++ b/src/shell-integration/README.md @@ -47,7 +47,19 @@ made available for use as modules by way of `use `. Ghostty launches Elvish, passing the environment with `XDG_DATA_DIRS`prepended with `$GHOSTTY_RESOURCES_DIR/src/shell-integration`. It contains `./elvish/lib/ghostty-integration.elv`. The user can then import it -by `use ghostty-integration`, which will run the integration routines. +by `use ghostty-integration` every time after shell startup or +autostart integration in `$XDG_CONFIG_HOME/elvish/rc.elv`, +which will run the integration routines. + +If you decide to autostart `ghostty-integration` with `rc.elv`, you should +detect whether the terminal is Ghostty or not. To do this, add this to the end +of your `rc.elv` file: + +```elvish +if (eq $E:TERM "xterm-ghostty") { + use ghostty-integration +} +``` The [Elvish](https://elv.sh) shell integration is supported by the community and is not officially supported by Ghostty. We distribute diff --git a/src/shell-integration/elvish/lib/ghostty-integration.elv b/src/shell-integration/elvish/lib/ghostty-integration.elv index af9b3ed7e..08fe42f3f 100644 --- a/src/shell-integration/elvish/lib/ghostty-integration.elv +++ b/src/shell-integration/elvish/lib/ghostty-integration.elv @@ -92,7 +92,7 @@ } if (not $sudoedit) { set args = [ TERMINFO=$E:TERMINFO $@args ] } - command sudo $@args + (external sudo) $@args } defer {