syncthing-gtk icon indicating copy to clipboard operation
syncthing-gtk copied to clipboard

Ability to disable syncing when on battery

Open somasis opened this issue 9 years ago • 4 comments

I installed Syncthing GTK on my mother's Windows 8 tablet so that she could see her pictures on her tablet and on her laptop with the changes being synced, and while it works very well, Syncthing is able to easily eat battery if it works with many files. So, I was wondering if it'd be possible to implement the ability to disable syncing while on battery or at a certain battery level, at least on Windows.

Great software, by the way, I use it a lot. :+1:

somasis avatar Mar 31 '15 23:03 somasis

Well, it's not bad idea, I just doubt I can read /proc/acpi on Windows :D But I'll check what's alternative there...

kozec avatar Apr 01 '15 14:04 kozec

This can be easily done using psutil library:

import psutil
bat = psutil.sensors_battery()
if bat is None:
    # No battery detected
else:
    return bat.power_plugged

According to the documentation, this should work in both Linux and Windows.

mkey-cdx avatar Mar 07 '18 16:03 mkey-cdx

Sounds great, thanks for the tip!

kozec avatar Mar 07 '18 20:03 kozec

I'd be happy to help if you can tell me where to write this code and how to call it.

mkey-cdx avatar Mar 09 '18 14:03 mkey-cdx