initial commit...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-04-06 23:20:36 +03:00
parent 0ed862bfab
commit a235ec7504
3 changed files with 39 additions and 0 deletions

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
SERVICE_DIR := /etc/systemd/system/
TIMER := thinkpad-keyboard-brightness.timer
UNIT := thinkpad-keyboard-brightness.service
.PHONY:install
install: $(TIMER) $(UNIT)
cp -f $? $(SERVICE_DIR)
systemctl daemon-reload
systemctl enamble ${UNIT}
systemctl enamble ${TIMER}
systemctl start ${TIMER}

View File

@ -0,0 +1,12 @@
[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

View File

@ -0,0 +1,11 @@
[Unit]
Description="Turn keyboard backlight on/off bases on light sensor (timer)"
[Timer]
AccuracySec=1s
OnUnitActiveSec=3s
Unit=thinkpad-keyboard-brightness.service
[Install]
WantedBy=multi-user.target