Skip to main content

yabd

Yet another brightness daemon

This is a simple (~300 lines of python) daemon that sets the brightness of the screen depending on ambient brightness. It was developed for my framework laptop on wayland / sway, but it should work with any system that

  1. uses systemd/dbus (with systemd-logind)
  2. has an ambient light sensor compatible with iio-sensor-proxy

Features:

  • Set brightness depending on ambient brightness sensor
  • dim screen with a dbus command (for use with swayidle or similar)
  • optionally ramps brightness up and down smoothly
  • Uses dbus interfaces systemd-logind (8) (to set brightness) and iio-sensor-proxy. This means it should be compatible with any window system / wayland / tty (though I have only tested it on sway).

Installation

This needs python3.10 or newer. It also needs iio-sensor-proxy to be installed, as well as pygobject and dbus-python

Arch linux

This is available on the AUR as yabd-git. You can install it with your favourite AUR helper, eg:

$ pikaur -S yabd-git

With Pip

First install python3.10 or newer and iio-sensor-proxy through your package manager.

Then use pip to install yabd and its python dependencies:

$ pip install yabd

it will get installed in $site-packages/yabd.py

Optionally also install the systemd service file from this repo:

$ cp etc/yabd-installed-with-pip.service  ~/.config/systemd/user/yabd.service

Usage

systemd

The easiest way to use this is to use the provided systemd service file. To start the service once

$ systemctl --user start yabd

To start the service on login

$ systemctl --user enable yabd

To modify the options, edit the service file using

$ systemctl --user edit yabd

and modify the command line options in the [Service] section. The command line options are described below.

Command line

Running the daemon

To run the daemon manually, use the yabd run command:

$ yabd run --help
usage: yabd run [-h] [--max-brightness MAX_BRIGHTNESS] [--min-brightness MIN_BRIGHTNESS]
                [--dimmed-brightness DIMMED_BRIGHTNESS]
                [--max-ambient-brightness MAX_AMBIENT_BRIGHTNESS] [--device DEVICE]
                [--subsystem SUBSYSTEM] [--yield-control | --no-yield-control]
                [--change-to-get-control-back CHANGE_TO_GET_CONTROL_BACK]
                [--controllable | --no-controllable] [--ramp | --no-ramp] [--ramp-step RAMP_STEP]
                [--gamma GAMMA]

options:
  -h, --help            show this help message and exit
  --max-brightness MAX_BRIGHTNESS
                        max selectable brightness in percent (default: 100.0)
  --min-brightness MIN_BRIGHTNESS
                        min selectable brightness in percent (default: 1.0)
  --dimmed-brightness DIMMED_BRIGHTNESS
                        brightness when the screen is dimmed through command (default: 0.7)
  --max-ambient-brightness MAX_AMBIENT_BRIGHTNESS
                        ambient brightness (in lumen) corresponding to the max (default: 500.0)
  --device DEVICE       device to control (default: intel_backlight)
  --subsystem SUBSYSTEM
                        subsystem to control (default: backlight)
  --yield-control, --no-yield-control
                        If this option is activated and the screen brightness is changed by another
                        application, this daemon stops controlling it temporarily. (default: True)
  --change-to-get-control-back CHANGE_TO_GET_CONTROL_BACK
                        how much the ambient brightness has to change to get control back (default 100.0
                        lumen). If `--yield-control` is activated and another program changes the screen
                        brightness, the daemon stops controlling the screen brightness. But if the
                        ambient brightness changes more than this amount, it takes control back. set to
                        0 to disable this behaviour (default: 100.0)
  --controllable, --no-controllable
                        whether to respond to dbus commands (dim, undim, change_multiplier,
                        set_multiplier) (default: True)
  --ramp, --no-ramp     ramp brightness changes (default: True)
  --ramp-step RAMP_STEP
                        how much to change the brightness every 10 ms when ramping (in percent)
                        (default: 0.2)
  --gamma GAMMA         gamma for power scaling. 1 means proportional. Lower values mean that as the
                        room gets brighter, the screen gets brighter faster. Raise if the backlight is
                        too bright in the dark. (default: 2.0)

Changing the brightness

By changing the brightness directly

If another program changes the brightness (for example brightnessctl), the daemon will temporarily stop controlling the brightness.

If the ambient light changes more than a threshold (default 100 lumen), the daemon will take back control of the brightness.

This behaviour is configurable and can be disabled (see --change-to-get-control-back and --no-yield-control) although

  • If yielding control it is disabled, changes to the brightness may be immediately rolled back by the daemon.
  • If yielding control is enabled and the threshold is disabled, the daemon will stop doing anything if the brightness is changed by another program.

Thus for user control of the brightness, it is recommended to use the brightness multiplier instead (see below), or to keep the threshold to a reasonable value.

By changing the brightness multiplier

Otherwise, the user can change the brightness multiplier. This is a value that is originally equal to 100%, and that is multiplied to every brightness value that is set by the daemon.

Hence, when the user adds 10% to the brightness multiplier, the brightness will be 10% higher than what the daemon would have otherwise set it to.

This can be done with the following commands:

$ yabd change_multiplier -h
usage: yabd change_multiplier [-h] change

positional arguments:
  change      change the brightness multiplier by this amount (in percent)

options:
  -h, --help  show this help message and exit
$ yabd set_multiplier -h
usage: yabd set_multiplier [-h] new_multiplier

positional arguments:
  new_multiplier  set the brightness multiplier to this value (in percent)

options:
  -h, --help      show this help message and exit

for example

$ yabd change_multiplier +10 # increase the brightness by 10%. prints the new multiplier
110.0 
$ yabd set_multiplier 100 # set the multiplier back to 100%. prints the new multiplier
100.0 
Example sway config
bindsym XF86MonBrightnessUp exec "yabd change_multiplier +10"
bindsym XF86MonBrightnessDown exec "yabd change_multiplier -10"

Dimming the screen

This daemon allows the user to dim the screen via a remote command (via dbus). This is useful to dim the screen when the computer is idle.

Dimming / undimming the screen can be done with the following commands

$ yabd dim
$ yabd undim

it could also be done by calling directly the re.bruge.yabd dbus interface (if you want to do it programmatically)

$ gdbus call --session -d re.bruge.yabd -o /re/bruge/yabd -m re.bruge.yabd.dim
$ gdbus call --session -d re.bruge.yabd -o /re/bruge/yabd -m re.bruge.yabd.undim

For example, here is a sample swayidle config:

timeout 200 'yabd dim' resume 'yabd undim'
timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'

Release files for yabd 0.3.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 yabd 0.3.0
File Size Uploaded
yabd-0.3.0.tar.gz 17.8 kB Details

Built distribution (wheel)

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

Total release size: 33.5 kB

Release files / yabd-0.3.0.tar.gz

Download URL yabd-0.3.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0d7020990e46793b45ee13d5c832dfd3a18995705f4ce3f28692c29cb2ac7f1f
BLAKE2b-256 checksum
How to use checksums
d1f11fce55b36934fbe72272cb647984768b668df4291ee3a9a1f44219a6e355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2025.

Transparency log

Release files / yabd-0.3.0-py3-none-any.whl

Download URL yabd-0.3.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4367ffcdd9510acc9b3ff8185b091d502b0fe35c361890f7ebb37a9d5051d94
BLAKE2b-256 checksum
How to use checksums
5ca2c0aae17634431789d5734cb8338a7707a9747cf292a2ff0fbc6a50cd025d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

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