Desktop Applications (Agent & Timer)
Relevant source files
The following files were used as context for generating this wiki page:
The Ever Gauzy platform includes several cross-platform desktop applications for Windows, macOS, and Linux, built using Electron. These applications extend the platform's functionality to the desktop, primarily focusing on time and activity tracking, but also offering a full-featured, self-contained version of the platform.
The main desktop applications are:
- Ever® Gauzy™ Desktop App: An all-in-one application that bundles the Gauzy frontend (UI), a local API server, and an SQLite database. It can run standalone or connect to a remote Gauzy server.
- Ever® Gauzy™ Desktop Timer App: A lightweight application focused solely on time and activity tracking for employees. It must connect to a Gauzy server instance (local or remote).
- Gauzy Agent: A minimal agent for activity tracking, designed to run in the background.
- Ever® Gauzy™ MCP Server: A desktop application to manage and monitor the Gauzy Model Context Protocol (MCP) server, enabling integration with AI assistants.
Sources: README.md, apps/desktop/src/package.json, apps/desktop-timer/src/package.json, apps/agent/src/package.json, packages/mcp-server/README.md
Architecture Overview
All desktop applications are built on the Electron framework, allowing them to run on multiple operating systems. They share a common set of core packages, such as @gauzy/desktop-core, @gauzy/desktop-lib, and @gauzy/desktop-activity, which provide shared functionality for database access, UI components, activity tracking, and more.
The diagram below illustrates the high-level architecture of the desktop applications.
This diagram shows the interaction between the Electron main process, the renderer process (UI), and various shared and local services.
Sources: apps/desktop/src/index.ts, apps/desktop-timer/src/index.ts, apps/desktop/src/package.json
Application Variants
The repository contains several desktop application variants, each tailored for a specific use case.
| Application | Product Name | App ID | Purpose | Key Components |
|---|---|---|---|---|
gauzy-desktop | Ever Gauzy Desktop | com.ever.gauzydesktop | All-in-one desktop experience with optional local server. | Full Gauzy UI, Local API Server, SQLite DB |
gauzy-desktop-timer | Gauzy Desktop Timer | com.ever.gauzydesktoptimer | Lightweight time and activity tracking for employees. | Timer UI, Activity Tracking |
gauzy-agent | Gauzy Agent | com.ever.gauzyagent | Minimal, background agent for activity monitoring. | Activity Tracking, No main UI |
gauzy-mcp-server | Ever Gauzy MCP Server | com.ever.gauzymcpserver | Manages and monitors the MCP server for AI assistant integration. | MCP Server, Management UI |
Sources: apps/desktop/src/package.json:2,21, apps/desktop-timer/src/package.json:2,10, apps/agent/src/package.json:2,20, apps/server-mcp/src/package.json:2,24
Startup and Initialization
The application startup process is handled in the main index.ts file for each Electron app. It follows a sequence of initialization steps to prepare the application environment, windows, and services.
The following diagram illustrates the startup flow for the Gauzy Desktop and Gauzy Desktop Timer applications.
This sequence shows the key steps from application launch to the UI being ready for user interaction.
Sources: apps/desktop/src/index.ts:310-421, apps/desktop-timer/src/index.ts:211-305
Key Initialization Steps
- Single Instance Lock: Ensures only one instance of the application is running.
Sources: apps/desktop/src/index.ts:208-223 - Environment Setup: Sets process environment variables, including
GAUZY_USER_PATHfor application data storage.
Sources: apps/desktop/src/index.ts:72-74 - Error Handling: Configures
electron-logto catch unhandled exceptions and integrates Sentry for error reporting.
Sources: apps/desktop/src/index.ts:153-182, apps/desktop-timer/src/index.ts:121-150 - Database Initialization: Uses
knexvia@gauzy/desktop-lib'sProviderFactoryto create the SQLite database and run migrations if necessary. The journal mode is set toWALfor better performance.
Sources: apps/desktop/src/index.ts:333-344, apps/desktop-timer/src/index.ts:234-245 - Window Creation: Creates various
BrowserWindowinstances for the splash screen, setup, main UI, settings, etc., using helpers from@gauzy/desktop-window.
Sources: apps/desktop/src/indexts:354-421, apps/desktop-timer/src/index.ts:253-305 - Server Management: If configured to use a local server, the
DesktopServerclass forks a new process to run the Gauzy API.
Sources: apps/desktop/src/index.ts:259-271 - IPC Handling: Sets up IPC listeners (
ipcMainHandler,ipcTimer) to facilitate communication between the main and renderer processes for tasks like authentication, settings changes, and timer actions.
Sources: apps/desktop/src/index.ts:430-432, apps/desktop-timer/src/index.ts:442-458
Core Features & Modules
Activity Tracking
Activity tracking is a central feature, handled by the @gauzy/desktop-activity package. This package uses uiohook-napi to capture keyboard and mouse events to measure user activity levels.
Sources: packages/desktop-activity/package.json:26
Local Data and Configuration
Configuration is managed using electron-store. Settings are stored in the user's application data directory. This includes server connection details, window positions, and application behavior settings.
- Data Path:
app.getPath('userData')(e.g.,C:\Users\USERNAME\AppData\Roaming\gauzy-desktop) - Database File:
gauzy.sqlite3within the user data path.
Sources: apps/desktop/src/index.ts:72-75, apps/desktop-timer/src/index.ts:49-52
Auto-Updates
The applications use electron-updater to handle automatic updates. The DesktopUpdater class from @gauzy/desktop-lib encapsulates the logic for checking for and applying updates. The update process can be triggered, and the application can be restarted via IPC events.
restart_and_updateIPC event: TriggersautoUpdater.quitAndInstall().
Sources: apps/desktop/src/index.ts:544-556, apps/desktop/src/package.json:96
Local API and Services
The gauzy-desktop application can run a self-contained Gauzy API server.
- API Server: Forked as a separate Node.js process from
api/main.js. TheDesktopServerclass manages its lifecycle. - Desktop API (gRPC): A gRPC-based microservice is also forked (
desktop-api/main.js) to handle specific desktop-related integrations, such as with WakaTime.
This architecture allows the main Electron process to remain responsive while the API handles data processing.
Sources: apps/desktop/src/index.ts:259-271, 442-444, apps/desktop-api/package.json
Build and Packaging
The applications are packaged for distribution using electron-builder. The build configuration is defined in the build section of each application's package.json file.
Key build configurations include:
appId: Unique identifier for the application.artifactName: Naming convention for the output files.directories: Specifies output and resource directories.publish: Configuration for publishing releases to providers like GitHub and DigitalOcean Spaces.- OS-specific settings (
mac,win,linux): Defines icons, targets (e.g.,dmg,nsis,AppImage), and code-signing/notarization details. asarUnpack: Specifies native modules that need to be unpacked from the ASAR archive, such asbetter-sqlite3and@sentry/electron.
Sources: apps/desktop/src/package.json:20-111, apps/desktop-timer/src/package.json:29-130, apps/agent/src/package.json:20-111