[Claude Code] 작업완료시 알림(윈도우)
---------------------------------------
claude 설정
~/.claude/settings.json 파일에 다음 설정 추가
...
"preferredNotifChannel": "terminal_bell",
"hooks": {
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\\scripts\\notify.ps1\" -Title \"Claude 입력 대기\" -Message \"사용자 입력이 필요합니다.\" -Bell"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\\scripts\\notify.ps1\" -Title \"Claude 작업 완료\" -Message \"작업을 완료했습니다.\" -Bell"
}
]
}
]
},
---------------------------------------
* 핵심 Hook 이벤트 종류
이벤트 발동 시점
Notification Claude가 입력을 기다리거나 권한 요청할 때
Stop Claude가 응답을 완료했을 때
PostToolUse 도구(파일 편집, 명령 실행 등) 사용 후
SessionEnd 세션이 종료될 때
---------------------------------------
* notify.ps1 파일 작성(UTF-8 BOM 형식으로 저장)
param(
[string]$Title = "작업 완료",
[string]$Message = "Claude Code 작업이 끝났습니다.",
[switch]$Bell
)
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Text.Encoding]::UTF8
# Write-Host "[notify.ps1] 시작" -ForegroundColor Cyan
try {
Add-Type -AssemblyName System.Runtime.WindowsRuntime
# 토스트는 항상 무음으로 (소리는 별도 재생)
$toastXml = @"
<toast>
<visual>
<binding template="ToastGeneric">
<text>$Title</text>
<text>$Message</text>
</binding>
</visual>
<audio silent="true"/>
</toast>
"@
$xmlDoc = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]::new()
$xmlDoc.LoadXml($toastXml)
$appId = 'Microsoft.WindowsTerminal_8wekyb3d8bbwe!App'
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]::CreateToastNotifier($appId).Show($xmlDoc)
# Bell 옵션: 소리 별도 재생
if ($Bell) {
$soundFile = "$env:SystemRoot\Media\Windows Notify Calendar.wav"
if (Test-Path $soundFile) {
$player = New-Object System.Media.SoundPlayer $soundFile
$player.PlaySync()
} else {
# 파일이 없으면 시스템 기본 비프음
[System.Media.SystemSounds]::Asterisk.Play()
}
}
} catch {
Write-Host "[notify.ps1] 오류 발생: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "[notify.ps1] 스택: $($_.ScriptStackTrace)" -ForegroundColor Red
exit 1
}
'Code' 카테고리의 다른 글
| google cloud 사용법, 관리자가 다른 사용자에게 vertex ai 사용 권한 부여하는 방법 (0) | 2026.02.02 |
|---|---|
| mysql 인증 플러그인 설정 방법 (0) | 2026.02.01 |
| VS Code Extension, Codex (OpenAI) 사용법 (0) | 2025.09.05 |
| Google Chat 사용방법 (0) | 2025.08.22 |
| slack 사용법 (0) | 2025.08.22 |



