Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add did-resign-active event on app #37933

Merged
merged 1 commit into from Apr 18, 2023
Merged

Conversation

codebytere
Copy link
Member

Description of Change

Closes #37891

This PR adds a new 'did-resign-active' event on app, which forms a pair with pre-existing event 'did-become-active'. This event is emitted when the app is no longer active and doesn’t have focus. This can be triggered, for example, by clicking on another application or by using the macOS App Switcher to switch to another application.

The instigating issue requested exposure of hidesOnDeactivate - i chose to pursue this route instead because we already have a plethora of BrowserWindow options, and exposing that option is fairly limiting. There are several things a user might want to do upon app deactivation besides hide the app - background work, UI changes, etc. This solves the user's issue while also allowing for a greater range of use cases.

Checklist

Release Notes

Notes: Added new 'did-resign-active' event on app.

@codebytere codebytere added semver/minor backwards-compatible functionality target/25-x-y PR should also be added to the "25-x-y" branch. labels Apr 11, 2023
@electron-cation electron-cation bot added api-review/requested 🗳 new-pr 🌱 PR opened in the last 24 hours labels Apr 11, 2023
@miniak
Copy link
Contributor

miniak commented Apr 11, 2023

API LGTM

Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@codebytere codebytere merged commit 32afdda into main Apr 18, 2023
13 checks passed
@codebytere codebytere deleted the handle-activate-deactivate branch April 18, 2023 14:53
@release-clerk
Copy link

release-clerk bot commented Apr 18, 2023

Release Notes Persisted

Added new 'did-resign-active' event on app.

@trop
Copy link
Contributor

trop bot commented Apr 18, 2023

I have automatically backported this PR to "25-x-y", please check out #38018

@trop trop bot added in-flight/25-x-y and removed target/25-x-y PR should also be added to the "25-x-y" branch. labels Apr 18, 2023
@ericestes
Copy link

Cheers @codebytere!

@trop trop bot added merged/25-x-y PR was merged to the "25-x-y" branch. and removed in-flight/25-x-y labels Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ merged/25-x-y PR was merged to the "25-x-y" branch. semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: option to hide window when app is deactivated
5 participants