An even better script so that all connected displays have their
brightness adjusted


#!/bin/bash
#-----------------------------------------------------------------
# /usr/local/bin/brightness
# be sure this file is executable
#-----------------------------------------------------------------

backlight_path=/sys/class/backlight/intel_backlight

luminance() {
    read -r level < "$backlight_path"/actual_brightness
    bc <<< "scale=10;$level/$max"
}

devices() {
    xrandr | grep -w connected | awk '{ print $1 }'
}

apply() {
    for device in $(devices)
    do
        echo "$device" "$1"
        xrandr --output "$device" --brightness "$1"
    done    
}

read -r max < "$backlight_path"/max_brightness
apply "$(luminance)"

inotifywait -me modify --format '' "$backlight_path"/actual_brightness | while 
read; do
    apply "$(luminance)"
done

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1831587

Title:
  brightness control not work with OLED panel

To manage notifications about this bug go to:
https://bugs.launchpad.net/hwe-next/+bug/1831587/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to