Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ It is very light on ressource usage and is therefore suitable for use in all con
- synchronisation conflict
- light on system ressources
- no runtime dependency outside of Syncthing
- supports Linux and macOS

## Installation

Expand All @@ -38,6 +39,8 @@ systemctl --user daemon-reload
systemctl --user enable --now stfed.service
```

On macOS, no service file is provided, use your preferred way of running a background service (for example a launchd user agent).

### From the AUR

Arch Linux users can install the [stfed AUR package](https://aur.archlinux.org/packages/stfed/).
Expand Down Expand Up @@ -84,6 +87,7 @@ event = "file_down_sync_done"
filter = "shopping-list.txt"

# command to run when event triggers
# (notify-send is Linux specific, on macOS use for example: osascript -e 'display notification "..."')
command = "notify-send 'stfef event triggered!'"

# Whether to allow several commands for the same hook to run simultaneously
Expand Down
11 changes: 9 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ impl Config {
let xdg_dirs = xdg::BaseDirectories::with_prefix("syncthing");
let st_config_filepath = xdg_dirs
.find_state_file("config.xml")
.or_else(|| xdg_dirs.find_config_file("config.xml"))
.context("Unable fo find Synthing config file")?;
.or_else(|| xdg_dirs.find_config_file("config.xml"));
// Syncthing on macOS defaults to a location outside of XDG paths
#[cfg(target_os = "macos")]
let st_config_filepath = st_config_filepath.or_else(|| {
expand_tilde("~/Library/Application Support/Syncthing/config.xml")
.filter(|p| p.is_file())
});
let st_config_filepath =
st_config_filepath.context("Unable fo find Synthing config file")?;
log::debug!("Found Syncthing config in {st_config_filepath:?}");
let st_config_xml = fs::read_to_string(st_config_filepath)?;
let st_config: SyncthingXmlConfig = quick_xml::de::from_str(&st_config_xml)?;
Expand Down
Loading