#hs.brightness

Inspect/manipulate display brightness

Home: https://github.com/asmagill/mjolnir_asm.sys

This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.


#API Overview

Functions - API calls offered directly by the extension


#API Documentation

#Functions

Signaturehs.brightness.ambient() -> number
TypeFunction
DescriptionGets the current ambient brightness
Parameters
  • None
Returns
  • A number containing the current ambient brightness, measured in lux. If an error occurred, the number will be -1
Notes
  • Even though external Apple displays include an ambient light sensor, their data is typically not available, so this function will likely only be useful to MacBook users
  • On Silicon based macs, this function uses a method similar to that used by corebrightnessdiag to retrieve the aggregate lux as reported to sysdiagnose.
  • On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value.
ExamplesNone
Sourceextensions/brightness/libbrightness.m line 18

Signaturehs.brightness.get() -> number
TypeFunction
DescriptionReturns the current brightness of the display
Parameters
  • None
Returns
  • A number containing the brightness of the display, between 0 and 100
NotesNone
ExamplesNone
Sourceextensions/brightness/libbrightness.m line 120

Signaturehs.brightness.set(brightness) -> boolean
TypeFunction
DescriptionSets the display brightness
Parameters
  • brightness - A number between 0 and 100
Returns
  • True if the brightness was set, false if not
NotesNone
ExamplesNone
Sourceextensions/brightness/libbrightness.m line 82