No description
|
Clayton Craft
2d1c375f7a
So everything gets logged... |
||
|---|---|---|
| service | service/systemd: enabled unbuffered python output | |
| config.toml.example | add initial implementation | |
| justfile | add initial implementation | |
| LICENSE | add license | |
| main.py | Stop caching dbus interface objects for systemd / manager | |
| README.md | add initial implementation | |
syncwhen
A daemon that conditionally controls syncthing.service based on system state (AC power, WiFi network, power profile). Uses D-Bus to monitor system changes and start/stop syncthing automatically based on configurable conditions.
Features
- Conditional control: Only run syncthing when specific conditions are met (AND logic)
- Interactive notifications: Override automatic decisions with action buttons
- Modular design: Easy to add new conditions
- Graceful degradation: Continues working if optional services unavailable
Dependencies
- Python 3.11+ (for tomllib)
- py3-dbus
- py3-gobject
- systemd
Or if you prefer:
$ just check-deps
OK!
Configuration
An example configuration is provided in config.toml.example. Copy it to:
$XDG_CONFIG_HOME/syncwhen/config.toml
(defaults to ~/.config/syncwhen/config.toml if XDG_CONFIG_HOME is not set)
Note: All enabled conditions must be satisfied for syncthing to run. If no conditions are enabled, syncthing runs unrestricted.
Installation
$ PREFIX=/usr DESTDIR="$pkgdir" just install
Enable the service:
$ systemctl --user daemon-reload
$ systemctl --user enable --now syncwhen.service
Design
- Monitors D-Bus for system state changes (AC power, WiFi, power profile)
- When any condition changes, evaluates all enabled conditions
- Starts or stops syncthing.service via systemd based on evaluation
- Shows notifications with override buttons when state changes
- Manual overrides persist until next condition change