diff --git a/CHANGELOG.md b/CHANGELOG.md index 095d5fd7..1c28ddd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Notable changes to the `alacritty_terminal` crate are documented in its ## 0.15.0-dev +### Changed + +- Always focus new windows on macOS + ### Fixed - Mouse/Vi cursor hint highlighting broken on the terminal cursor line diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index d358a7c5..4211da5f 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -484,6 +484,10 @@ impl Display { window.set_visible(true); + // Always focus new windows, even if no Alacritty window is currently focused. + #[cfg(target_os = "macos")] + window.focus_window(); + #[allow(clippy::single_match)] #[cfg(not(windows))] if !_tabbed { diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 1427dc75..5f0790b6 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -224,6 +224,12 @@ impl Window { self.window.set_visible(visibility); } + #[cfg(target_os = "macos")] + #[inline] + pub fn focus_window(&self) { + self.window.focus_window(); + } + /// Set the window title. #[inline] pub fn set_title(&mut self, title: String) {