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şkenAçıklama
CMUX_NOTIFICATION_TITLEBildirim başlığı (çalışma alanı adı veya uygulama adı)
CMUX_NOTIFICATION_SUBTITLEBildirim alt başlığı
CMUX_NOTIFICATION_BODYBildirim 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 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\\'
ÖzellikOSC 99OSC 777
Başlık + gövdeEvetEvet
Alt başlıkEvetHayır
Bildirim IDEvetHayır
KarmaşıklıkDaha yüksekDaha 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 ile hooks aracılığıyla entegre olur.

1. Hook betiğini oluşturun

~/.claude/hooks/cmux-notify.sh
#!/bin/bash
# Skip if not in cmux
[ -S /tmp/cmux.sock ] || exit 0

EVENT=$(cat)
EVENT_TYPE=$(echo "$EVENT" | jq -r '.hook_event_name // "unknown"')
TOOL=$(echo "$EVENT" | jq -r '.tool_name // ""')

case "$EVENT_TYPE" in
    "Stop")
        cmux notify --title "Claude Code" --body "Session complete"
        ;;
    "PostToolUse")
        [ "$TOOL" = "Task" ] && cmux notify --title "Claude Code" --body "Agent finished"
        ;;
esac
chmod +x ~/.claude/hooks/cmux-notify.sh

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

~/.claude/settings.json
{
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/hooks/cmux-notify.sh"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Task",
        "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ı 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\\'