mirror of
https://github.com/flynx/thinkpad-keyboard-brightness.git
synced 2025-10-28 10:40:10 +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/
|
SERVICE_DIR := /etc/systemd/system/
|
||||||
|
|
||||||
TIMER := thinkpad-keyboard-brightness.timer
|
SCRIPT := thinkpad-keyboard-brightness
|
||||||
UNIT := thinkpad-keyboard-brightness.service
|
TIMER := $(SCRIPT).timer
|
||||||
|
UNIT := $(SCRIPT).service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY:install
|
.PHONY:install
|
||||||
install: $(TIMER) $(UNIT)
|
install: $(TIMER) $(UNIT) $(SCRIPT)
|
||||||
cp -f $? $(SERVICE_DIR)
|
cp -f $(UNIT) $(TIMER) $(SERVICE_DIR)
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enamble ${UNIT}
|
systemctl enable ${UNIT}
|
||||||
systemctl enamble ${TIMER}
|
systemctl enable ${TIMER}
|
||||||
systemctl start ${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]
|
[Unit]
|
||||||
Description="Turn keyboard backlight on/off bases on light sensor"
|
Description="Turn keyboard backlight on/off based on light sensor"
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=exec
|
||||||
RemainAfterExit=yes
|
Environment=SENSOR=/sys/bus/iio/devices/iio:device2/in_illuminance_raw
|
||||||
Environment="SENSOR=/sys/bus/iio/devices/iio::device2/in_illuminance_raw"
|
WorkingDirectory=/sys/class/leds/tpacpi::kbd_backlight/
|
||||||
WorkingDirectory=/sys/class/leds/dell::kbd_backlight/
|
ExecStart=bash -c "(( $(cat ${SENSOR}) < 1500 )) && echo 1 > brightness || echo 0 > brightness"
|
||||||
ExecStart=bash -c "[[ $(cat ${SENSOR}) < 1500 ]] && echo 1 > brightness || echo 0 > brightness"
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description="Turn keyboard backlight on/off bases on light sensor (timer)"
|
Description="Turn keyboard backlight on/off based on light sensor (timer)"
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
AccuracySec=1s
|
AccuracySec=1s
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user