Claude の Imagine with Claude を使い Windows にClaudeCodeの終了通知をトーストを出す開発をした
はじめに
ClaudeのアップデートでMAXユーザー向けに5日間だけ
「Imagine with Claude」
が公開されました。環境を用意することなく、アプリの作成を行えるツールで
Claude Desktopから利用することができます。
それを使ってClaude codeの終了通知をWindowsのトースト機能を使って
表示させるようにしてみました。
(Windowsでの例が少なかったので)
環境としてはClaudeCodeがWSLにあり
OSがwindows11になります
トーストの作成を依頼する
windowsの右下にだすトーストは
「BurntToast」
を使うことにします。一度その指定なしにさせたら
通知がうまくだせませんでした。インストール方法は割愛します。
英語での指示のほうが理解しやすそうなので英語で指示かけます
Please create a PowerShell script `notify.ps1` that uses the **BurntToast** module to display Windows toast notifications.
>
> Requirements:
>
> - If BurntToast is not installed, include installation instructions:
>
> `Install-Module -Name BurntToast -Force`
>
> - The script should accept three parameters:
>
> - `-Title` (string, default: `"Claude Code Task"`)
>
> - `-Message` (string, default: `"Task completed successfully"`)
>
> - `-Duration` (int, seconds, optional – after which the toast should expire)
>
> - The toast should appear in the bottom-right corner of Windows with the given title and message.
>
> - Notifications should auto-dismiss after the given duration, but also allow the user to close them manually.
>
> - Example usage:
>
> `powershell -File notify.ps1 -Title "Build Complete" -Message "All tests passed" -Duration 15`
>
> - Provide a sample `hooks.yaml` integration so Claude Code can call the script when a task finishes, e.g.:
>
> `- name: Notify on completion run: powershell -File C:\path\to\notify.ps1 -Title "Task Done" -Message "Analysis finished"`


ソースコードと利用例をだしてくれてますね
ただhooksの内容だけが違いますね、この指定では動かないはず
とりあえずファイル作成して実行したらちゃんと表示されました

このとき、windows側の設定で通知ださないようにしていたので
ずっと上手くうごかないと思ってました、、出ない方は設定見直した方がいいです
その後はアイコンの指定もできるようにして、claudeのキャラクターも表示させました

かわいい。
最終的にhooksファイルに登録してちゃんと動くことを確認できました。
トーストなので自動的に消えてくれるのがありがたいです。
完了を確認したからってすぐに内容の確認をするわけではないので

終わりに
他にもLPの制作とかやってもらったんですが
環境いらずで実現できるのは非エンジニアにはありがたいですね
ただごりごりclaude code触ってる人からしたら動作が遅くて
あんまり活用はしにくいかなってイメージです。
今後の展開に期待です。
ソースコード
notify.ps1
# notify.ps1
# Windows Toast Notification Script using BurntToast
# Displays customizable toast notifications in Windows
param(
[string]$Title = "Claude Code Task",
[string]$Message = "Task completed successfully",
[int]$Duration = 0,
[string]$Icon = ""
)
# Check if BurntToast module is installed
if (-not (Get-Module -ListAvailable -Name BurntToast)) {
Write-Host "BurntToast module is not installed." -ForegroundColor Yellow
Write-Host "Installing BurntToast module..." -ForegroundColor Cyan
try {
Install-Module -Name BurntToast -Force -Scope CurrentUser
Write-Host "BurntToast installed successfully!" -ForegroundColor Green
}
catch {
Write-Host "Failed to install BurntToast. Please run:" -ForegroundColor Red
Write-Host "Install-Module -Name BurntToast -Force" -ForegroundColor Yellow
exit 1
}
}
# Import the module
Import-Module BurntToast
# Build toast parameters
$toastParams = @{
Text = @($Title, $Message)
}
# Add custom icon if specified
if ($Icon -ne "" -and (Test-Path $Icon)) {
$toastParams.AppLogo = $Icon
}
elseif ($Icon -ne "" -and -not (Test-Path $Icon)) {
Write-Host "Warning: Icon file not found: $Icon" -ForegroundColor Yellow
}
# Add duration if specified (expiration time)
if ($Duration -gt 0) {
$toastParams.ExpirationTime = (Get-Date).AddSeconds($Duration)
}
# Display the toast notification
try {
New-BurntToastNotification @toastParams
Write-Host "Notification sent: $Title - $Message" -ForegroundColor Green
}
catch {
Write-Host "Failed to display notification: $_" -ForegroundColor Red
exit 1
}
hooks
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "powershell.exe -ExecutionPolicy Bypass -File \"C:\\Users\\ここにパス\\notify.ps1\" -Title \"👾 Task Completed!\" -Message \"The process has finished successfully.\" -Duration 10 -Icon \"C:\\Users\\ここにパス\\icon.png\""
}
]
}
]
}
hooksのほうは
ここにパスという箇所をwindows側のパスでかいてあげてください。
Discussion