Open xgdgsc opened 2 months ago
I suppose this makes sense. Not sure when/if I'm going to take the effort to implement this, though.
Unfortunately Qt doesn't provide a cross-platform abstraction from this. I suppose one could use relevant parts of https://github.com/qt/qtsystems/tree/dev but it had to be ported to Qt 6 (and CMake) first and stripped from the parts that would be redundant to what Qt itself already provides at this point. Maybe it would make sense to create a module/library for just QBatteryInfo
.
It would also make sense to research whether there's maybe some other (not Qt-ish) cross-platform C/C++ library for this.
Also note that to implement this correctly one needs to ignore additionally recognized batteries, e.g. from USB devices like wireless mouses. It would probably also make sense to allow configuring a threshold (so it would be possible to stop Syncthing only if the battery is running low).
Maybe it makes sense to use https://github.com/distatus/battery considering Syncthing uses Go anyway and the are no good cross-platform C++ libraries for this at this point.
There's also https://github.com/svartalf/rust-battery but probably it makes sense to refrain from mixing Rust into this project as well.
Otherwise one could also contribute to https://github.com/lfreist/hwinfo to support reading battery info on the missing platforms.
There's also https://github.com/batterycenter/battery but it is highly WIP.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Relevant components
syncthingctl
)libsyncthing
)Is your feature request specific to a certain platform/environment? Please specify. Windows
Is your feature request related to a problem? Please describe. option to stop syncthing on battery for laptop
Describe the solution you'd like option to stop like on metered network
Describe alternatives you've considered manual
Additional context Android app has this.