-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't determine if battery is charging #2
Comments
Hello @Hashino, I just took some time to try to debug all of that. It looks very weird to my that trying to access a property didn't produce anything. I would have expected at least an error message on the case the property doesn't exist. Regarding at what's available, As a quick example, I used the following signal callback : widget:connect_signal("upower::update", function(w, device)
print("percentage", device.percentage)
print("icon_name", device.icon_name)
print("state", device.state)
end) It gave me the output we can expect for both devices type, the display_device and BAT0 (from my utils function
Note that the State from local upower = require("lgi").require "UPowerGlib"
assert(device.state == upower.DeviceState.DISCHARGING) In my case, it was trusty since my laptop is currently on battery 🎉 Alternatively, we can convert it to a string with the static function print("state_to_string", device.state_to_string(device.state))
-- Outputs:
-- state_to_string discharging Everything seems to work just fine on my side. I'm sorry I can't come up with an easy solution... Can you provide the awesome version you use, and the error logs you have ? |
i changed my code to this:
and it works when Awesome starts/restarts but it doesn't seem to be receiving updates when battery drops or i disconnect the charger. When i run |
Doesn't yield anything. Tried all variations: state, State, status, Status; none of them returned anything. My battery widget works and it shows the percentage as it should, so at least i know that it's properly connected to UPower.
original thread: https://old.reddit.com/r/awesomewm/comments/esrhnk/i_wrote_a_upowerglib_based_battery_widget_for_the/if3n4xv/
The text was updated successfully, but these errors were encountered: