i3status-rust icon indicating copy to clipboard operation
i3status-rust copied to clipboard

battery: upower, assume AC if there is only DisplayDevice

Open quite opened this issue 3 years ago • 3 comments

This is related to https://github.com/greshake/i3status-rust/issues/85 -- I also sync config between laptops and now also a desktop.

On my desktop, I'm now seeing the red-empty battery icon. Config:

[[block]]
block = "battery"
driver = "upower"
device = "DisplayDevice"
allow_missing = true
hide_missing = true

upower -d on my my desktop system shows:

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         no
  updated:              2022-02-07T08:20:06 CET (1350 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       none
    percentage:          0%
    icon-name:          ''

Apparently this is common on desktops. /sys/class/power_supply/ is empty. I think that if one is using upower with device DisplayDevice, and there is also no battery device present, then AC/missing battery should be assumed.

quite avatar Feb 07 '22 07:02 quite

Temporarily, you can use the new if_command configuration option to disable your battery block when run on desktop (added in #1415).

MaxVerevkin avatar Feb 07 '22 17:02 MaxVerevkin

I'm happy with this work-around. I guess that for completeness there should be code that, when using DisplayDevice, always checks if there are any batteries present at all.

quite avatar Feb 08 '22 07:02 quite

I just noticed your config has hide_missing and allow_missing, yet you still end up with it in the bar. Pretty sure this is a bug. Did this ever work as expected for you, or is it a regression?

ammgws avatar Mar 06 '22 08:03 ammgws