You are not logged in.
Pages: 1
Topic closed
The 'battery_time' variable outputs in HH:MM:SS format; I find the last bit redundant and it takes up valuable space in my status bar.
I found this solution that worked for others, though I'm having trouble making it work for me.
${execi 60 cat /proc/acpi/battery/BAT*/state | awk '{if ($0 ~ "present rate:"){rate = $3} if($0 ~ "remaining capacity:"){cap = $3}} END {printf "%d hours %d minutes\n" ,(cap / rate), (((cap % rate) / rate) * 60)}'}/proc/acpi/battery/BAT1/ has been dropped in favor of /sys/class/power_supply/BAT1/, though I don't see the 'state' script needed by the above command to work.
capacity, charge_full, charge_now, cycle_count, status, etc are there, but no 'state' containing "remaining capacity:" or "present rate:" needed for the math to take place
Offline
Hi!
Maybe for the original poster this came late, But i found a solution for this problem by my own and I want to share it for future use
Using the variable $battery_time from conky you can display the time remaining on your battery only in hours and minutes (losing the seconds).
1st> Add to the start of your conky config file the flag:
times_in_seconds trueThis will "convert" the output of $battery_time to seconds (e.g. 1h 1m 1s --->3661 sec )
2nd> Use the follow expression to convert from seconds to hours and minutes:
${format_time $battery_time "\hh\mm"} ![]()
Useful stuff -->Conky docs
Last edited by SwitchPT (2013-12-19 20:38:30)
Offline
Thanks for the tips
I was trying to do the same, working great
Glad to hear it is working. I am going to take this opportunity to close this old thread.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed