mirror of
https://github.com/flynx/thinkpad-keyboard-brightness.git
synced 2025-10-28 10:40:10 +00:00
tweaks + docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2bd93f2964
commit
7b8f1db9a5
14
Makefile
14
Makefile
@ -1,25 +1,27 @@
|
||||
|
||||
SBIN_DIR := /usr/sbin/
|
||||
NAME := thinkpad-keyboard-brightness
|
||||
|
||||
SERVICE_DIR := /etc/systemd/system/
|
||||
|
||||
SCRIPT := thinkpad-keyboard-brightness
|
||||
TIMER := $(SCRIPT).timer
|
||||
UNIT := $(SCRIPT).service
|
||||
TIMER := $(NAME).timer
|
||||
UNIT := $(NAME).service
|
||||
|
||||
|
||||
|
||||
.PHONY:install
|
||||
install: $(TIMER) $(UNIT) $(SCRIPT)
|
||||
cp -f $(UNIT) $(TIMER) $(SERVICE_DIR)
|
||||
install: $(TIMER) $(UNIT)
|
||||
cp -f $? $(SERVICE_DIR)
|
||||
systemctl daemon-reload
|
||||
systemctl enable ${UNIT}
|
||||
systemctl enable ${TIMER}
|
||||
systemctl start ${TIMER}
|
||||
systemctl start ${UNIT}
|
||||
|
||||
|
||||
.PHONY:disable
|
||||
disable: $(TIMER) $(UNIT)
|
||||
systemctl stop ${TIMER}
|
||||
systemctl stop ${UNIT}
|
||||
systemctl disable ${TIMER}
|
||||
systemctl disable ${UNIT}
|
||||
|
||||
|
||||
36
README.md
36
README.md
@ -1 +1,35 @@
|
||||
# thinkpad-keyboard-brightness
|
||||
# Thinkpad keyboard backlight brightness
|
||||
|
||||
This service will set the keyboard backlight brightness based on ambient
|
||||
light levels.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
|
||||
## Configure
|
||||
|
||||
```bash
|
||||
$ sudo systemctl edit thinkpad-keyboard-brightness.service
|
||||
```
|
||||
|
||||
Variables that can change depending on device
|
||||
```
|
||||
[Service]
|
||||
Environment=SENSOR=/sys/bus/iio/devices/iio:device2/in_illuminance_raw
|
||||
Environment=TRIGGER=/sys/class/leds/tpacpi::kbd_backlight/brightness
|
||||
Environment=THRESHOLD=1500
|
||||
Environment=VALUE=1
|
||||
```
|
||||
|
||||
|
||||
## Uninstall
|
||||
|
||||
```bash
|
||||
$ sudo make uninstall
|
||||
```
|
||||
|
||||
|
||||
@ -4,8 +4,10 @@ Description="Turn keyboard backlight on/off based on light sensor"
|
||||
[Service]
|
||||
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"
|
||||
Environment=TRIGGER=/sys/class/leds/tpacpi::kbd_backlight/brightness
|
||||
Environment=THRESHOLD=1500
|
||||
Environment=VALUE=1
|
||||
ExecStart=bash -c "(( $(cat ${SENSOR}) < ${THRESHOLD} )) && echo ${VALUE} > ${TRIGGER} || echo 0 > ${TRIGGER}"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user