New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

control-modifier-keys

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

control-modifier-keys

Control Caps, Num & Scroll lock on Windows from NodeJS

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
10
25%
Maintainers
1
Weekly downloads
 
Created
Source

control-modifier-keys

A NodeJS module to control modifier keys (scroll, num and capslock) on a windows device. This means you can read AND set the state of either Num Lock, Caps Lock or Scroll Lock. This module is also very suitable to be used in an Electron renderer process.

Motivation

While there are plenty of solutions to set these modifier keys with other packages, it is hard to read the state of these keys on-demand in NodeJS. Therefore, this simple package was created. We needed it for a custom hardware peripheral.

Installation

Simply add it to your project with npm install control-modifier-keys.

Usage

  • Get the state of a modifier key (e.g. capslock) with getModifierState("capslock").
  • Set the state of a modifier key (e.g. numlock) with setModifierState("numlock", true). Use the second boolean argument to enable or disable the key.
const cmk = require("control-modifier-keys");

// Turn on Scroll lock
cmk.setModifierState("scrolllock", true);

// Get the state of Caps lock
const capsLockState = cmk.getModifierState("capslock");

Example

To try it out, run npm run example in this repo. It will toggle all three modifier keys based on the state they're currently in.

Keywords

modifiers

FAQs

Package last updated on 06 Dec 2025

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