Skip to content
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

Option to stop Syncthing on battery for laptop #259

Open
1 of 6 tasks
xgdgsc opened this issue May 10, 2024 · 3 comments
Open
1 of 6 tasks

Option to stop Syncthing on battery for laptop #259

xgdgsc opened this issue May 10, 2024 · 3 comments

Comments

@xgdgsc
Copy link

xgdgsc commented May 10, 2024


Relevant components

  • Standalone tray application (based on Qt Widgets)
  • Plasmoid/applet for Plasma desktop
  • Dolphin integration
  • Command line tool (syncthingctl)
  • Integrated Syncthing instance (libsyncthing)
  • Backend libraries

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.

@Martchus
Copy link
Owner

Martchus commented May 10, 2024

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).

@Martchus Martchus changed the title option to stop syncthing on battery for laptop Option to stop Syncthing on battery for laptop May 10, 2024
@Martchus
Copy link
Owner

Martchus commented May 11, 2024

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.

Copy link

stale bot commented Jul 11, 2024

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.

@stale stale bot added the stale label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants