Expand description
Handles application bootstrap, single-instance wiring, and daemon startup flow.
Initialises GTK/Libadwaita, registers the D-Bus application name for single-instance enforcement, and decides whether to present the library window or settings window based on user configuration. Background sync, tray icon, and filesystem monitor are wired up before entering the main event loop.
ModulesΒ§
- api_
client π - Integrates with the Immich API, handles connectivity failover, and provides album/cache helpers.
- app_
context π - Consolidated application context passed through the UI and background services.
- autostart π
- Handles autostart integration for both native installations and sandboxed Flatpak builds.
- cache_
manager π - Unified prune + clear over every on-disk cache subdirectory.
- config π
- Handles persistent configuration loading and provides desktop keyring access helpers.
- diagnostics π
- Exports a support-friendly diagnostics bundle with sensitive local data redacted for privacy.
- library π
- Library view module β browse, search, and download assets from an Immich server.
- logging π
- media_
kinds π - Central registry of supported media extensions, MIME types, and asset kinds.
- monitor π
- Provides live filesystem monitoring, file-settling checks, and checksum generation.
- notifications π
- Provides desktop notification helpers using the GIO notification portal.
- profile π
- Per-profile state isolation driven by the
MIMICK_PROFILEenv var. - queue_
manager π - Manages upload queue orchestration, retry persistence, and sync-index updates.
- remote_
sync π - Periodic remote-album reconciler.
- runtime_
env π - Provides best-effort checks of system conditions to determine when uploads should be deferred.
- sanitize π
- Input sanitisation for file paths and URLs.
- settings_
window π - Implements the GTK4/Libadwaita settings window and status dashboard.
- sidecar π
- XMP sidecar file discovery.
- startup_
scan π - Performs a startup catch-up scan for files that were missed while Mimick was not running.
- state_
manager π - Stores persistent status snapshots to restore basic UI state across application launches.
- sync_
index π - Maintains a persistent index of files that have been previously synced.
- tray_
icon π - Integrates StatusNotifier tray functionality and provides GTK-facing control signals.
- util π
- Shared filesystem and I/O utilities.
- watch_
path_ πdisplay - Provides user-friendly display names for watch paths.
StructsΒ§
- UiFlags π
- Cross-thread UI requests: the tray task sets them and a GTK timer consumes them.
Arc<Mutex<bool>>is Send + Sync, so the flags can cross into the trayβs Tokio task while the application handle itself stays on the GTK thread.
StaticsΒ§
- APP_
CONTEXT π - Shared application context reused by UI entry points and the shutdown path.
FunctionsΒ§
- api_
key_ πmissing - True until an API key is configured (or before the app context exists).
- apply_
runtime_ πpreferences - build_
api_ πclient - API client for the enabled server URLs; warns when a URL is set without an API key.
- build_
queue_ πmanager - Upload queue using the configured concurrency and pause policy (metered, battery, quiet hours).
- command_
line_ πcontext - consume_
flag π - Atomically check and clear a cross-thread boolean flag. Returns true if the flag was set, clearing it in the process.
- find_
window π - Helper to look up active GTK window instances by widget name.
- forward_
tray_ πsignal - Raise
flagwhen the tray signal fired;falseonce the tray channel is closed. - handle_
command_ πline - Handle command line from both the primary and secondary instances.
- handle_
local_ πdeletion - Trash the remote copy of a locally deleted file, unless Mimick deleted it itself.
- handle_
ui_ πflags - Act on pending tray requests; returns
Breakafter quitting to stop the timer. - init_
logging π - Mirror logs to stdout and to a rotating cache file for easier support/debugging.
- install_
termination_ πhandler - Quit gracefully on SIGINT/SIGTERM, polling the signal flag from the GTK loop.
- log_
config π - main π
- media_
file_ πarguments - Collect file path arguments (positional args that are not flags) that Mimick can upload.
- open_
default_ πwindow - Open whichever window the user prefers, presenting an existing instance if available.
- open_
library_ πwindow_ now - Open Library window, falling back to Settings if disabled.
- open_
settings_ πwindow_ now - Open Settings window or present existing settings instance.
- persist_
on_ πshutdown - Persist final state and any pending retries on graceful shutdown.
- poll_
ui_ πflags - GTK-side: poll the flags every 250ms on the main thread. The application handle stays on the GTK thread and never enters Tokio tasks.
- prepare_
gtk π - Desktop styling, global CSS, and the hold that keeps the app running without windows.
- queue_
ready_ πfile - Queue a stable file for upload unless Mimick wrote it itself or it is already synced.
- refresh_
connection_ πstatus - Record the initial server route and any connection error for the status page.
- restored_
app_ πstate - Load persisted state, resetting volatile fields that shouldnβt survive a restart.
- run_
catchup_ πscan - Queue anything in the watch folders that isnβt synced yet.
- run_
file_ πevent_ loop - Queue new files and mirror local deletions reported by the folder monitor.
- run_
manual_ πsync_ listener - Run a catch-up scan for each βSync Nowβ request.
- run_
tray π - Tokio-side: build the tray and forward its signals into the UI flags.
- spawn_
background_ πtasks - Start the file-event loop, catch-up scan, album reconciler, status check, and manual sync listener.
- spawn_
cache_ πprune - One-shot startup prune across every cache directory, delayed so it does not contend with window setup or initial sync work.
- spawn_
sync_ πindex_ flusher - Flush the sync index every 10s so a crash loses at most that much progress.
- start_
monitor π - Keep the watcher service alive, but optionally disable active folder watches.
- start_
primary_ πinstance - Set up config, API client, queue, monitor, tray, and background tasks.
Runs only in the primary instance, from
connect_startup. - upload_
plan π (reassociate_only, checksum)for the queue, orNoneif the file is up to date.- wait_
for_ πtermination_ signal - Wait for SIGINT or SIGTERM;
falseif a handler couldnβt be installed. - watch_
target_ πfor - Album target, watch root, rules, and library-only flag of the folder containing
path.