My laptop has a 4K OLED screen, so it has no backlight to change the brightness of the screen. To control the brightness, you need to use xrandr with the --brightness parameter. I have successfully done this in the i3 window manager before but I would now like to to something similar in Budgie.
Budgie will detect the brightness keystrokes and will change the /sys/class/backlight/intel_backlight/brightness file contents to a value that would normally update the backlight setting.
I would like to monitor this file for changes and when it changes, just call xrandr with the correct value... I found out that you can watch file changes with inotifywait but for some reason, it doesn't work for me.
$ cat /sys/class/backlight/intel_backlight/brightness
21750
# Now pressing the brightness up key on the keyboard
$ cat /sys/class/backlight/intel_backlight/brightness
28000
$ inotifywait /sys/class/backlight/intel_backlight/brightness
Setting up watches.
Watches established.
# Now pressing the brightness up key on the keyboard....... nothing happens.
# Same when I add the -e close_write parameter.
Anyone knows why this happens?
I could of course just check the file's contents every second but I don't like that kind of solution.
FYI: Arch Linux, up to date
Edit: I just noticed that it DOES notice changes in /sys/class/backlight/acpi_video0/brightness which solves my problem, but the question is still valid.