Notifikacije
cmux podržava desktop notifikacije, omogućavajući AI agentima i skriptama da vas obavijeste kada trebaju pažnju.
Životni ciklus
- Primljeno: notifikacija se pojavljuje u panelu, desktop obavještenje se pokreće (ako nije potisnuto)
- Nepročitano: bedž prikazan na tabu radnog prostora
- Pročitano: obrisano kada pogledate taj radni prostor
- Obrisano: uklonjeno iz panela
Potiskivanje
Desktop obavještenja se potiskuju kada:
- cmux prozor je fokusiran
- Specifični radni prostor koji šalje notifikaciju je aktivan
- Panel notifikacija je otvoren
Panel notifikacija
Pritisnite ⌘⇧I za otvaranje panela notifikacija. Kliknite na notifikaciju za skok na taj radni prostor. Pritisnite ⌘⇧U za direktan skok na radni prostor sa najnovijom nepročitanom notifikacijom.
Prilagođena komanda
Pokrenite shell komandu svaki put kada je notifikacija zakazana. Postavite je u Postavke > Aplikacija > Komanda notifikacije. Komanda se pokreće putem /bin/sh -c sa ovim varijablama okruženja:
| Varijabla | Opis |
|---|---|
CMUX_NOTIFICATION_TITLE | Naslov notifikacije (ime radnog prostora ili aplikacije) |
CMUX_NOTIFICATION_SUBTITLE | Podnaslov notifikacije |
CMUX_NOTIFICATION_BODY | Tekst tijela notifikacije |
# 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.logKomanda se pokreće nezavisno od sistemskog birača zvukova. Postavite birač na "Ništa" za korištenje samo prilagođene komande, ili zadržite oboje za sistemski zvuk plus prilagođenu akciju.
Hookovi za notifikacije
cmux.json može definisati hookove za notifikacije koji primaju svaku politiku notifikacije kao JSON na stdin. Svaki hook vraća JSON na stdout. Hookovi su isključeni po zadanim postavkama; cmux ih pokreće samo kada notifications.hooks sadrži barem jedan omogućen hook. cmux primjenjuje vraćeni tekst i efekte, pa hookovi mogu filtrirati bannere, zadržati ili preskočiti historiju bočne trake, pokretati zvukove ili zaustaviti kasnije hookove.
{
"notifications": {
"hooks": [
{
"id": "quiet-docs",
"command": "sed 's/"desktop":true/"desktop":false/'",
"timeoutSeconds": 20
}
]
}
}{
"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
}
}Hookovi se nasljeđuju iz globalnog ~/.config/cmux/cmux.json i projektnih .cmux/cmux.json datoteka od nadređenih direktorija do trenutnog workspacea. Projektni hookovi koriste isti prompt povjerenja kao druge projektne cmux.json komande prije pokretanja. Feed banneri za odobrenje također prolaze kroz ove hookove; isključivanje desktop skriva nativni banner dok Feed stavka ostaje dostupna u cmuxu. Postavite notifications.hooksMode na replace u konfiguraciji projekta da zanemarite naslijeđene hookove. Ako hook ne uspije, istekne ili vrati neispravan JSON, cmux koristi zadano ponašanje notifikacija i prikazuje upozorenje o grešci hooka.
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:
{
"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.
Slanje notifikacija
CLI
cmux notify --title "Task Complete" --body "Your build finished"
cmux notify --title "Claude Code" --subtitle "Waiting" --body "Agent needs input"OSC 777 (jednostavno)
RXVT protokol koristi fiksni format sa naslovom i tijelom:
printf '\e]777;notify;My Title;Message body here\a'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 (bogato)
Kitty protokol podržava podnaslove i ID-eve notifikacija:
# 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\\'| Funkcionalnost | OSC 99 | OSC 777 |
|---|---|---|
| Naslov + tijelo | Da | Da |
| Podnaslov | Da | Ne |
| ID notifikacije | Da | Ne |
| Složenost | Viša | Niža |
Claude Code hooks
cmux se integriše sa Claude Code putem hookova da vas obavijesti kada su zadaci završeni.
1. Kreirajte hook skriptu
#!/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"
fichmod +x ~/.claude/hooks/cmux-notify.sh2. Konfigurirajte Claude Code
{
"hooks": {
"SubagentStop": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/cmux-notify.sh" }]
}
],
"Stop": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/cmux-notify.sh" }]
}
]
}
}Ponovo pokrenite Claude Code da primijenite hookove.
GitHub Copilot CLI
Copilot CLI podržava hookove koji pokreću shell komande na događajima životnog ciklusa poput slanja upita, zaustavljanja agenta i grešaka.
{
"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
}
]
}
}Za hookove na nivou repozitorija, kreirajte .github/hooks/notify.json datoteku sa istom strukturom:
{
"version": 1,
"hooks": {
"userPromptSubmitted": [ ... ],
"agentStop": [ ... ]
}
}Primjeri integracije
Notifikacija nakon duge komande
# 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 buildPython
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
function notify(title, body) {
process.stdout.write(`\x1b]777;notify;${title};${body}\x07`);
}
notify('Build Done', 'webpack finished');tmux passthrough
Ako koristite tmux unutar cmux-a, omogućite passthrough:
set -g allow-passthrough onprintf '\ePtmux;\e\e]777;notify;Title;Body\a\e\\'