Fiat Lux

Workaround

xbacklight =50

Hypothesis

Hardware?

Driver?

Multiple device?

Linux
+
Recent hardware

Analysis

What happens when I press those buttons?

/sys/class/backlight/acpi_video0/brightness

Hacking it

inotify

while inofifywait -e modify -s $file; do
    xbacklight "=$(cat $file)"
done

+ Works

- Manual

Automagic

CLI tool

Daemon

backlight_watcher () {
    while inofifywait -e modify -s $file; do
        xbacklight "=$(cat $file)"
    done
}

nohup backlight_watcher &

Service

backlight_watcher_start () {
    nohup backlight_watcher &
}

backlight_watcher_stop () {
    pkill -f inotifywait
}

backlight_watcher_status () {
    pgrep -fl inotifywait
}

Start at login

  • init
  • upstart
  • systemd

SystemD

No display!

Solutions

  • User space
  • Manual display
[Unit]
Description=Backlight

[Service]
Type=forking
ExecStart=backlight-watcher start
ExecStop=backlight-watcher stop

[Install]

Are we there yet?

[Unit]
Description=Backlight

[Service]
Type=forking
Environment=DISPLAY=:0 XAUTHORITY=/run/user/1000/gdm/Xauthority
ExecStart=backlight-watcher start
ExecStop=backlight-watcher stop

[Install]

Does not work...

3 days later...

[Unit]
Description=Backlight

[Service]
Type=forking
Environment=DISPLAY=:1 XAUTHORITY=/run/user/1000/gdm/Xauthority
ExecStart=backlight-watcher start
ExecStop=backlight-watcher stop

[Install]

Success

Next steps

Packages

Other systems

Thank you!

Made with Slides.com