mirror of
https://github.com/flynx/thinkpad-keyboard-brightness.git
synced 2025-10-28 10:40:10 +00:00
initial commit...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0ed862bfab
commit
a235ec7504
16
Makefile
Normal file
16
Makefile
Normal 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}
|
||||
|
||||
12
thinkpad-keyboard-brightness.service
Normal file
12
thinkpad-keyboard-brightness.service
Normal 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
|
||||
11
thinkpad-keyboard-brightness.timer
Normal file
11
thinkpad-keyboard-brightness.timer
Normal 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user