mirror of
https://github.com/flynx/thinkpad-keyboard-brightness.git
synced 2025-10-28 02:30:09 +00:00
now working...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a235ec7504
commit
2bd93f2964
31
Makefile
31
Makefile
@ -1,16 +1,35 @@
|
||||
|
||||
SBIN_DIR := /usr/sbin/
|
||||
SERVICE_DIR := /etc/systemd/system/
|
||||
|
||||
TIMER := thinkpad-keyboard-brightness.timer
|
||||
UNIT := thinkpad-keyboard-brightness.service
|
||||
SCRIPT := thinkpad-keyboard-brightness
|
||||
TIMER := $(SCRIPT).timer
|
||||
UNIT := $(SCRIPT).service
|
||||
|
||||
|
||||
|
||||
.PHONY:install
|
||||
install: $(TIMER) $(UNIT)
|
||||
cp -f $? $(SERVICE_DIR)
|
||||
install: $(TIMER) $(UNIT) $(SCRIPT)
|
||||
cp -f $(UNIT) $(TIMER) $(SERVICE_DIR)
|
||||
systemctl daemon-reload
|
||||
systemctl enamble ${UNIT}
|
||||
systemctl enamble ${TIMER}
|
||||
systemctl enable ${UNIT}
|
||||
systemctl enable ${TIMER}
|
||||
systemctl start ${TIMER}
|
||||
|
||||
|
||||
.PHONY:disable
|
||||
disable: $(TIMER) $(UNIT)
|
||||
systemctl stop ${TIMER}
|
||||
systemctl disable ${TIMER}
|
||||
systemctl disable ${UNIT}
|
||||
|
||||
.PHONY:uninstall
|
||||
uninstall: disable $(TIMER) $(UNIT)
|
||||
rm -f \
|
||||
$(SERVICE_DIR)/$(TIMER) \
|
||||
$(SERVICE_DIR)/$(UNIT)
|
||||
systemctl daemon-reload
|
||||
|
||||
.PHONY:reinstall
|
||||
reinstall: uninstall install
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
[Unit]
|
||||
Description="Turn keyboard backlight on/off bases on light sensor"
|
||||
Description="Turn keyboard backlight on/off based 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"
|
||||
Type=exec
|
||||
Environment=SENSOR=/sys/bus/iio/devices/iio:device2/in_illuminance_raw
|
||||
WorkingDirectory=/sys/class/leds/tpacpi::kbd_backlight/
|
||||
ExecStart=bash -c "(( $(cat ${SENSOR}) < 1500 )) && echo 1 > brightness || echo 0 > brightness"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description="Turn keyboard backlight on/off bases on light sensor (timer)"
|
||||
Description="Turn keyboard backlight on/off based on light sensor (timer)"
|
||||
|
||||
[Timer]
|
||||
AccuracySec=1s
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user