Skip to content

Commit

Permalink
macOS: don't implicitly activate background apps
Browse files Browse the repository at this point in the history
  • Loading branch information
lunixbochs committed Nov 17, 2024
1 parent 59b1eb5 commit f2eba4c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/platform_impl/apple/appkit/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@ impl AppState {
// menu bar is initially unresponsive on macOS 10.15.
// If no activation policy is explicitly provided, do not set it at all
// to allow the package manifest to define behavior via LSUIElement.
if self.activation_policy.is_some() {
app.setActivationPolicy(self.activation_policy.unwrap());
if let Some(activation_policy) = self.activation_policy {
app.setActivationPolicy(activation_policy);
}

#[allow(deprecated)]
app.activateIgnoringOtherApps(self.activate_ignoring_other_apps);
if self.activate_ignoring_other_apps && self.activation_policy != Some(NSApplicationActivationPolicy::Prohibited) {
#[allow(deprecated)]
app.activateIgnoringOtherApps(true);
}

if self.default_menu {
// The menubar initialization should be before the `NewEvents` event, to allow
Expand Down

0 comments on commit f2eba4c

Please sign in to comment.