-
Notifications
You must be signed in to change notification settings - Fork 16.5k
feat: add query-session-end and improve session-end events on Windows #44598
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
Conversation
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
56e93f4
to
6211b11
Compare
99bba84
to
0ed2322
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
@codebytere thanks for the review! Everything sounds reasonable. I would commit fixes soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
Co-authored-by: Sam Maddock <samuel.maddock@gmail.com>
Nevermind, it was a flaky test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a small suggestion for the session-end
event, but overall API LGTM
Co-authored-by: Will Anderson <will@itsananderson.com>
@itsananderson @samuelmaddock @codebytere requesting a last review I hope! Fixed everything you highlighted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this!
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
Description of Change
Current Electron version allows to handle only
WM_ENDSESSION
, but notWM_QUERYENDSESSION
. This cause a lot of problems while Electron app is packaged into own MSI and is a menubar/tray app. For example currently we cannot close app using Restart Manager which is used by default since Windows Installer 4.0. We have to use util:CloseApplication or calltaskkil
.Quote from Restart Manager guidelines for Applications:
So to properly close GUI app we need to handle
WM_QUERYENDSESSION
properly and returnTRUE
. But for now for any unknown WM message it will cause us to return FALSE (see calling code: https://github.com/chromium/chromium/blob/134896c2d6148c6bd2f7b096b0664b1e4013cb5c/ui/views/win/hwnd_message_handler.cc#L1069).My implementation will return TRUE by default (in case of
WM_QUERYSESSION
), so it could probably fix longstanding issues like this: #15880.ev.preventDefault()
can still return old behaviour.Also both
query-session-end
andsession-end
now return a reasons why they receiving this event, it could beshutdown
,close-app
,critical
andlogoff
.Checklist
npm test
passesRelease Notes
Notes: Added
query-session-end
event and improvedsession-end
events on Windows