# zocker-160/syncthingy architecture

> Architecture diagram of the GitHub repository zocker-160/syncthingy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zocker-160/syncthingy
- Repository: https://github.com/zocker-160/syncthingy

## Overview

#### Purpose and Runtime

SyncThingy is a minimal Linux desktop wrapper around Syncthing: it launches/manages the sync daemon and exposes a system-tray indicator with access to Syncthing’s Web UI. It is primarily designed for Flatpak distribution, though CMake supports native installation when `syncthing` is available on `PATH`.

Primary executable entry point: `src/main.cpp`. Build, install, and packaging behavior originate in `CMakeLists.txt`.

#### Application Bootstrap and Single-Instance Control

Startup in `src/main.cpp` initializes the Qt application, enforces single-application behavior through the vendored/submodule-backed `src/singleapplication`, and establishes the tray-oriented desktop process lifecycle. A second invocation should be routed to the existing process rather than creating another daemon/controller instance.

Shared application-level constants, including identifiers and likely configuration/service values, are centralized in `src/Constants.h`.

#### Syncthing Process and Web UI Boundary

The application’s core external boundary is the Syncthing executable/service. SyncThingy does not implement file synchronization; it starts or coordinates Syncthing and opens its locally hosted Web UI using the configured URL.

Relevant boundaries:
- Application controller/bootstrap: `src/main.cpp`
- Shared runtime identifiers/defaults: `src/Constants.h`
- User-configured Web UI target: `src/SettingsDialog.cpp`

Syncthing configuration remains owned by Syncthing, under the Flatpak application data area described in the README.

#### Tray UI and User Actions

The tray indicator is the principal UI surface. Its action flow is: user selects a tray command → SyncThingy opens the Web UI, adjusts settings, or invokes service-management behavior. This keeps the app intentionally smaller than a full Syncthing management client.

The main control wiring is in `src/main.cpp`; settings-related actions are handled through `src/SettingsDialog.h` and `src/SettingsDialog.cpp`.

#### Settings and Persistent Preferences

`SettingsDialog` owns the user-facing configuration boundary for SyncThingy-specific preferences: autostart, icon variant, Web UI URL, notifications, and installation of a background system service.

Paths:
- `src/SettingsDialog.h`
- `src/SettingsDialog.cpp`
- `src/Constants.h`

For Flatpak installs, preferences are persisted under the application configuration directory, separate from Syncthing’s own configuration/state.

#### Background Service Installation

`ServiceDialog` supports generating or presenting the commands/instructions needed to install SyncThingy as a system service, aimed at Steam Deck background operation. The repository includes the service unit distributed for this purpose:

- `src/ServiceDialog.cpp`
- `src/ServiceDialog.h`
- `linux_packaging/syncthingy.service`

This is an integration boundary with the host’s systemd/service manager rather than an in-process scheduler.

#### Distribution and Desktop Integration

CMake defines the native build/install graph: `CMakeLists.txt`. Linux desktop integration assets provide launcher, application metadata, and system-service packaging:

- `linux_packaging/SyncThingy.desktop`
- `linux_packaging/metainfo.xml`
- `linux_packaging/syncthingy.service`

Qt 5 and `libportal-qt5` are material runtime/build dependencies; portal support is relevant to sandboxed Flatpak desktop integration. Syncthing itself is the critical external executable and synchronization service.

Main entry points: [`src/main.cpp`](https://github.com/zocker-160/syncthingy/blob/master/src/main.cpp) (Application bootstrap), [`src/SettingsDialog.cpp`](https://github.com/zocker-160/syncthingy/blob/master/src/SettingsDialog.cpp) (Settings dialog), [`src/ServiceDialog.cpp`](https://github.com/zocker-160/syncthingy/blob/master/src/ServiceDialog.cpp) (Service dialog), [`CMakeLists.txt`](https://github.com/zocker-160/syncthingy/blob/master/CMakeLists.txt) (Build and install)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop Application"]
  node_main["Application bootstrap<br/>Qt entry point<br/>[main.cpp]"]
  node_single_instance{{"Single-instance guard<br/>vendored runtime"}}
  node_constants["Runtime constants<br/>shared defaults<br/>[Constants.h]"]
  node_tray["Tray actions<br/>desktop UI<br/>[main.cpp]"]
  node_settings["Settings dialog<br/>preferences UI<br/>[SettingsDialog.cpp]"]
  node_settings_api["Settings interface<br/>dialog API<br/>[SettingsDialog.h]"]
  node_preferences[("SyncThingy preferences<br/>application config")]
  node_service_dialog["Service dialog<br/>service setup UI<br/>[ServiceDialog.cpp]"]
  node_service_api["Service interface<br/>dialog API<br/>[ServiceDialog.h]"]
end

subgraph group_integration["External Integration"]
  node_syncthing{{"Syncthing daemon<br/>external executable"}}
  node_web_ui["Syncthing Web UI<br/>local web endpoint"]
  node_systemd{{"Host service manager<br/>systemd boundary"}}
  node_portal{{"Desktop portal<br/>libportal-qt5"}}
end

subgraph group_distribution["Distribution"]
  node_cmake["Build and install<br/>CMake project<br/>[CMakeLists.txt]"]
  node_desktop_file["Desktop launcher<br/>desktop entry<br/>[SyncThingy.desktop]"]
  node_app_metadata["Application metadata<br/>metainfo<br/>[metainfo.xml]"]
  node_service_unit["Service unit<br/>systemd unit<br/>[syncthingy.service]"]
end

node_main -->|"enforces"| node_single_instance
node_main -->|"uses"| node_constants
node_main -->|"creates"| node_tray
node_main -->|"launches or manages"| node_syncthing
node_tray -->|"opens"| node_settings
node_tray -->|"opens"| node_web_ui
node_tray -->|"opens"| node_service_dialog
node_settings -->|"implements"| node_settings_api
node_settings -->|"persists"| node_preferences
node_settings -->|"configures URL for"| node_web_ui
node_settings -->|"initiates service setup"| node_service_dialog
node_service_dialog -->|"implements"| node_service_api
node_service_dialog -->|"uses"| node_service_unit
node_service_unit -->|"installed for"| node_systemd
node_syncthing -->|"hosts"| node_web_ui
node_main -->|"integrates through"| node_portal
node_cmake -->|"installs"| node_desktop_file
node_cmake -->|"packages"| node_app_metadata
node_cmake -->|"distributes"| node_service_unit

click node_main "https://github.com/zocker-160/syncthingy/blob/master/src/main.cpp"
click node_single_instance "https://github.com/zocker-160/syncthingy/tree/master/src/singleapplication"
click node_constants "https://github.com/zocker-160/syncthingy/blob/master/src/Constants.h"
click node_tray "https://github.com/zocker-160/syncthingy/blob/master/src/main.cpp"
click node_settings "https://github.com/zocker-160/syncthingy/blob/master/src/SettingsDialog.cpp"
click node_settings_api "https://github.com/zocker-160/syncthingy/blob/master/src/SettingsDialog.h"
click node_service_dialog "https://github.com/zocker-160/syncthingy/blob/master/src/ServiceDialog.cpp"
click node_service_api "https://github.com/zocker-160/syncthingy/blob/master/src/ServiceDialog.h"
click node_cmake "https://github.com/zocker-160/syncthingy/blob/master/CMakeLists.txt"
click node_desktop_file "https://github.com/zocker-160/syncthingy/blob/master/linux_packaging/SyncThingy.desktop"
click node_app_metadata "https://github.com/zocker-160/syncthingy/blob/master/linux_packaging/metainfo.xml"
click node_service_unit "https://github.com/zocker-160/syncthingy/blob/master/linux_packaging/syncthingy.service"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_single_instance,node_constants,node_tray,node_settings,node_settings_api,node_preferences,node_service_dialog,node_service_api toneBlue
class node_syncthing,node_web_ui,node_systemd,node_portal toneAmber
class node_cmake,node_desktop_file,node_app_metadata,node_service_unit toneMint
```

## Components

### Desktop Application

Qt tray wrapper runtime.

- [Application bootstrap](https://github.com/zocker-160/syncthingy/blob/master/src/main.cpp): Qt entry point · Initializes the tray process and wires primary actions. · `src/main.cpp`
- [Single-instance guard](https://github.com/zocker-160/syncthingy/tree/master/src/singleapplication): vendored runtime · Routes subsequent launches to the existing process. · `src/singleapplication`
- [Runtime constants](https://github.com/zocker-160/syncthingy/blob/master/src/Constants.h): shared defaults · Defines application identifiers and shared values. · `src/Constants.h`
- [Tray actions](https://github.com/zocker-160/syncthingy/blob/master/src/main.cpp): desktop UI · Provides Web UI, settings, and service-management commands. · `src/main.cpp`
- [Settings dialog](https://github.com/zocker-160/syncthingy/blob/master/src/SettingsDialog.cpp): preferences UI · Configures autostart, icon, Web UI URL, notifications, and service installation. · `src/SettingsDialog.cpp`
- [Settings interface](https://github.com/zocker-160/syncthingy/blob/master/src/SettingsDialog.h): dialog API · `src/SettingsDialog.h`
- **SyncThingy preferences**: application config · Stored separately from Syncthing configuration in Flatpak installs.
- [Service dialog](https://github.com/zocker-160/syncthingy/blob/master/src/ServiceDialog.cpp): service setup UI · Presents installation commands for background operation. · `src/ServiceDialog.cpp`
- [Service interface](https://github.com/zocker-160/syncthingy/blob/master/src/ServiceDialog.h): dialog API · `src/ServiceDialog.h`

### External Integration

Syncthing and host desktop boundaries.

- **Syncthing daemon**: external executable · Owns synchronization and its own configuration/state.
- **Syncthing Web UI**: local web endpoint · Opened at the user-configured URL.
- **Host service manager**: systemd boundary · Installs and runs the optional background service.
- **Desktop portal**: libportal-qt5 · Supports sandboxed Flatpak desktop integration.

### Distribution

Build and Linux desktop assets.

- [Build and install](https://github.com/zocker-160/syncthingy/blob/master/CMakeLists.txt): CMake project · Defines native build, installation, and packaging behavior. · `CMakeLists.txt`
- [Desktop launcher](https://github.com/zocker-160/syncthingy/blob/master/linux_packaging/SyncThingy.desktop): desktop entry · `linux_packaging/SyncThingy.desktop`
- [Application metadata](https://github.com/zocker-160/syncthingy/blob/master/linux_packaging/metainfo.xml): metainfo · `linux_packaging/metainfo.xml`
- [Service unit](https://github.com/zocker-160/syncthingy/blob/master/linux_packaging/syncthingy.service): systemd unit · Distributed unit for background SyncThingy operation. · `linux_packaging/syncthingy.service`

## Connections

- Application bootstrap → Single-instance guard: enforces
- Application bootstrap → Runtime constants: uses
- Application bootstrap → Tray actions: creates
- Application bootstrap → Syncthing daemon: launches or manages
- Tray actions → Settings dialog: opens
- Tray actions → Syncthing Web UI: opens
- Tray actions → Service dialog: opens
- Settings dialog → Settings interface: implements
- Settings dialog → SyncThingy preferences: persists
- Settings dialog → Syncthing Web UI: configures URL for
- Settings dialog → Service dialog: initiates service setup
- Service dialog → Service interface: implements
- Service dialog → Service unit: uses
- Service unit → Host service manager: installed for
- Syncthing daemon → Syncthing Web UI: hosts
- Application bootstrap → Desktop portal: integrates through
- Build and install → Desktop launcher: installs
- Build and install → Application metadata: packages
- Build and install → Service unit: distributes
