Socket
Socket
Sign inDemoInstall

@signalapp/windows-dummy-keystroke

Package Overview
Dependencies
15
Maintainers
6
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @signalapp/windows-dummy-keystroke

This package exports `sendDummyKeystroke()`, which will send a generic key down/up event on Windows.


Version published
Weekly downloads
261
increased by3.16%
Maintainers
6
Created
Weekly downloads
 

Readme

Source

Windows Dummy Keystroke

This package exports sendDummyKeystroke(), which will send a generic key down/up event on Windows.

But why?

This is a workaround for an issue with Windows Notifications. Normally you can call the native AllowSetForegroundWindow method to permit another application to take foreground focus. But when an app is started from a Windows notification activation, this call fails with ERROR_ACCESS_DENIED. One of a list of conditions has to be met for the call to succeed.

Sending a key press event satisfies this check and lets AllowSetForegroundWindow succeed.

This is useful for letting a second instance of a program activate the original instance. In Electron, you would call this before calling requestSingleInstanceLock(), as this can call AllowSetForegroundWindow for the initial instance.

This workaround was used by Chromium to solve a foreground focus issue, and is adapted here for use with Node.

FAQs

Last updated on 08 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc