mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
feat: system notifications only trigger when vscode unfocus
This commit is contained in:
parent
cc8e3ef511
commit
76a4560b56
3 changed files with 9 additions and 0 deletions
|
|
@ -1,10 +1,12 @@
|
|||
import { execa } from "execa"
|
||||
import { platform } from "os"
|
||||
import * as vscode from "vscode"
|
||||
|
||||
interface NotificationOptions {
|
||||
title?: string
|
||||
subtitle?: string
|
||||
message: string
|
||||
force?: boolean // Force notification even if the window is focused
|
||||
}
|
||||
|
||||
async function showMacOSNotification(options: NotificationOptions): Promise<void> {
|
||||
|
|
@ -65,6 +67,11 @@ async function showLinuxNotification(options: NotificationOptions): Promise<void
|
|||
|
||||
export async function showSystemNotification(options: NotificationOptions): Promise<void> {
|
||||
try {
|
||||
if (vscode.window.state.focused && !options.force) {
|
||||
// If the window is focused, do not show a notification
|
||||
return
|
||||
}
|
||||
|
||||
const { title = "Roo Code", message } = options
|
||||
|
||||
if (!message) {
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ export interface WebviewMessage {
|
|||
title?: string
|
||||
subtitle?: string
|
||||
message: string
|
||||
force?: boolean // Force notification even if the window is focused
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export const NotificationSettings = ({
|
|||
notificationOptions: {
|
||||
title: t("settings.notifications.system.testTitle"),
|
||||
message: t("settings.notifications.system.testMessage"),
|
||||
force: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue