# Bildirimler

cmux, AI ajanlarının ve betiklerin dikkat istediklerinde sizi uyarmasına olanak tanıyan masaüstü bildirimlerini destekler.

## Yaşam döngüsü

1.  Alındı: bildirim panelde görünür, masaüstü uyarısı tetiklenir (bastırılmamışsa)
2.  Okunmamış: çalışma alanı sekmesinde rozet gösterilir
3.  Okundu: o çalışma alanını görüntülediğinizde temizlenir
4.  Temizlendi: panelden kaldırıldı

### Bastırma

Masaüstü uyarıları şu durumlarda bastırılır:

-   cmux penceresi odaklandığında
-   Bildirimi gönderen belirli çalışma alanı aktif olduğunda
-   Bildirim paneli açık olduğunda

### Bildirim paneli

Bildirim panelini açmak için `⌘⇧I` tuşuna basın. Bir bildirime tıklayarak o çalışma alanına atlayın. En son okunmamış bildirime sahip çalışma alanına doğrudan atlamak için `⌘⇧U` tuşuna basın.

## Özel komut

Her bildirim zamanlandığında bir shell komutu çalıştırın. Ayarlar > Uygulama > Bildirim Komutu'nda ayarlayın. Komut şu ortam değişkenleriyle /bin/sh -c aracılığıyla çalışır:

| Değişken | Açıklama |
| --- | --- |
| `CMUX_NOTIFICATION_TITLE` | Bildirim başlığı (çalışma alanı adı veya uygulama adı) |
| `CMUX_NOTIFICATION_SUBTITLE` | Bildirim alt başlığı |
| `CMUX_NOTIFICATION_BODY` | Bildirim gövde metni |

Examples

```
# Text-to-speech
say "$CMUX_NOTIFICATION_TITLE"

# Custom sound file
afplay /path/to/sound.aiff

# Log to file
echo "$CMUX_NOTIFICATION_TITLE: $CMUX_NOTIFICATION_BODY" >> ~/notifications.log
```

Komut, sistem ses seçicisinden bağımsız olarak çalışır. Yalnızca özel komutu kullanmak için seçiciyi "Yok" olarak ayarlayın veya bir sistem sesi artı özel bir eylem için her ikisini de tutun.

## Bildirim hookları

`cmux.json`, her bildirim politikasını stdin üzerinden JSON olarak alan bildirim hookları tanımlayabilir. Her hook stdout üzerinden JSON döndürür. Hooklar varsayılan olarak kapalıdır; cmux bunları yalnızca `notifications.hooks` içinde en az bir etkin hook olduğunda çalıştırır. cmux dönen bildirim metnini ve etkileri uygular; böylece hooklar bannerları filtreleyebilir, kenar çubuğu geçmişini tutabilir veya atlayabilir, ses çalıştırabilir ya da sonraki hookları durdurabilir.

cmux.json

```
{
  "notifications": {
    "hooks": [
      {
        "id": "quiet-docs",
        "command": "sed 's/"desktop":true/"desktop":false/'",
        "timeoutSeconds": 20
      }
    ]
  }
}
```

Hook girişi ve çıkışı

```
{
  "version": 1,
  "notification": {
    "workspaceId": "3B3F0D83-...",
    "surfaceId": "7E9C1A02-...",
    "title": "Codex",
    "subtitle": "Waiting",
    "body": "Agent needs input"
  },
  "context": {
    "cwd": "/path/to/project",
    "configPath": "/path/to/project/.cmux/cmux.json",
    "hookId": "quiet-docs",
    "appFocused": false,
    "focusedPanel": false
  },
  "agent": {
    "kind": "claude",
    "category": "turn-complete",
    "pending": false,
    "isSubagent": true
  },
  "effects": {
    "record": true,
    "markUnread": true,
    "reorderWorkspace": true,
    "desktop": true,
    "sound": true,
    "command": true,
    "paneFlash": true
  }
}
```

Hooklar global `~/.config/cmux/cmux.json` dosyasından ve üst dizinlerden geçerli workspace’e kadar olan proje `.cmux/cmux.json` dosyalarından miras alınır. Proje hookları, çalışmadan önce diğer proje `cmux.json` komutlarıyla aynı güven istemini kullanır. Feed onay bannerları da bu hooklardan geçer; `desktop` devre dışı bırakılırsa yerel banner bastırılır ve Feed öğesi cmux içinde kullanılabilir kalır. Miras alınan hookları yok saymak için proje yapılandırmasında `notifications.hooksMode` değerini `replace` yapın. Bir hook başarısız olursa, zaman aşımına uğrarsa veya geçersiz JSON döndürürse cmux varsayılan bildirim davranışını kullanır ve hook hatası uyarısı gösterir.

### Agent-event context

Notifications that originate from an agent completion signal carry a read-only `agent` object: `kind` is the stable lowercase agent slug (claude, codex, grok, …), `category` is turn-complete, needs-permission, or idle-reminder, `pending` is true when the turn ended with background work still running, and `isSubagent` is true for nested subagent sessions. The object is omitted for non-agent notifications, and the same values are exported to the hook process as CMUX\_NOTIFICATION\_AGENT\_KIND, CMUX\_NOTIFICATION\_AGENT\_CATEGORY, CMUX\_NOTIFICATION\_AGENT\_PENDING, and CMUX\_NOTIFICATION\_AGENT\_IS\_SUBAGENT. For example, this hook silences the banner, sound, and pane flash for subagent completions while leaving everything else untouched:

Silence subagent completions

```
{
  "notifications": {
    "hooks": [
      {
        "id": "mute-subagent-completions",
        "command": "if [ \"${CMUX_NOTIFICATION_AGENT_IS_SUBAGENT-0}\" = \"1\" ] && [ \"$CMUX_NOTIFICATION_AGENT_CATEGORY\" = \"turn-complete\" ]; then printf '{\"effects\":{\"desktop\":false,\"sound\":false,\"paneFlash\":false}}'; fi"
      }
    ]
  }
}
```

With no hooks configured, notification behavior is exactly cmux's built-in default — configuring a hook is the explicit opt-in that hands the delivery decision to your script. Note that cmux's built-in subagent suppression (`automation.suppressSubagentNotifications`, on by default) drops subagent completion events before they reach hooks; turn it off if your hook should see subagent events and make its own decision.

## Bildirim gönderme

### CLI

```
cmux notify --title "Task Complete" --body "Your build finished"
cmux notify --title "Claude Code" --subtitle "Waiting" --body "Agent needs input"
```

### OSC 777 (basit)

RXVT protokolü başlık ve gövde ile sabit bir format kullanır:

```
printf '\e]777;notify;My Title;Message body here\a'
```

Shell function

```
notify_osc777() {
    local title="$1"
    local body="$2"
    printf '\e]777;notify;%s;%s\a' "$title" "$body"
}

notify_osc777 "Build Complete" "All tests passed"
```

### OSC 99 (zengin)

Kitty protokolü alt başlıkları ve bildirim ID'lerini destekler:

```
# Format: ESC ] 99 ; <params> ; <payload> ESC \

# Simple notification
printf '\e]99;i=1;e=1;d=0:Hello World\e\\'

# With title, subtitle, and body
printf '\e]99;i=1;e=1;d=0;p=title:Build Complete\e\\'
printf '\e]99;i=1;e=1;d=0;p=subtitle:Project X\e\\'
printf '\e]99;i=1;e=1;d=1;p=body:All tests passed\e\\'
```

| Özellik | OSC 99 | OSC 777 |
| --- | --- | --- |
| Başlık + gövde | Evet | Evet |
| Alt başlık | Evet | Hayır |
| Bildirim ID | Evet | Hayır |
| Karmaşıklık | Daha yüksek | Daha düşük |

Basit bildirimler için OSC 777 kullanın. Alt başlıklar veya bildirim ID'leri gerektiğinde OSC 99 kullanın. En kolay entegrasyon için CLI (cmux notify) kullanın.

## Claude Code hooks

cmux, görevler tamamlandığında sizi bilgilendirmek için [Claude Code](https://docs.anthropic.com/en/docs/claude-code) ile hooks aracılığıyla entegre olur.

### 1\. Hook betiğini oluşturun

~/.claude/hooks/cmux-notify.sh

```
#!/bin/bash
# Outside cmux there is no socket to talk to, so do nothing.
[ -S /tmp/cmux.sock ] || exit 0

payload=$(cat)
field() { printf '%s' "$payload" | jq -r "$1 // empty"; }

event=$(field .hook_event_name)
if [ "$event" = "Stop" ]; then
    cmux notify --title "Claude Code" --body "Session complete"
elif [ "$event" = "SubagentStop" ]; then
    cmux notify --title "Claude Code" --body "Agent finished"
fi
```

```
chmod +x ~/.claude/hooks/cmux-notify.sh
```

### 2\. Claude Code'u yapılandırın

~/.claude/settings.json

```
{
  "hooks": {
    "SubagentStop": [
      {
        "hooks": [{ "type": "command", "command": "~/.claude/hooks/cmux-notify.sh" }]
      }
    ],
    "Stop": [
      {
        "hooks": [{ "type": "command", "command": "~/.claude/hooks/cmux-notify.sh" }]
      }
    ]
  }
}
```

Hook'ları uygulamak için Claude Code'u yeniden başlatın.

## GitHub Copilot CLI

Copilot CLI, prompt gönderimi, agent durdurma ve hatalar gibi yaşam döngüsü olaylarında shell komutları çalıştıran [hook'ları](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/use-hooks) destekler.

~/.copilot/config.json

```
{
  "hooks": {
    "userPromptSubmitted": [
      {
        "type": "command",
        "bash": "if command -v cmux &>/dev/null; then cmux set-status copilot_cli Running; fi",
        "timeoutSec": 3
      }
    ],
    "agentStop": [
      {
        "type": "command",
        "bash": "if command -v cmux &>/dev/null; then cmux notify --title 'Copilot CLI' --body 'Done'; cmux set-status copilot_cli Idle; fi",
        "timeoutSec": 5
      }
    ],
    "errorOccurred": [
      {
        "type": "command",
        "bash": "if command -v cmux &>/dev/null; then cmux notify --title 'Copilot CLI' --subtitle 'Error' --body 'An error occurred'; cmux set-status copilot_cli Error; fi",
        "timeoutSec": 5
      }
    ],
    "sessionEnd": [
      {
        "type": "command",
        "bash": "if command -v cmux &>/dev/null; then cmux clear-status copilot_cli; fi",
        "timeoutSec": 3
      }
    ]
  }
}
```

Repo düzeyinde hook'lar için aynı yapıda bir .github/hooks/notify.json dosyası oluşturun:

.github/hooks/notify.json

```
{
  "version": 1,
  "hooks": {
    "userPromptSubmitted": [ ... ],
    "agentStop": [ ... ]
  }
}
```

## Entegrasyon örnekleri

### Uzun komuttan sonra bildir

~/.zshrc

```
# Add to your shell config
notify-after() {
  "$@"
  local exit_code=$?
  if [ $exit_code -eq 0 ]; then
    cmux notify --title "✓ Command Complete" --body "$1"
  else
    cmux notify --title "✗ Command Failed" --body "$1 (exit $exit_code)"
  fi
  return $exit_code
}

# Usage: notify-after npm run build
```

### Python

python

```
import sys

def notify(title: str, body: str):
    """Send OSC 777 notification."""
    sys.stdout.write(f'\x1b]777;notify;{title};{body}\x07')
    sys.stdout.flush()

notify("Script Complete", "Processing finished")
```

### Node.js

node

```
function notify(title, body) {
  process.stdout.write(`\x1b]777;notify;${title};${body}\x07`);
}

notify('Build Done', 'webpack finished');
```

### tmux passthrough

cmux içinde tmux kullanıyorsanız, passthrough'u etkinleştirin:

.tmux.conf

```
set -g allow-passthrough on
```

```
printf '\ePtmux;\e\e]777;notify;Title;Body\a\e\\'
```

Canonical: https://cmux.com/tr/docs/notifications

Documentation index: https://cmux.com/llms.txt
