Skip to main content

PyPI version

A python library and script for changing brightness on Linux via acpi. Allows for easing animations too!

pip install acpibacklight

You can use the script acpi-ease-backlight to adjust the backlight with easing via acpi on your device. See acpi-ease-backlight --help for options.

CLI Usage

After installing via pip, use the script acpi-ease-backlight. Here is how you might use it:

$ acpi-ease-backlight -h        # see help
...

$ acpi-ease-backlight show      # show the current backlight value
4000

$ acpi-ease-backlight max       # show the your display's max backlight value
4882

$ acpi-ease-backlight set 2000  # set the backlight to 2000, over the default
                                # duration of 0.25 seconds and using the default
                                # easing function 'easeOutCubic'

$ acpi-ease-backlight -d 1 -e easeInOutQuad set 3000
                                # set the backlight to 3000 over duration of
                                # 1 second, using the easing function 'easeInOutQuad'

$ acpi-ease-backlight -d 0.5 dec 1000
                                # decrease the current backlight value by
                                # 1000 over a duration of 0.5 seconds

Library Usage

Instantiating

Use the class acpibacklight.AcpiBacklightControl for changing the backlight level in various ways. AcpiBacklightControl is designed to use python with statements similarly to file objects and python’s open builtin:

from acpibacklight import AcpiBacklightControl

with AcpiBacklightControl() as ctrl:
    # set the brightness without animating
    ctrl.brightness = 2000

    # get max brightness on this device
    new_brightness = ctrl.max

    # You can also use the animate function on the AcpiBacklightControl.
    # See the docstring for kwargs
    ctrl.animate(new_brightness, duration=0.75)

Alternatively, you can construct, then open, then close the AcpiBacklightControl:

ctrl = AcpiBacklightControl()
ctrl.open()
ctrl.animate(ctrl.brightness - 1000)
ctrl.close()

If you have multiple ACPI backlight devices, specify the name when constructing the AcpiBacklightControl. Otherwise, the default is the first device directory found.

ctrl = AcpiBacklightControl(device_dir='intel_backlight')

Easing Functions

You can pass an easing function to be used in animate() by the easing_func keyword arg. This package uses PyTweening for its default animation and the CLI, so you can easily pass one of those:

import pytweening
ctrl.animate(2345, easing_func=pytweening.easeInOutBounce)

Finally, if you want to create and pass your own easing function, it should take one paramater (time) between 0 and 1, and return a value between 0 and 1. For instance, a linear easing function would look like:

def linear_easing(t):
  # t is always in the range [0, 1]
  return t

# ...
ctrl.animate(1234, easing_func=linear_easing)

Release files for acpibacklight 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for acpibacklight 0.2.0
File Size Uploaded
acpibacklight-0.2.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for acpibacklight 0.2.0
File Interpreter ABI Platform
acpibacklight-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / acpibacklight-0.2.0.tar.gz

Download URL acpibacklight-0.2.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dc7b080f03dd29356d27f8b2240a7a6ca9cfff56e0c0294c8e50f993ac7e360a
BLAKE2b-256 checksum
How to use checksums
966bb61f70e9324a1e7a237eec5eeb0f56855afc01f102082c1a113bc48a64c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / acpibacklight-0.2.0-py3-none-any.whl

Download URL acpibacklight-0.2.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
389f756b1db35c1e6d5d75b343e594b5fbba701da5485fa1067cff64ba0aa570
BLAKE2b-256 checksum
How to use checksums
c30d407c9869af9b8783cb9d9d1f38dc7d11a227ba25ac3a49ac7877151ed4a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page