.iflow路径下创建hooks 文件夹:
.iflow\hooks> dir
Directory: C:\Users\Name\.iflow\hooks
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2026/3/11 19:21 resource
-a--- 2026/3/11 19:55 796 play-audio.ps1
rresource 文件夹放入你喜欢的提示音 wav后缀的
play-audio.ps1:
# iFlow Hook - 播放音频提醒
param(
[string]$AudioFile = "ohYeah.wav",
[string]$HookEvent = "Unknown"
)
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$audioPath = Join-Path $scriptDir "resource\$AudioFile"
# $logFile = Join-Path $scriptDir "hook-debug.log"
# $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
# "[$timestamp] Event: $HookEvent, Audio: $audioPath, Exists: $(Test-Path $audioPath)" | Out-File $logFile -Append -Encoding UTF8
# 启动独立 PowerShell 进程播放音频
$playerCode = "Add-Type -AssemblyName System.Windows.Forms; `$p = New-Object System.Media.SoundPlayer '$audioPath'; `$p.PlaySync()"
Start-Process -FilePath "powershell.exe" -ArgumentList "-WindowStyle Hidden -ExecutionPolicy Bypass -Command `"$playerCode`"" -WindowStyle Hidden
setting.json 添加:
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "powershell -ExecutionPolicy Bypass -File \"C:\\Users\\这里换自己用户名\\.iflow\\hooks\\play-audio.ps1\" -AudioFile \"ohYeah.wav\" -HookEvent \"Stop\""
}
]
}
]
}