mirror of
				https://github.com/flynx/thinkpad-keyboard-brightness.git
				synced 2025-10-31 12:10:09 +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/ | SERVICE_DIR := /etc/systemd/system/ | ||||||
| 
 | 
 | ||||||
| SCRIPT := thinkpad-keyboard-brightness | TIMER := $(NAME).timer | ||||||
| TIMER := $(SCRIPT).timer | UNIT := $(NAME).service | ||||||
| UNIT := $(SCRIPT).service |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| .PHONY:install | .PHONY:install | ||||||
| install: $(TIMER) $(UNIT) $(SCRIPT) | install: $(TIMER) $(UNIT) | ||||||
| 	cp -f $(UNIT) $(TIMER) $(SERVICE_DIR)  | 	cp -f $? $(SERVICE_DIR)  | ||||||
| 	systemctl daemon-reload | 	systemctl daemon-reload | ||||||
| 	systemctl enable ${UNIT} | 	systemctl enable ${UNIT} | ||||||
| 	systemctl enable ${TIMER} | 	systemctl enable ${TIMER} | ||||||
| 	systemctl start ${TIMER} | 	systemctl start ${TIMER} | ||||||
|  | 	systemctl start ${UNIT} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| .PHONY:disable | .PHONY:disable | ||||||
| disable: $(TIMER) $(UNIT) | disable: $(TIMER) $(UNIT) | ||||||
| 	systemctl stop ${TIMER} | 	systemctl stop ${TIMER} | ||||||
|  | 	systemctl stop ${UNIT} | ||||||
| 	systemctl disable ${TIMER} | 	systemctl disable ${TIMER} | ||||||
| 	systemctl disable ${UNIT} | 	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] | [Service] | ||||||
| Type=exec | Type=exec | ||||||
| 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/ | Environment=TRIGGER=/sys/class/leds/tpacpi::kbd_backlight/brightness | ||||||
| ExecStart=bash -c "(( $(cat ${SENSOR}) < 1500 )) && echo 1 > brightness || echo 0 > brightness" | Environment=THRESHOLD=1500 | ||||||
|  | Environment=VALUE=1 | ||||||
|  | ExecStart=bash -c "(( $(cat ${SENSOR}) < ${THRESHOLD} )) && echo ${VALUE} > ${TRIGGER} || echo 0 > ${TRIGGER}" | ||||||
| 
 | 
 | ||||||
| [Install] | [Install] | ||||||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user