> ## Documentation Index
> Fetch the complete documentation index at: https://docs.otter-shell.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Hot reload

> hasChanged, Watcher, and event-loop integration for otter-conf.

Watch config files with `hasChanged` polling or an inotify `Watcher`.

## Modification time check

```zig theme={null}
const result = try otter_conf.loadWithMetadata(Config, allocator, path, .{});
const last_mtime = result.mtime_ns;

if (try otter_conf.hasChanged(path, last_mtime)) {
    // reload
}
```

## Watcher

```zig theme={null}
var watcher = try otter_conf.Watcher.init(allocator);
defer watcher.deinit();

_ = try watcher.addWatch(allocator, path);

// Poll watcher.getFd() with Wayland:
while (watcher.nextEvent()) |event| {
    if (event.isModified()) {
        config = try otter_conf.load(Config, allocator, path, .{});
    }
}
```

Event helpers match `otter-utils` inotify: `isModified`, `isDeleted`, `isCreated`, `isMoved`, `isIgnored`.

## Imports and multiple paths

When using `loadWithImports`, `result.paths` lists every file touched. Watch all of them or watch directories that contain imported fragments.

```zig theme={null}
var res = try otter_conf.loadWithImports(Config, gpa, path, .{});
defer res.deinit(gpa);
// res.config, res.paths
```

## Thread safety

Parsers are not thread-safe on the same buffer. Load once per file, then share the resulting struct read-only across threads.
