From e79f4b22d809d12b5f09543872443d0fa818fee2 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sat, 4 Jan 2025 09:34:44 +0300 Subject: Pass activation token in alacritty msg create-window Fixes #8337. --- alacritty/src/display/window.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'alacritty/src/display/window.rs') diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 1c8089bc..fe40fab5 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -2,6 +2,8 @@ use winit::platform::startup_notify::{ self, EventLoopExtStartupNotify, WindowAttributesExtStartupNotify, }; +#[cfg(not(any(target_os = "macos", windows)))] +use winit::window::ActivationToken; #[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))] use winit::platform::wayland::WindowAttributesExtWayland; @@ -38,6 +40,7 @@ use winit::window::{ use alacritty_terminal::index::Point; +use crate::cli::WindowOptions; use crate::config::window::{Decorations, Identity, WindowConfig}; use crate::config::UiConfig; use crate::display::SizeInfo; @@ -124,9 +127,7 @@ impl Window { event_loop: &ActiveEventLoop, config: &UiConfig, identity: &Identity, - #[rustfmt::skip] - #[cfg(target_os = "macos")] - tabbing_id: &Option, + _options: &mut WindowOptions, #[rustfmt::skip] #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] x11_visual: Option, @@ -138,7 +139,7 @@ impl Window { #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] x11_visual, #[cfg(target_os = "macos")] - tabbing_id, + &_options.window_tabbing_id.take(), ); if let Some(position) = config.window.position { @@ -147,7 +148,12 @@ impl Window { } #[cfg(not(any(target_os = "macos", windows)))] - if let Some(token) = event_loop.read_token_from_env() { + if let Some(token) = _options + .activation_token + .take() + .map(ActivationToken::from_raw) + .or_else(|| event_loop.read_token_from_env()) + { log::debug!("Activating window with token: {token:?}"); window_attributes = window_attributes.with_activation_token(token); -- cgit