-
Notifications
You must be signed in to change notification settings - Fork 38
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
upower module #82
Comments
That'd be fantastic, a battery module is something I've been meaning to add to the backlog for some time. Go for it! |
Thanks, this is what I have now: https://paste.sr.ht/~p00f/7061bf6067959b1c9b61f405665c9f377baed807 When I connect/disconnect the charger, the properties get printed on the terminal
This is a HashMap which has properties of the battery like percentage, time to full/empty, whether it is charging, etc I'm having trouble implementing |
What are the associated types |
So the separation of controller/widget is really there for organisation, rather than functionality (at the moment at least anyway). With the current implementation, you could actually technically get away with doing all the rendering in the controller, or all the logic in
I'd recommend having a look at the |
Should the initial setup in spawn_controller be blocking or nonblocking (lines 36-44)? I tried making everything nonblocking: but it crashed: |
Non-blocking/async is preferable, as the controller runs on the main GTK thread, so will otherwise block the UI for all bars/widgets. The channels will error if you try to send but there is no open receiver. If you stick: context.widget_rx.attach(None, |_| Continue(true)); inside |
Nice, thanks |
I forgot to add the sidebar link on the wiki, that's there now. There's only two reasons I can see that it wouldn't show up there for you: a) You're not actually on the latest commit |
Wait, yeah that would be why... |
upower: https://upower.freedesktop.org/
can be used to listen to device events like charger connected/battery level changed instead of polling.
I want to implement this feature and am planning to use the
upower-dbus
crateThe text was updated successfully, but these errors were encountered: