1.3.15 • Published 6 months ago

lumi-control v1.3.15

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

☀️ Lumi

npm version

Lumi is a Node.js module that allows you to adjust the brightness of your internal and external monitors.

Installation

Install via npm:

npm install lumi-control

Usage

const lumi = require('lumi-control');

// Get a list of available monitors
const monitors = lumi.monitors();

// Get the current brightness of the primary monitor
const {success, brightness} = await lumi.get();

// Get the current brightness of a specific monitor
const {success, brightness} = await lumi.get(monitorId);

// Set the brightness of the primary monitor to 50%
const {success, message} = await lumi.set(50);

// Set a specific monitor's brightness to 50%
const {success, message} = await lumi.set(monitorId, 50);

// Set the brightness for multiple monitors
const config = {
    [firstMonitorId]: 75,
    [secondMonitorId]: 100,
    [thirdMonitorId]: 25
}
const {success, message} = await lumi.set(config);

// Set the global brightness level to 50%
const {success, message} = await lumi.set(lumi.GLOBAL, 50);

API

lumi.get()

Attempts to get the current brightness level of the primary monitor.

Returns: A Promise that resolves to a GetBrightnessResult object.

lumi.get(monitorId: string)

Attempts to get the brightness level of a specific monitor identified by monitorId.

  • monitorId: The ID of the monitor to retrieve the brightness level for.

Returns: A Promise that resolves to a GetBrightnessResult object.

lumi.set(brightness: number)

Attempts to set the brightness level of the primary monitor.

  • brightness: The brightness level to set.

Returns: A Promise that resolves to a SetBrightnessResult object.

lumi.set(config: BrightnessConfiguration)

Sets the brightness levels for different monitors.

  • config: An object that maps monitor IDs to brightness levels.

Returns: A Promise that resolves to a SetBrightnessResult object.

lumi.set(monitorId: string | ALL_MONITORS, brightness: number)

Attempts to set the brightness level of a specific monitor by id or, if provided the GLOBAL constant, the global brightness level.

  • monitorId: The ID of the monitor to set the brightness level for.
  • brightness: The brightness level to set.

Returns: A Promise that resolves to a SetBrightnessResult object.

lumi.monitors()

Returns an array of available monitors.

Returns: An array of Monitor objects.

Types

BrightnessConfiguration

An object that maps monitor IDs to brightness levels.

Monitor

Represents a monitor.

  • id: The unique ID of the monitor.
  • displayId: A secondary identifier for the monitor. (Matches Chromium and Electron's display identifier.)
  • name: The name of the monitor.
  • manufacturer: The manufacturer of the monitor.
  • serialNumber: The serial number of the monitor.
  • productCode: The product code of the monitor.
  • internal: Indicates whether the monitor is an internal display.
  • position: Monitor coordinates in pixels (x, y)
  • size: Monitor size in pixels (width, height)

GetBrightnessResult

The result of a get brightness operation.

  • success: Indicates whether the operation was successful.
  • brightness: The retrieved brightness level. It is null when success is false.

SetBrightnessResult

The result of a set brightness operation.

  • success: Indicates whether the operation was successful.
  • message: An error message when success is false, otherwise null.
1.3.10

7 months ago

1.3.13

6 months ago

1.3.14

6 months ago

1.3.11

7 months ago

1.3.12

7 months ago

1.3.15

6 months ago

1.3.9

7 months ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago