Skip to content

Add support for ambient light sensor#444

Merged
mtwebster merged 1 commit intolinuxmint:masterfrom
mtwebster:light-sensor
Mar 24, 2026
Merged

Add support for ambient light sensor#444
mtwebster merged 1 commit intolinuxmint:masterfrom
mtwebster:light-sensor

Conversation

@mtwebster
Copy link
Member

@mtwebster mtwebster commented Mar 8, 2026

Connects to net.hadess.SensorProxy, if available, to check for
support, and monitor sensor changes.

When the environment becomes brighter, the backlight increases -
if the environment darkens, the backlight decreases.

  • At daemon start. takes current backlight level and ambient level
    and uses it as the base state for future adjustments.
  • Any deliberate brightness changes by the user, or by dim-timers
    causes renormalization.
  • Upon sensor change:
    • A 3 second stabilization period begins. Any further sensor
      change during this period will restart its timer.
    • After stabilization, the new backlight % is determined. If
      4% of current, nothing is done.
    • If the backlight is to be updated, it is performed gradually
      over a 3 second period.
    • Sensor changes are ignored during transition, and 500ms after.

I tried a couple of iterations of gnome-settings-daemon's
implementation and found them much too sensitive (and distracting).
I've tried to minimize random light 'noise' interfering as much -
temporarily blocking a light source as I move, etc... I don't think
anything can be perfect, and probably not all light sensors will be
made the same, either.

ref:
linuxmint/cinnamon#13649

@mtwebster mtwebster marked this pull request as draft March 8, 2026 13:15
@mtwebster mtwebster marked this pull request as ready for review March 19, 2026 17:46
@mtwebster mtwebster force-pushed the light-sensor branch 8 times, most recently from 6be5f9e to d37de8b Compare March 19, 2026 23:35
mtwebster added a commit to mtwebster/Cinnamon that referenced this pull request Mar 20, 2026
Detects support via csd-power's dbus proxy, and adds switches to
toggle auto-brightness.

ref: linuxmint/cinnamon-settings-daemon#444
Connects to net.hadess.SensorProxy, if available, to check for
support, and monitor sensor changes.

When the environment becomes brighter, the backlight increases -
if the environment darkens, the backlight decreases.

- At daemon start. takes current backlight level and ambient level
  and uses it as the base state for future adjustments.
- Any deliberate brightness changes by the user, or by dim-timers
  causes renormalization.
- Upon sensor change:
  - A 3 second stabilization period begins. Any further sensor
    change during this period will restart its timer.
  - After stabilization, the new backlight % is determined. If
    4% of current, nothing is done.
  - If the backlight is to be updated, it is performed gradually
    over a 3 second period.
  - Sensor changes are ignored during transition, and 500ms after.

I tried a couple of iterations of gnome-settings-daemon's
implementation and found them much too sensitive (and distracting).
I've tried to minimize random light 'noise' interfering as much -
temporarily blocking a light source as I move, etc... I don't think
anything can be perfect, and probably not all light sensors will be
made the same, either.
@mtwebster mtwebster merged commit 734fd60 into linuxmint:master Mar 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant