regolith-linux/regolith-i3xrocks-config

battery not displaying ups properly

Closed this issue · 11 comments

The battery2 blocklet uses acpi to get the battery info.

Here is the output of that on my desktop.

~ acpi
Battery 0: Unknown, 0%, rate information unavailable
Battery 1: Unknown, 0%, rate information unavailable

Running upower gives usable results:

 ~  upower -e
/org/freedesktop/UPower/devices/ups_hiddev1
/org/freedesktop/UPower/devices/mouse_hidpp_battery_0
/org/freedesktop/UPower/devices/keyboard_hidpp_battery_1
/org/freedesktop/UPower/devices/DisplayDevice
~ upower -i /org/freedesktop/UPower/devices/ups_hiddev1
  native-path:          /sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0/usbmisc/hiddev1
  vendor:               American Power Conversion
  model:                Back-UPS CS 650
  serial:               4B1045P22730  
  power supply:         yes
  updated:              2019. dec. 7., szombat, 16:54:54 CET (6 seconds ago)
  has history:          yes
  has statistics:       yes
  ups
    present:             yes
    state:               fully-charged
    warning-level:       none
    time to empty:       5,5 minutes
    percentage:          100%
    icon-name:          'battery-full-charged-symbolic'

This seems to give much better information. The similar is true when I check on my laptop. I think we should look around or write a better battery blocklet.

I agree @priestoferis . Another problem w/ acpi is that its x86 only, where as upower has support for arm: https://packages.ubuntu.com/bionic/admin/upower.

There's also something else wrong with battery2, the icon for charging doesn't always get displayed I haven' been able to figure out when and why not.

I'm thinking on fixing this with upower, question is: should it really be in bash or is python okay?

Ideally it would be in bash or sh due to lower runtime cost, but beggars can't be choosers. If you're willing to implement it but need to do it in python, by all means! 😄

I made some test's with the repos above (one is bash and one is python) and it seems to me that the speed difference is around 10%. On the other hand I might just go for the bash for a bit of practice.

Any update on this @priestoferis ? I'd like to get this in for the R1.3 release if possible, to remove the dependency on acpi...

I have plans to finish it before the 6th. Is that still ok for the 1.3 release?

It is! Thanks for the update and estimate. 😄

This is the last remaining feature work for R1.3. I will take this work on.

Fixed in 32e76c7