i3status-rust
i3status-rust copied to clipboard
battery: upower, assume AC if there is only DisplayDevice
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.
Temporarily, you can use the new if_command configuration option to disable your battery block when run on desktop (added in #1415).
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.
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?