I found a workaround using a script that is triggered by inotify.

I created the script called brightness in /usr/local/bin:

sudo nano /usr/local/bin/brightness

content:
--
#!/bin/sh

path=/sys/class/backlight/intel_backlight

luminance() {
    read -r level < "$path"/actual_brightness
    printf %.10f\\n "$((100 * level/max))e-2"
}

read -r max < "$path"/max_brightness
xrandr --output eDP-1 --brightness "$(luminance)"

inotifywait -me modify --format '' "$path"/actual_brightness | while read FILE
do 
    echo $(luminance)
    xrandr --output eDP-1 --brightness "$(luminance)"
done
--

chmod 755 /usr/local/bin/brightness

Remarks:
- The script waits for change in 
/sys/class/backlight/intel_backlight/actual_brightness.
- "intel_backlight" might be replaced the corresponding directory name in  
/sys/class/backlight according to your installation.
- eDP-1 may be replaced by the display name (might be eDP1 or different). Check 
the correct display name using the xrandr command. 

Add the script to the in the system setting to be executed at login.

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

Title:
  OLED brightness control on Intel Iris Plus Graphics G7

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1872327/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to     : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp

Reply via email to