On macOS, explicitly focus the new window in case Alacritty isn't the active app, otherwise it won't get focus automatically #8288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On macOS, explicitly focus the new window in case Alacritty isn't the active app, otherwise it won't get focus automatically.
This is continuing from PR !8283 for issue #8283
On macOS, when
window.set_visible(true)is called, winit's AppKit delegate callsNSWindow.makeKeyAndOrderFrontwhich moves the window to the front of the application's screen list and makes it the key window for that application. If the application itself is already active, then great, the window has focus. If the application isn't active, then the window doesn't get focus.This change explicitly focuses the window.
I kept
focus_windowinalacritty::display::window::Windowand called it fromalacritty::display::Display::new; cramming the call toself.window.focus_window()inset_visibledidn't seem appropriate. Setting.with_active(true)onwindow_attributeshas no effect.make appandcargo testsucceed on macOS 15.1. Manual tested and the change seems to work as expected.make binaryandcargo testsucceed on Ubuntu 24.04. Manual tested and the app still works.