Skip to content

feat: implement prevent shutdown / sign out procedure  #19745

Open
@cberescu

Description

@cberescu

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
    I agree to follow the Code of Conduct that this project adheres to.
    I have searched the issue tracker for a feature request that matches the one I want to file, without success.
    (there was something like this but has been closed, i hope this will receive a new consideration)

Problem Description

OS : Windows

I would like a way to prevent windows sign out/shutdown until i finish/stop my running tasks.

Proposed Solution

Add the following functions

app.preventShutDown(reason)

When it is called the following should happen:
[ ] call the ShutdownBlockReasonCreate API to prevent the shutdown.
[ ] all windows that receive the WM_QUERYENDSESSION event should return false

app.releaseShutDown()

This function should call ShutdownBlockReasonDestroy witch will allow the sign out/shutdown of windows.

Alternatives Considered

For now the method i use to achieve this result is using the node-ffi addon. But that is a complicated and not very efficient method.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ckerr@cberescu

        Issue actions

          feat: implement prevent shutdown / sign out procedure · Issue #19745 · electron/electron