* 显示系统通知 * @param title 通知标题 * @param message 通知内容 * @param subtitle 通知副标题(可选) * @returns 是否成功显示
(title: string, message: string, subtitle?: string)
| 207 | * @returns 是否成功显示 |
| 208 | */ |
| 209 | async showNotification(title: string, message: string, subtitle?: string): Promise<boolean> { |
| 210 | try { |
| 211 | const subtitlePart = subtitle ? `subtitle "${subtitle}"` : '' |
| 212 | const script = ` |
| 213 | display notification "${message}" with title "${title}" ${subtitlePart} |
| 214 | ` |
| 215 | await this.execute(script) |
| 216 | return true |
| 217 | } catch (error) { |
| 218 | console.error('[AppleScript] 显示通知失败:', error) |
| 219 | return false |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * 获取所有运行中的应用程序列表 |