> ## 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.

# Inotify

> File and directory watching with otter-utils inotify.Watcher.

`inotify.Watcher` wraps Linux inotify for config reloads and app-list updates. Poll `getFd()` next to your Wayland socket and timer FDs.

```zig theme={null}
const inotify = @import("otter_utils").inotify;

var watcher = try inotify.Watcher.init(allocator);
defer watcher.deinit();

_ = try watcher.addWatch("/path/to/file", inotify.Watcher.Mask.file_changes);
_ = try watcher.addWatch("/path/to/dir", inotify.Watcher.Mask.dir_changes);

// After poll reports readability:
while (watcher.nextEvent()) |event| {
    if (event.isModified()) { /* reload */ }
    if (event.isCreated()) { /* rescan dir */ }
}
```

## Event helpers

| Method         | Meaning                                 |
| -------------- | --------------------------------------- |
| `isModified()` | File written and closed                 |
| `isDeleted()`  | File removed                            |
| `isCreated()`  | New file in watched directory           |
| `isMoved()`    | Rename or move                          |
| `isIgnored()`  | Watch removed (file deleted or unmount) |

`otter-conf` and `otter-desktop` both use this wrapper. Prefer importing from `otter_utils` in app code unless you need `otter-conf`'s path-indexed watcher.
