# antash-mishra/torchlight architecture

> Architecture diagram of the GitHub repository antash-mishra/torchlight, 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/antash-mishra/torchlight
- Repository: https://github.com/antash-mishra/torchlight

## Overview

Torchlight is a Linux launcher: a user invokes the GTK popup, searches apps, settings, files, folders, or open windows, then opens a result, switches to a window, or chooses a web/software action. A daemon maintains a local index using filesystem scans and change watching; the README documents this workflow and the main capabilities. The sampled excerpts show the writer’s indexing and persistence responsibilities, but do not expose the complete GTK-to-daemon request path, so those links are marked unverified.

Main entry points: [`ui/gtk/launcher.c`](https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/launcher.c) (GTK popup), [`src/service/daemon.c`](https://github.com/antash-mishra/torchlight/blob/master/src/service/daemon.c) (Daemon service), [`src/service/writer.c`](https://github.com/antash-mishra/torchlight/blob/master/src/service/writer.c) (Index writer), [`src/ipc/ipc.c`](https://github.com/antash-mishra/torchlight/blob/master/src/ipc/ipc.c) (IPC transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Launcher UI"]
  node_gtk["GTK popup<br/>[launcher.c]"]
  node_preview["Result preview<br/>[preview.c]"]
  node_windows["Window switching<br/>[windows_session.c]"]
end

subgraph group_service["Daemon and IPC"]
  node_daemon_entry["Daemon entry<br/>[torchlightd.c]"]
  node_daemon["Daemon service<br/>[daemon.c]"]
  node_ipc["IPC transport<br/>[ipc.c]"]
end

subgraph group_index["Index and search"]
  node_writer["Index writer<br/>[writer.c]"]
  node_crawl["Filesystem crawl<br/>[crawl.c]"]
  node_watch["Change watcher<br/>[watch.c]"]
  node_lexical["Local search<br/>[lexical_query.c]"]
  node_desktop["App and desktop index<br/>[desktop.c]"]
  node_semantic["Semantic search<br/>[semantic.c]"]
end

subgraph group_state["Local state"]
  node_store[("Catalog storage<br/>[store.c]")]
end

subgraph group_actions["Actions and integrations"]
  node_cli["CLI<br/>[torchlight.c]"]
  node_search_actions["Search modes<br/>[search_actions.c]"]
  node_software["Software catalog<br/>[software_catalog.c]"]
end

node_user(("User"))
node_browser["System browser"]
node_software_center["Software center"]

node_user -->|"invokes"| node_gtk
node_gtk -.->|"requests search"| node_ipc
node_ipc -.->|"dispatches requests"| node_daemon
node_daemon_entry -.->|"starts service"| node_daemon
node_daemon -->|"uses semantic search"| node_semantic
node_daemon -->|"uses app catalog"| node_software
node_writer -->|"scans roots"| node_crawl
node_writer -->|"uses change events"| node_watch
node_writer -->|"persists batches"| node_store
node_store -->|"stores crawl entries"| node_crawl
node_user -->|"runs searches"| node_cli
node_cli -.->|"sends requests"| node_ipc
node_user -->|"types query"| node_gtk
node_gtk -->|"shows selection"| node_preview
node_gtk -.->|"switches windows"| node_windows
node_user -->|"chooses web action"| node_search_actions
node_search_actions -.->|"opens search"| node_browser
node_user -->|"confirms install"| node_software_center
node_software -.->|"offers app page"| node_software_center
node_user -->|"searches local items"| node_lexical
node_user -->|"searches apps"| node_desktop
node_user -.->|"searches semantically"| node_semantic

click node_gtk "https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/launcher.c"
click node_preview "https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/preview.c"
click node_windows "https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/windows_session.c"
click node_cli "https://github.com/antash-mishra/torchlight/blob/master/src/bin/torchlight.c"
click node_daemon_entry "https://github.com/antash-mishra/torchlight/blob/master/src/bin/torchlightd.c"
click node_daemon "https://github.com/antash-mishra/torchlight/blob/master/src/service/daemon.c"
click node_ipc "https://github.com/antash-mishra/torchlight/blob/master/src/ipc/ipc.c"
click node_writer "https://github.com/antash-mishra/torchlight/blob/master/src/service/writer.c"
click node_crawl "https://github.com/antash-mishra/torchlight/blob/master/src/fs/crawl.c"
click node_watch "https://github.com/antash-mishra/torchlight/blob/master/src/fs/watch.c"
click node_lexical "https://github.com/antash-mishra/torchlight/blob/master/src/index/lexical_query.c"
click node_desktop "https://github.com/antash-mishra/torchlight/blob/master/src/index/desktop.c"
click node_semantic "https://github.com/antash-mishra/torchlight/blob/master/src/service/semantic.c"
click node_store "https://github.com/antash-mishra/torchlight/blob/master/src/storage/store.c"
click node_search_actions "https://github.com/antash-mishra/torchlight/blob/master/src/service/search_actions.c"
click node_software "https://github.com/antash-mishra/torchlight/blob/master/src/service/software_catalog.c"

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_gtk,node_preview,node_windows,node_user,node_browser toneBlue
class node_daemon_entry,node_daemon,node_ipc toneAmber
class node_writer,node_crawl,node_watch,node_lexical,node_desktop,node_semantic toneMint
class node_store toneRose
class node_cli,node_search_actions,node_software,node_software_center toneIndigo
```

## Components

### Launcher UI

- [GTK popup](https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/launcher.c): `ui/gtk/launcher.c`
- [Result preview](https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/preview.c): `ui/gtk/preview.c`
- [Window switching](https://github.com/antash-mishra/torchlight/blob/master/ui/gtk/windows_session.c): `ui/gtk/windows_session.c`

### Daemon and IPC

- [Daemon entry](https://github.com/antash-mishra/torchlight/blob/master/src/bin/torchlightd.c): `src/bin/torchlightd.c`
- [Daemon service](https://github.com/antash-mishra/torchlight/blob/master/src/service/daemon.c): `src/service/daemon.c`
- [IPC transport](https://github.com/antash-mishra/torchlight/blob/master/src/ipc/ipc.c): `src/ipc/ipc.c`

### Index and search

- [Index writer](https://github.com/antash-mishra/torchlight/blob/master/src/service/writer.c): `src/service/writer.c`
- [Filesystem crawl](https://github.com/antash-mishra/torchlight/blob/master/src/fs/crawl.c): `src/fs/crawl.c`
- [Change watcher](https://github.com/antash-mishra/torchlight/blob/master/src/fs/watch.c): `src/fs/watch.c`
- [Local search](https://github.com/antash-mishra/torchlight/blob/master/src/index/lexical_query.c): `src/index/lexical_query.c`
- [App and desktop index](https://github.com/antash-mishra/torchlight/blob/master/src/index/desktop.c): `src/index/desktop.c`
- [Semantic search](https://github.com/antash-mishra/torchlight/blob/master/src/service/semantic.c): `src/service/semantic.c`

### Local state

- [Catalog storage](https://github.com/antash-mishra/torchlight/blob/master/src/storage/store.c): `src/storage/store.c`

### Actions and integrations

- [CLI](https://github.com/antash-mishra/torchlight/blob/master/src/bin/torchlight.c): `src/bin/torchlight.c`
- [Search modes](https://github.com/antash-mishra/torchlight/blob/master/src/service/search_actions.c): `src/service/search_actions.c`
- [Software catalog](https://github.com/antash-mishra/torchlight/blob/master/src/service/software_catalog.c): `src/service/software_catalog.c`

### Other components

- **User**
- **System browser**
- **Software center**

## Connections

- User → GTK popup: invokes (evidence: `README.md`)
- GTK popup → IPC transport: requests search
- IPC transport → Daemon service: dispatches requests
- Daemon entry → Daemon service: starts service
- Daemon service → Semantic search: uses semantic search (evidence: `src/service/daemon.c`)
- Daemon service → Software catalog: uses app catalog (evidence: `src/service/daemon.c`)
- Index writer → Filesystem crawl: scans roots (evidence: `src/service/writer.c`)
- Index writer → Change watcher: uses change events (evidence: `src/service/writer.c`)
- Index writer → Catalog storage: persists batches (evidence: `src/service/writer.c`)
- Catalog storage → Filesystem crawl: stores crawl entries (evidence: `src/storage/store.c`)
- User → CLI: runs searches (evidence: `README.md`)
- CLI → IPC transport: sends requests
- User → GTK popup: types query (evidence: `README.md`)
- GTK popup → Result preview: shows selection
- GTK popup → Window switching: switches windows
- User → Search modes: chooses web action (evidence: `README.md`)
- Search modes → System browser: opens search
- User → Software center: confirms install (evidence: `README.md`)
- Software catalog → Software center: offers app page
- User → Local search: searches local items (evidence: `README.md`)
- User → App and desktop index: searches apps (evidence: `README.md`)
- User → Semantic search: searches semantically
