Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalapp/windows-dummy-keystroke

Package Overview
Dependencies
Maintainers
6
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
6
Weekly downloads
 
Created
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

Package last updated on 08 Aug 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc