# io.github.libtmux.control.Notification.Notification

- **Module:** io.github.libtmux.control.Notification
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** interface
- **Source:** https://github.com/libtmux/libtmux-java/blob/842228310449e879ebcaa3f910597757c9dbffd6/libtmux/src/main/java/io/github/libtmux/control/Notification.java#L28
- **Page:** https://libtmux.org/en/java/latest/reference/io-github-libtmux-control-notification-notification/

What a control-mode notification says, typed, for matching on.

Sealed, with {@link Unknown} as the case for everything else. tmux adds notifications between
releases, and a closed set with nowhere to put a new one would drop it; here a notification this
library does not model yet still arrives, as {@code Unknown}, and {@link ControlEvent#kind()} and
{@link ControlEvent#fields()} still carry what tmux wrote.

The forms are tmux's own, from {@code control-notify.c}. A name — of a window, a session, a
client — is everything after the id, spaces included, as tmux writes it.

## Example

```java
switch (event.notification()) {
case Notification.WindowRenamed(WindowId window, String name, boolean attached) -> relabel(window, name);
case Notification.SessionsChanged changed -> refreshSessions();
default -> {}
}
```

## Members

- `WindowAdded` (struct): {@code %window-add}: a window was created; {@code attached} is false for {@code unlinked-window-add}.
- `WindowClosed` (struct): {@code %window-close}: a window was destroyed; {@code attached} as for {@link WindowAdded}.
- `WindowRenamed` (struct): {@code %window-renamed}: a window has a new name; {@code attached} as for {@link WindowAdded}.
- `WindowPaneChanged` (struct): {@code %window-pane-changed}: a window's active pane changed.
- `LayoutChanged` (struct): {@code %layout-change}: a window's layout changed, in whichever form tmux reports it.
- `SessionChanged` (struct): {@code %session-changed}: the attached client is now attached to this session.
- `SessionRenamed` (struct): {@code %session-renamed}: a session has a new name.
- `SessionsChanged` (struct): {@code %sessions-changed}: a session was created or destroyed.
- `SessionWindowChanged` (struct): {@code %session-window-changed}: a session's current window changed.
- `ClientSessionChanged` (struct): {@code %client-session-changed}: another client is now attached to this session.
- `ClientDetached` (struct): {@code %client-detached}: a client detached.
- `PaneModeChanged` (struct): {@code %pane-mode-changed}: a pane entered or left a mode.
- `PasteBufferChanged` (struct): {@code %paste-buffer-changed}: a paste buffer was created or changed.
- `PasteBufferDeleted` (struct): {@code %paste-buffer-deleted}: a paste buffer was deleted.
- `SubscriptionChanged` (struct): {@code %subscription-changed}: a watched format has a new value.
- `Exit` (struct): {@code %exit}: the client is exiting, with tmux's reason when it gave one.
- `Unknown` (struct): A notification this library does not model; {@link ControlEvent} still carries all of it.
- `read` (method): Reads one notification from its kind and the text after it.
