Notifications

imux supporte les notifications bureau, permettant aux agents IA et aux scripts de vous alerter quand ils ont besoin d'attention.

Cycle de vie

  1. Reçue : la notification apparaît dans le panneau, l'alerte bureau se déclenche (si non supprimée)
  2. Non lue : badge affiché sur l'onglet de l'espace de travail
  3. Lue : effacée quand vous consultez cet espace de travail
  4. Effacée : supprimée du panneau

Suppression

Les alertes bureau sont supprimées quand :

  • La fenêtre imux est active
  • L'espace de travail spécifique qui envoie la notification est actif
  • Le panneau de notifications est ouvert

Panneau de notifications

Appuyez sur ⌘⇧I pour ouvrir le panneau de notifications. Cliquez sur une notification pour aller à cet espace de travail. Appuyez sur ⌘⇧U pour aller directement à l'espace de travail avec la notification non lue la plus récente.

Commande personnalisée

Exécutez une commande shell à chaque fois qu'une notification est planifiée. Définissez-la dans Réglages > App > Commande de notification. La commande s'exécute via /bin/sh -c avec ces variables d'environnement :

VariableDescription
ICC_NOTIFICATION_TITLETitre de la notification (nom de l'espace de travail ou nom de l'app)
ICC_NOTIFICATION_SUBTITLESous-titre de la notification
ICC_NOTIFICATION_BODYTexte du corps de la notification
Examples
# Text-to-speech
say "$ICC_NOTIFICATION_TITLE"

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

# Log to file
echo "$ICC_NOTIFICATION_TITLE: $ICC_NOTIFICATION_BODY" >> ~/notifications.log

La commande s'exécute indépendamment du sélecteur de son système. Définissez le sélecteur sur « Aucun » pour utiliser uniquement la commande personnalisée, ou gardez les deux pour un son système plus une action personnalisée.

Envoyer des notifications

CLI

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

OSC 777 (simple)

Le protocole RXVT utilise un format fixe avec titre et corps :

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 (riche)

Le protocole Kitty supporte les sous-titres et les IDs de notification :

# 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\\'
FonctionnalitéOSC 99OSC 777
Titre + corpsOuiOui
Sous-titreOuiNon
ID de notificationOuiNon
ComplexitéPlus élevéePlus basse
Utilisez OSC 777 pour les notifications simples. Utilisez OSC 99 quand vous avez besoin de sous-titres ou d'IDs de notification. Utilisez le CLI (icc notify) pour l'intégration la plus simple.

Hooks Claude Code

imux s'intègre avec Claude Code via des hooks pour vous notifier quand les tâches sont terminées.

1. Créer le script de hook

~/.claude/hooks/icc-notify.sh
#!/bin/bash
# Skip if not in icc
[ -S /tmp/icc.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")
        icc notify --title "Claude Code" --body "Session complete"
        ;;
    "PostToolUse")
        [ "$TOOL" = "Task" ] && icc notify --title "Claude Code" --body "Agent finished"
        ;;
esac
chmod +x ~/.claude/hooks/icc-notify.sh

2. Configurer Claude Code

~/.claude/settings.json
{
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/hooks/icc-notify.sh"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Task",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/hooks/icc-notify.sh"
          }
        ]
      }
    ]
  }
}

Redémarrez Claude Code pour appliquer les hooks.

Exemples d'intégration

Notifier après une longue commande

~/.zshrc
# Add to your shell config
notify-after() {
  "$@"
  local exit_code=$?
  if [ $exit_code -eq 0 ]; then
    icc notify --title "✓ Command Complete" --body "$1"
  else
    icc 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');

Passthrough tmux

Si vous utilisez tmux dans imux, activez le passthrough :

.tmux.conf
set -g allow-passthrough on
printf '\ePtmux;\e\e]777;notify;Title;Body\a\e\\'