Brightness
Library and CLI tool for reading and controlling backlight and LED brightness devices exposed through sysfs.
Usage
You can browse the Brightness reference.
CLI
astal-brightness --helpList available devices, set the guessed primary screen brightness, or monitor brightness changes:
astal-brightness list --pretty
astal-brightness set 50%
astal-brightness set +10%
astal-brightness monitorUse --subsystem leds and --name when targeting a specific LED device, such as a keyboard backlight.
Library
The singleton exposes backlights and leds device lists. It also exposes screen and keyboard proxy devices, which are guessed from the available backlight and LED devices.
brightness is a normalized value from 0 to 1; real_brightness is the raw value reported by sysfs.
import Brightness from "gi://AstalBrightness"
const brightness = Brightness.get_default()
print(brightness.screen.brightness)
brightness.screen.brightness = 0.5from gi.repository import AstalBrightness as Brightness
brightness = Brightness.get_default()
screen = brightness.get_screen()
print(screen.get_brightness())
screen.set_brightness(0.5)local Brightness = require("lgi").require("AstalBrightness")
local brightness = Brightness.get_default()
print(brightness.screen.brightness)
brightness.screen.brightness = 0.5var brightness = AstalBrightness.get_default();
print(@"$(brightness.screen.brightness)\n");
brightness.screen.brightness = 0.5f;Installation
install dependencies
shsudo pacman -Syu meson vala valadoc json-glib gobject-introspectionshsudo dnf install meson vala valadoc json-glib-devel gobject-introspection-develshsudo apt install meson valac valadoc libjson-glib-dev gobject-introspectionINFO
The CLI target also depends on libquarrel. Install Quarrel first, or configure with
-Dcli=falseif you only need the library.The default backend uses
systemd-logindto write brightness values. To install udev rules instead, configure with-Dbrightness-backend=UDEV.clone repo
shgit clone https://github.com/aylur/astal.git cd astal/lib/brightnessinstall
shmeson setup build meson install -C build