29 lines
		
	
	
	
		
			458 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			458 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/bin/sh
 | 
						|
 | 
						|
set -e
 | 
						|
 | 
						|
CONTROLLER=$(find /sys/class/power_supply -maxdepth 1 -name '*controller*' || true)
 | 
						|
 | 
						|
if test -z "$CONTROLLER"; then
 | 
						|
    echo
 | 
						|
    exit 0
 | 
						|
fi
 | 
						|
 | 
						|
CAPACITY=$(cat "$CONTROLLER/capacity")
 | 
						|
STATUS=$(cat "$CONTROLLER/status")
 | 
						|
 | 
						|
echo -n ' '
 | 
						|
 | 
						|
if test "$STATUS" = "Charging"; then
 | 
						|
    echo -n ""
 | 
						|
else
 | 
						|
    print-battery-icon "$CAPACITY"
 | 
						|
fi
 | 
						|
 | 
						|
# Add terminating newline
 | 
						|
echo
 | 
						|
 | 
						|
# Tooltip
 | 
						|
echo -n ''
 | 
						|
print-battery-icon "$CAPACITY"
 | 
						|
echo " $CAPACITY%"
 |