From 6067787763e663bd308e5b724a5efafc2c54a3d1 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Thu, 3 Oct 2024 01:10:42 +0300 Subject: Remove startup notify variables only for shell This will prevent issues when `setup_env` from `alacritty_terminal` will remove potentially useful variables for users of the library. Fixes #8202. --- CHANGELOG.md | 1 + alacritty_terminal/src/tty/mod.rs | 4 ---- alacritty_terminal/src/tty/unix.rs | 4 ++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc858911..659a098e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - Cursor color requests with default cursor colors - Fullwidth semantic escape characters - Windows app icon now displays properly in old alt+tab on Windows +- Alacritty not being properly activated with startup notify ## 0.13.2 diff --git a/alacritty_terminal/src/tty/mod.rs b/alacritty_terminal/src/tty/mod.rs index 2bcc5da9..eed2a76d 100644 --- a/alacritty_terminal/src/tty/mod.rs +++ b/alacritty_terminal/src/tty/mod.rs @@ -98,10 +98,6 @@ pub fn setup_env() { // Advertise 24-bit color support. env::set_var("COLORTERM", "truecolor"); - - // Prevent child processes from inheriting startup notification env. - env::remove_var("DESKTOP_STARTUP_ID"); - env::remove_var("XDG_ACTIVATION_TOKEN"); } /// Check if a terminfo entry exists on the system. diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs index 8084a753..6565f20b 100644 --- a/alacritty_terminal/src/tty/unix.rs +++ b/alacritty_terminal/src/tty/unix.rs @@ -227,6 +227,10 @@ pub fn from_fd(config: &Options, window_id: u64, master: OwnedFd, slave: OwnedFd builder.env(key, value); } + // Prevent child processes from inheriting linux-specific startup notification env. + builder.env_remove("XDG_ACTIVATION_TOKEN"); + builder.env_remove("DESKTOP_STARTUP_ID"); + unsafe { builder.pre_exec(move || { // Create a new process group. -- cgit