diff options
author | Chris <chris@rarr.net> | 2024-11-02 12:23:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-02 19:23:33 +0000 |
commit | 39ea7271e32ad88280191d8040d6f8feafe4307a (patch) | |
tree | c0ddfd1a72f070b74e163ecb5065950e060ea1d8 | |
parent | d552c6b251d199b4913754dd25fca330f87651fd (diff) | |
download | alacritty-39ea7271e32ad88280191d8040d6f8feafe4307a.tar.gz alacritty-39ea7271e32ad88280191d8040d6f8feafe4307a.zip |
Focus new windows on macOS
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | alacritty/src/display/mod.rs | 4 | ||||
-rw-r--r-- | alacritty/src/display/window.rs | 6 |
3 files changed, 14 insertions, 0 deletions
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) { |