Introducing a new way to review your PRs.

Read the announcement

ever-co / ever-gauzy

Ever® Gauzy™ - Open Business Management Platform (ERP/CRM/HRM/ATS/PM) - https://gauzy.co

View on GitHub

27 documents · Updated Nov 23, 2026

docs / electron-desktop-applications

Electron desktop applications

The Electron desktop applications provide native shells for Gauzy work tracking. Gauzy Desktop offers the wider desktop work surface, while Gauzy Desktop Timer focuses on the timer view. Their main processes manage windows, local startup, desktop services, and communication with Angular renderers. This page complements desktop time tracking and relates to desktop agent capture and sync and desktop shared libraries.

Application roles

The two applications support the same tracking goal through different user surfaces. They share desktop services and window roles so that timer state and native controls remain consistent.

Full desktop application

Gauzy Desktop is the broad desktop client. It combines the main Gauzy interface with time tracking, setup, settings, notifications, tray control, updates, and an optional local Gauzy server. The shell keeps these functions available when the main view is hidden.

References: apps/…/index.ts• L350-507 apps/…/index.ts• L636-728

Desktop timer application

Gauzy Desktop Timer is the focused client for starting and stopping tracked work. Its visible product path centers on the timer window, setup state, local storage, server readiness, and the always-on timer widget. It uses the same desktop service boundary as the full application.

References: apps/…/index.ts• L321-371 apps/…/index.ts• L506-585

Electron process boundaries

Electron separates native control from the web user interface. The main process owns privileged desktop actions, the renderer presents Angular views, and the preload script sits at the edge between them.

Main process

The main process coordinates application startup and native behavior. It restores local settings, prepares local data, selects setup or tracking, creates windows, starts or connects to a Gauzy service, and manages tray, deep links, updates, offline state, and shutdown.

The two products follow the same broad lifecycle. Gauzy Desktop starts its integrated server when local mode is selected and creates stable per-install secrets for that server. Gauzy Desktop Timer defers its database and updater setup until Electron is ready because some native APIs and modules need that state.

References: apps/…/index.ts• L105-177 apps/…/index.ts• L350-445 apps/…/index.ts• L636-728 apps/…/index.ts• L92-140 apps/…/index.ts• L500-585

Renderer process

The renderer is the Angular application that presents setup, sign-in, time tracking, settings, and related views. Each product bootstraps its own root component with shared desktop services for authentication, state persistence, routing, language, themes, HTTP requests, and Electron access.

The full desktop renderer also responds to timer, activity, time-sheet, and server events from the native shell. The timer renderer focuses on server readiness, logout, social sign-in, workspace selection, child windows, and activity collection. In both products, ElectronService provides the path to desktop APIs without moving native coordination into ordinary UI code.

References: apps/…/main.ts• L71-197 apps/…/app.component.ts• L18-39 apps/…/app.component.ts• L41-227 apps/…/main.ts• L64-190 apps/…/app.component.ts• L27-177

Preload boundary

The preload script prepares native behavior that must exist when a window document is ready. It supports the custom title bar and main-process menu and theme events. The timer preload also starts the macOS tray-icon listener for timer and login views.

The shared renderer service can use direct Electron access in an Electron renderer or use an electronAPI context bridge when one is provided. Renderer code therefore treats IPC as the desktop boundary instead of relying on a browser-only view of the application.

References: apps/…/preload.ts• L59-103 apps/…/preload.ts• L6-76 packages/…/electron.service.ts• L16-103

Error reporting

Error reporting spans the main and renderer processes so startup, native actions, and Angular failures can be observed together. Sentry is enabled only when the product environment supplies a data source name. Its process setup limits collected data and queues events while the app is offline.

References: apps/…/sentry.ts• L1-75 apps/…/sentry.ts• L1-77 apps/…/main.ts• L65-78 apps/…/main.ts• L59-71

Desktop API boundary

Desktop APIs are native capabilities exposed to the renderer through named IPC channels. The main process checks the current state and performs the OS action, then sends a result or event to the window that requested it.

IPC contract

The IPC contract carries requests for server state, platform details, application settings, screen sources, permissions, hardware acceleration, relaunch, and timer actions. It also carries events for startup, server readiness, authentication, timer state, and native window control.

This contract is shared by both applications through desktop-lib. A channel name and its payload form one cross-process contract. The renderer caller, main-process handler, and returned event must keep the same meaning.

References: packages/…/desktop-ipc.ts• L128-159 packages/…/desktop-ipc.ts• L255-287 packages/…/desktop-ipc.ts• L359-375 packages/…/desktop-ipc.ts• L500-615 packages/…/electron.service.ts• L46-103 apps/…/app.component.ts• L35-227

Native capabilities

The native layer connects tracking to capabilities that a browser page cannot provide on its own. These include screen capture, active-window access, display discovery, power and inactivity handling, notifications, tray controls, external links, local files, and updates.

The shell also protects the tracking session during state changes. It can keep work local while the server is unavailable, report offline state, stop or confirm a running timer before exit, and report macOS screen or accessibility permission state. Offline mode is reported only after the server configuration is marked connected.

References: packages/…/desktop-ipc.ts• L309-375 packages/…/desktop-ipc.ts• L500-610 packages/…/desktop-ipc.ts• L802-872 packages/…/desktop-ipc.ts• L1072-1120 apps/…/index.ts• L739-778 apps/…/index.ts• L1022-1029 apps/…/index.ts• L597-624 apps/…/index.ts• L846-853

Startup flow

Startup turns a packaged Electron process into a usable tracking client. It restores local state, chooses setup or tracking, waits for service readiness, and then exposes the normal window and desktop controls.

The diagram shows the shared startup shape and the point where the two applications differ in their visible product surface.

flowchart TD
    A[Electron process starts] --> B[Load product environment]
    B --> C[Enforce one application instance]
    C --> D[Wait for Electron ready]
    D --> E[Restore settings and local state]
    E --> F[Prepare local database]
    F --> G{Setup complete?}
    G -- No --> H[Show setup window]
    G -- Yes --> I[Start or connect to Gauzy service]
    I --> J[Create timer window]
    J --> K{Application}
    K -- Desktop --> L[Main Gauzy and tracking views]
    K -- Desktop Timer --> M[Focused tracking view]
    L --> N[Tray, IPC, updates, and desktop APIs]
    M --> N

Full desktop startup

The full desktop application shows a splash screen while it restores configuration and checks local startup state. It prepares the local database, starts the configured local service when integrated mode is selected, and creates the tracking window. When the service is ready, it starts the desktop API and timer IPC path, then connects the broader Gauzy window, tray, and update controls to the same session. Local integrated-server secrets and first-run seed credentials are prepared for that install rather than taken from shared published defaults.

References: apps/…/index.ts• L350-445 apps/…/index.ts• L636-728

Timer startup

The timer application sets its product name before it reads user data and applies hardware-acceleration settings before Electron is ready. After the ready event, it restores configuration, prepares local data, checks offline state, creates the timer window, and opens setup when no server configuration exists. Once the service is ready, it starts the desktop API and timer IPC path.

References: apps/…/index.ts• L6-24 apps/…/index.ts• L393-408 apps/…/index.ts• L489-585 apps/…/index.ts• L597-624

Packaging configuration

Packaging turns each Angular build and Electron entry point into an installable desktop product. The product package definitions set identity, platform targets, native resources, update locations, and files that must remain available outside the compressed application archive.

Product identity

The two products have separate names, application IDs, output folders, update repositories, and protocol names. Gauzy Desktop uses com.ever.gauzydesktop and gauzy-desktop. Gauzy Desktop Timer uses com.ever.gauzydesktoptimer and gauzy-timer. These values let deep links return to the correct installed product.

References: apps/…/package.json• L21-51 apps/…/package.json• L21-50 apps/…/index.ts• L197-205 apps/…/index.ts• L145-153

Platform packaging

Both products build installers for macOS, Windows, and Linux. The package settings provide platform icons, installer behavior, native-module handling, screen and media permission descriptions on macOS, and desktop integration permissions for Linux packages.

The full desktop package includes its local server data and the product's configured Gauzy feature set. Its archive rules also unpack native code and runtime resources used by screen capture, local storage, error reporting, and image handling. The timer package includes database, migration, and other runtime resources needed by its focused local runtime. Both packages unpack native modules that cannot run from inside the archive.

References: apps/…/package.json• L33-146 apps/…/package.json• L148-275 apps/…/package.json• L33-151

Build inputs

The Angular build and Electron build have separate entry concerns. The Angular project builds the renderer from src/main.ts, while the Electron TypeScript configuration emits the main entry and preload files. Custom webpack settings then keep native modules and renderer resources usable in the packaged application.

References: apps/…/tsconfig.app.json• L1-14 apps/…/tsconfig.electron.json• L1-25 apps/…/tsconfig.app.json• L1-14 apps/…/tsconfig.electron.json• L1-26 apps/…/project.json• L13-70

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep renderer IPC callers, main-process handlers, and returned event channels aligned.
  • Keep preload paths aligned with each window type and with the Electron TypeScript build inputs.
  • Keep application names, IDs, protocols, update repositories, and environment flags aligned across runtime and package metadata.
  • Keep native resources, unpacked modules, extra files, and platform permission declarations aligned with the desktop APIs that use them.
  • Keep setup, local database, server readiness, and timer-window order safe for Electron's ready state.
  • Keep integrated-server secrets, seed credentials, and the offline-state readiness check aligned with renderer startup and session states.
  • Keep single-instance and deep-link behavior aligned across Windows command-line links, macOS open-url events, and registered package protocols.
  • Keep Sentry main and renderer setup aligned when changing process startup or offline behavior.

Important failure modes

TriggerConsequenceGuard
A window uses a missing or wrong preload pathThe custom title bar and preload-side desktop behavior do not start.Keep window creation and Electron build configuration on the same product-specific preload path.
An IPC channel changes on only one sideA renderer action has no handler or receives an unexpected result.Treat channel names and payloads as shared contracts between desktop-lib and Angular callers.
A native module or required resource stays inside the archiveScreen capture, local data, or another desktop API can fail after packaging.Unpack native modules and copy required extra resources in each product package.
A product protocol or application ID is inconsistentDeep links can open the wrong product or fail to reach the installed app.Use the same product-specific values in runtime setup and package registration.
Ready-only work runs before Electron is readyNative paths, database setup, or updater registration can fail during startup.Defer those operations until the Electron ready event.
Startup reset continues after the user chooses to remove local dataThe app can use stale windows or state instead of booting cleanly.Relaunch and exit before normal database and window setup.
Integrated-server secrets or seed credentials use published defaultsA local install can share credentials or session keys with other installs.Generate and retain per-install values before starting the integrated server.
Offline state is queried before server configuration is connectedThe renderer can treat a not-ready session as online.Query offline mode only after the connection-state gate is set.
A timer window closes while the timer is activeThe user can exit before the session is safely handled.Confirm or stop the timer during main-process quit handling.
Sentry is enabled in only one processNative or renderer failures can be missing from error reports.Keep the process-aware Sentry setup and environment checks paired.

Key files

FileWhy to read it
apps/…/index.tsFull desktop lifecycle, integrated server, per-install credentials, windows, deep links, tray, desktop API, updates, and shutdown.
apps/…/index.tsTimer lifecycle, ready-state startup, focused window, protocol handling, and exit behavior.
apps/…/main.ts and apps/…/main.tsAngular renderer bootstrap, shared service groups, state persistence, error handling, and the renderer-to-desktop boundary.
apps/…/app.component.ts and apps/…/app.component.tsProduct-specific renderer events and the way each UI reacts to native startup, authentication, and timer events.
apps/…/preload.ts and apps/…/preload.tsPreload behavior for title bars, themes, menu events, and timer-specific startup hooks.
apps/…/sentry.ts and apps/…/sentry.tsError reporting across main and renderer processes, including offline event handling.
packages/…/electron.service.tsRenderer-facing abstraction for Electron IPC and desktop capability access.
packages/…/desktop-ipc.tsShared IPC contract for timer actions, capture, permissions, offline state, and native controls.
packages/…/desktop-window-timer.ts and desktop-window-setup.tsShared window roles and the boundary between native windows and Angular routes.
apps/…/package.json and apps/…/package.jsonProduct identity, installer targets, resources, permissions, update metadata, archive rules, and the Gauzy feature set bundled with each desktop product.
apps/…/tsconfig.electron.json and apps/…/tsconfig.electron.jsonMain-process and preload build inputs and output shape.