mirror of
https://github.com/flynx/thinkpad-keyboard-brightness.git
synced 2025-10-28 10:40:10 +00:00
13 lines
381 B
SYSTEMD
13 lines
381 B
SYSTEMD
|
|
[Unit]
|
||
|
|
Description="Turn keyboard backlight on/off bases on light sensor"
|
||
|
|
|
||
|
|
[Service]
|
||
|
|
Type=oneshot
|
||
|
|
RemainAfterExit=yes
|
||
|
|
Environment="SENSOR=/sys/bus/iio/devices/iio::device2/in_illuminance_raw"
|
||
|
|
WorkingDirectory=/sys/class/leds/dell::kbd_backlight/
|
||
|
|
ExecStart=bash -c "[[ $(cat ${SENSOR}) < 1500 ]] && echo 1 > brightness || echo 0 > brightness"
|
||
|
|
|
||
|
|
[Install]
|
||
|
|
WantedBy=multi-user.target
|