07-04-2020, 05:41 AM
Quote:I would like to include the remaining battery time, but the standard conky variables are not working. The battery indicator on the tray does show the estimate on mouse-over, so the system somehow knows.
Does anyone know how to solve this?
The file `/sys/class/power_supply/cw2015-battery/time_to_empty_now` contains the remaining time in minutes, I wrote a small bash script to format it (hh:mm):
Code:
#!/bin/bash
time=$(cat /sys/class/power_supply/cw2015-battery/time_to_empty_now)
hours=$(($time/60))
minutes=$(printf "%02d" $(($time%60)))
echo $hours:$minutes
Save this code in a bash file (`bat_remaining_time.sh` for example), give it the execution permission (`chmod +x bat_remaining_time.sh`) and try to execute it (./bat_remaining_time.sh).
If everything works, you can add this command to your conky config to display it (the number 10 after `execi` means that the script is executed every 10 seconds):
Code:
${execi 10 /bin/bash /path/to/script/bat_remaining_time.sh}