# io.github.libtmux.control.ControlClient.ControlClient.watch

- **Module:** io.github.libtmux.control.ControlClient.ControlClient
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-java/blob/c3517519ee799428a809ce6deb1708c8be289cd1/libtmux/src/main/java/io/github/libtmux/control/ControlClient.java#L217
- **Page:** https://libtmux.org/reference/java/io-github-libtmux-control-controlclient-controlclient-watch/

```
io.github.libtmux.control.ControlClient.ControlClient.watch(name: String, target: String, format: String) -> ControlReply
```

Asks tmux to report a format whenever its value changes.

<p>tmux re-expands the format about once a second and writes a {@code subscription-changed}
event only when the result differs from last time, so the comparison happens in the server and
a client that subscribes does nothing at all between changes. This is what makes watching a
server cost nothing while it is idle.

## Parameters

- `name` (String) — what to call it; registering the same name again replaces the old one
- `target` (String) — {@code %*} for every pane, {@code @*} for every window, a specific {@code %id} or {@code @id}, or anything else for the attached session
- `format` (String) — a tmux format, such as {@code #{pane_current_command}}
