# wayclip/daemon architecture

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

- Interactive diagram: https://gitdiagram.com/wayclip/daemon
- Repository: https://github.com/wayclip/daemon

## Overview

Wayclip Daemon is a background screen-recording service, also usable as a standalone recorder. Its primary workflow accepts a save request over D-Bus IPC, routes it through the daemon core, and records through the Linux capture engine into a rolling encoded-frame buffer for clip saving. Supporting branches cover preview generation, recovery, game discovery, key bindings, tray controls, and Discord presence. The sampled excerpts establish the main orchestration and capture links; some subsystem links rely on the SOURCE INDEX or README, so uncertain wiring is omitted.

Main entry points: [`src/linux/engine/gstreamer/mod.rs`](https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/mod.rs) (GStreamer Engine), [`src/linux/services/mod.rs`](https://github.com/wayclip/daemon/blob/main/src/linux/services/mod.rs) (Service Manager), [`src/linux/mod.rs`](https://github.com/wayclip/daemon/blob/main/src/linux/mod.rs) (Daemon Core), [`src/linux/ipc/server.rs`](https://github.com/wayclip/daemon/blob/main/src/linux/ipc/server.rs) (D-Bus Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_daemon["Daemon Control"]
  node_daemon_core["Daemon Core<br/>[mod.rs]"]
  node_ipc_server["D-Bus Server<br/>[server.rs]"]
  node_ipc_commands["IPC Commands<br/>[commands.rs]"]
  node_recovery["Recovery<br/>[recovery.rs]"]
end

subgraph group_capture["Recording Pipeline"]
  node_engine["Capture Engine<br/>[mod.rs]"]
  node_pipewire["PipeWire Capture<br/>[mod.rs]"]
  node_gst_engine["GStreamer Engine<br/>[mod.rs]"]
  node_video_processing["Video Processing"]
  node_audio_device["Audio Devices<br/>[device.rs]"]
  node_save_mux["Clip Muxing<br/>[save.rs]"]
end

subgraph group_services["User Services"]
  node_services["Service Manager<br/>[mod.rs]"]
  node_discovery["Game Discovery<br/>[mod.rs]"]
  node_process_scan["Process Scanner<br/>[procs.rs]"]
  node_steam_scan["Steam Discovery<br/>[steam.rs]"]
  node_game_db[("Game Database<br/>[db.rs]")]
  node_window_focus["Window Focus<br/>[focus.rs]"]
  node_keybinds["Key Bindings<br/>[desktop.rs]"]
  node_controller["Controller Input<br/>[controller.rs]"]
  node_tray["Tray Controls<br/>[tray.rs]"]
  node_discord["Discord Presence<br/>[mod.rs]"]
end

subgraph group_shared["Shared Media"]
  node_ring[("Rolling Buffer<br/>[mod.rs]")]
  node_frame_data["Encoded Frames<br/>[data.rs]"]
  node_gst_app["App Source/Sink<br/>[app.rs]"]
  node_gst_helpers["GStreamer Helpers"]
  node_preview["Preview Generator<br/>[preview.rs]"]
end

node_cli(("wayclip-cli"))
node_wayland(("Wayland Portal"))
node_pipewire_service(("PipeWire Service"))
node_discord_client(("Discord Client"))

node_cli -.->|"controls"| node_ipc_server
node_ipc_server -->|"sends commands"| node_ipc_commands
node_ipc_server -->|"routes requests"| node_daemon_core
node_daemon_core -->|"sets up"| node_engine
node_daemon_core -->|"starts services"| node_services
node_daemon_core -.->|"uses recovery"| node_recovery
node_engine -->|"starts capture"| node_pipewire
node_engine -->|"starts pipeline"| node_gst_engine
node_pipewire -.->|"requests screencast"| node_wayland
node_pipewire -.->|"captures stream"| node_pipewire_service
node_gst_engine -->|"builds pipeline"| node_gst_helpers
node_gst_engine -->|"attaches sinks"| node_gst_app
node_gst_engine -->|"stores frames"| node_ring
node_gst_engine -->|"builds video branch"| node_video_processing
node_gst_engine -.->|"builds audio branch"| node_audio_device
node_gst_engine -.->|"uses clip saving"| node_save_mux
node_ring -->|"stores frames"| node_frame_data
node_gst_app -->|"pushes encoded frames"| node_frame_data
node_preview -->|"builds preview pipeline"| node_gst_helpers
node_services -->|"updates discovery"| node_discovery
node_services -->|"sets up key bindings"| node_keybinds
node_services -->|"starts tray"| node_tray
node_services -->|"updates presence"| node_discord
node_discovery -->|"scans processes"| node_process_scan
node_discovery -->|"checks focused window"| node_window_focus
node_process_scan -.->|"checks Steam games"| node_steam_scan
node_process_scan -.->|"uses game data"| node_game_db
node_controller -->|"sends save command"| node_ipc_commands
node_tray -.->|"uses commands"| node_ipc_commands
node_discord -.->|"publishes presence"| node_discord_client

click node_daemon_core "https://github.com/wayclip/daemon/blob/main/src/linux/mod.rs"
click node_ipc_server "https://github.com/wayclip/daemon/blob/main/src/linux/ipc/server.rs"
click node_ipc_commands "https://github.com/wayclip/daemon/blob/main/src/linux/ipc/commands.rs"
click node_recovery "https://github.com/wayclip/daemon/blob/main/src/linux/recovery.rs"
click node_engine "https://github.com/wayclip/daemon/blob/main/src/linux/engine/mod.rs"
click node_pipewire "https://github.com/wayclip/daemon/blob/main/src/linux/engine/pipewire/mod.rs"
click node_gst_engine "https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/mod.rs"
click node_video_processing "https://github.com/wayclip/daemon/tree/main/src/linux/engine/gstreamer/video"
click node_audio_device "https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/audio/device.rs"
click node_save_mux "https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/save.rs"
click node_ring "https://github.com/wayclip/daemon/blob/main/src/common/video/ring/mod.rs"
click node_frame_data "https://github.com/wayclip/daemon/blob/main/src/common/video/ring/data.rs"
click node_gst_app "https://github.com/wayclip/daemon/blob/main/src/common/gst/app.rs"
click node_gst_helpers "https://github.com/wayclip/daemon/tree/main/src/common/gst"
click node_preview "https://github.com/wayclip/daemon/blob/main/src/common/video/preview.rs"
click node_services "https://github.com/wayclip/daemon/blob/main/src/linux/services/mod.rs"
click node_discovery "https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/mod.rs"
click node_process_scan "https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/procs.rs"
click node_steam_scan "https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/steam.rs"
click node_game_db "https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/db.rs"
click node_window_focus "https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/focus.rs"
click node_keybinds "https://github.com/wayclip/daemon/blob/main/src/linux/services/keybinds/desktop.rs"
click node_controller "https://github.com/wayclip/daemon/blob/main/src/linux/services/keybinds/controller.rs"
click node_tray "https://github.com/wayclip/daemon/blob/main/src/linux/services/tray.rs"
click node_discord "https://github.com/wayclip/daemon/blob/main/src/common/misc/discord/mod.rs"

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_daemon_core,node_ipc_server,node_ipc_commands,node_recovery,node_discord_client toneBlue
class node_engine,node_pipewire,node_gst_engine,node_video_processing,node_audio_device,node_save_mux toneAmber
class node_services,node_discovery,node_process_scan,node_steam_scan,node_game_db,node_window_focus,node_keybinds,node_controller,node_tray,node_discord toneMint
class node_ring,node_frame_data,node_gst_app,node_gst_helpers,node_preview toneRose
class node_cli,node_wayland,node_pipewire_service toneIndigo
```

## Components

### Daemon Control

- [Daemon Core](https://github.com/wayclip/daemon/blob/main/src/linux/mod.rs): `src/linux/mod.rs`
- [D-Bus Server](https://github.com/wayclip/daemon/blob/main/src/linux/ipc/server.rs): `src/linux/ipc/server.rs`
- [IPC Commands](https://github.com/wayclip/daemon/blob/main/src/linux/ipc/commands.rs): `src/linux/ipc/commands.rs`
- [Recovery](https://github.com/wayclip/daemon/blob/main/src/linux/recovery.rs): `src/linux/recovery.rs`

### Recording Pipeline

- [Capture Engine](https://github.com/wayclip/daemon/blob/main/src/linux/engine/mod.rs): `src/linux/engine/mod.rs`
- [PipeWire Capture](https://github.com/wayclip/daemon/blob/main/src/linux/engine/pipewire/mod.rs): `src/linux/engine/pipewire/mod.rs`
- [GStreamer Engine](https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/mod.rs): `src/linux/engine/gstreamer/mod.rs`
- [Video Processing](https://github.com/wayclip/daemon/tree/main/src/linux/engine/gstreamer/video): `src/linux/engine/gstreamer/video`
- [Audio Devices](https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/audio/device.rs): `src/linux/engine/gstreamer/audio/device.rs`
- [Clip Muxing](https://github.com/wayclip/daemon/blob/main/src/linux/engine/gstreamer/save.rs): `src/linux/engine/gstreamer/save.rs`

### User Services

- [Service Manager](https://github.com/wayclip/daemon/blob/main/src/linux/services/mod.rs): `src/linux/services/mod.rs`
- [Game Discovery](https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/mod.rs): `src/linux/services/discovery/mod.rs`
- [Process Scanner](https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/procs.rs): `src/linux/services/discovery/procs.rs`
- [Steam Discovery](https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/steam.rs): `src/linux/services/discovery/steam.rs`
- [Game Database](https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/db.rs): `src/linux/services/discovery/db.rs`
- [Window Focus](https://github.com/wayclip/daemon/blob/main/src/linux/services/discovery/focus.rs): `src/linux/services/discovery/focus.rs`
- [Key Bindings](https://github.com/wayclip/daemon/blob/main/src/linux/services/keybinds/desktop.rs): `src/linux/services/keybinds/desktop.rs`
- [Controller Input](https://github.com/wayclip/daemon/blob/main/src/linux/services/keybinds/controller.rs): `src/linux/services/keybinds/controller.rs`
- [Tray Controls](https://github.com/wayclip/daemon/blob/main/src/linux/services/tray.rs): `src/linux/services/tray.rs`
- [Discord Presence](https://github.com/wayclip/daemon/blob/main/src/common/misc/discord/mod.rs): `src/common/misc/discord/mod.rs`

### Shared Media

- [Rolling Buffer](https://github.com/wayclip/daemon/blob/main/src/common/video/ring/mod.rs): `src/common/video/ring/mod.rs`
- [Encoded Frames](https://github.com/wayclip/daemon/blob/main/src/common/video/ring/data.rs): `src/common/video/ring/data.rs`
- [App Source/Sink](https://github.com/wayclip/daemon/blob/main/src/common/gst/app.rs): `src/common/gst/app.rs`
- [GStreamer Helpers](https://github.com/wayclip/daemon/tree/main/src/common/gst): `src/common/gst`
- [Preview Generator](https://github.com/wayclip/daemon/blob/main/src/common/video/preview.rs): `src/common/video/preview.rs`

### Other components

- **wayclip-cli**
- **Wayland Portal**
- **PipeWire Service**
- **Discord Client**

## Connections

- wayclip-cli → D-Bus Server: controls
- D-Bus Server → IPC Commands: sends commands (evidence: `src/linux/ipc/server.rs`)
- D-Bus Server → Daemon Core: routes requests (evidence: `src/linux/ipc/server.rs`)
- Daemon Core → Capture Engine: sets up (evidence: `src/linux/mod.rs`)
- Daemon Core → Service Manager: starts services (evidence: `src/linux/mod.rs`)
- Daemon Core → Recovery: uses recovery (evidence: `src/linux/mod.rs`)
- Capture Engine → PipeWire Capture: starts capture (evidence: `src/linux/engine/mod.rs`)
- Capture Engine → GStreamer Engine: starts pipeline (evidence: `src/linux/engine/mod.rs`)
- PipeWire Capture → Wayland Portal: requests screencast
- PipeWire Capture → PipeWire Service: captures stream
- GStreamer Engine → GStreamer Helpers: builds pipeline (evidence: `src/linux/engine/gstreamer/mod.rs`)
- GStreamer Engine → App Source/Sink: attaches sinks (evidence: `src/linux/engine/gstreamer/mod.rs`)
- GStreamer Engine → Rolling Buffer: stores frames (evidence: `src/linux/engine/gstreamer/mod.rs`)
- GStreamer Engine → Video Processing: builds video branch (evidence: `src/linux/engine/gstreamer/mod.rs`)
- GStreamer Engine → Audio Devices: builds audio branch (evidence: `src/linux/engine/gstreamer/mod.rs`)
- GStreamer Engine → Clip Muxing: uses clip saving (evidence: `src/linux/engine/gstreamer/mod.rs`)
- Rolling Buffer → Encoded Frames: stores frames (evidence: `src/common/video/ring/mod.rs`)
- App Source/Sink → Encoded Frames: pushes encoded frames (evidence: `src/common/gst/app.rs`)
- Preview Generator → GStreamer Helpers: builds preview pipeline (evidence: `src/common/video/preview.rs`)
- Service Manager → Game Discovery: updates discovery (evidence: `src/linux/services/mod.rs`)
- Service Manager → Key Bindings: sets up key bindings (evidence: `src/linux/services/mod.rs`)
- Service Manager → Tray Controls: starts tray (evidence: `src/linux/services/mod.rs`)
- Service Manager → Discord Presence: updates presence (evidence: `src/linux/services/mod.rs`)
- Game Discovery → Process Scanner: scans processes (evidence: `src/linux/services/discovery/mod.rs`)
- Game Discovery → Window Focus: checks focused window (evidence: `src/linux/services/discovery/mod.rs`)
- Process Scanner → Steam Discovery: checks Steam games (evidence: `src/linux/services/discovery/procs.rs`)
- Process Scanner → Game Database: uses game data (evidence: `src/linux/services/discovery/procs.rs`)
- Controller Input → IPC Commands: sends save command (evidence: `src/linux/services/keybinds/controller.rs`)
- Tray Controls → IPC Commands: uses commands (evidence: `src/linux/services/tray.rs`)
- Discord Presence → Discord Client: publishes presence
