Skip to content

Commit a6003aa

Browse files
authored
feat: Desktop notification setting (#391)
- Adds a setting to enable/disable desktop badge notifications for when the agent has completed a chat task (default = enabled)
1 parent 577000a commit a6003aa

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

apps/array/src/renderer/features/settings/components/SettingsView.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ export function SettingsView() {
5151
useAuthStore();
5252
const isDarkMode = useThemeStore((state) => state.isDarkMode);
5353
const toggleDarkMode = useThemeStore((state) => state.toggleDarkMode);
54-
const { autoRunTasks, createPR, setAutoRunTasks, setCreatePR } =
55-
useSettingsStore();
54+
const {
55+
autoRunTasks,
56+
createPR,
57+
desktopNotifications,
58+
setAutoRunTasks,
59+
setCreatePR,
60+
setDesktopNotifications,
61+
} = useSettingsStore();
5662
const terminalLayoutMode = useTerminalLayoutStore(
5763
(state) => state.terminalLayoutMode,
5864
);
@@ -290,6 +296,30 @@ export function SettingsView() {
290296

291297
<Box className="border-gray-6 border-t" />
292298

299+
{/* Chat Section */}
300+
<Flex direction="column" gap="3">
301+
<Heading size="3">Chat</Heading>
302+
<Card>
303+
<Flex align="center" justify="between">
304+
<Flex direction="column" gap="1">
305+
<Text size="1" weight="medium">
306+
Desktop notifications
307+
</Text>
308+
<Text size="1" color="gray">
309+
Show notifications when the agent finishes working on a task
310+
</Text>
311+
</Flex>
312+
<Switch
313+
checked={desktopNotifications}
314+
onCheckedChange={setDesktopNotifications}
315+
size="1"
316+
/>
317+
</Flex>
318+
</Card>
319+
</Flex>
320+
321+
<Box className="border-gray-6 border-t" />
322+
293323
{/* Task Execution Section */}
294324
<Flex direction="column" gap="3">
295325
<Heading size="3">Task execution</Heading>

apps/array/src/renderer/features/settings/stores/settingsStore.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface SettingsStore {
1919
createPR: boolean;
2020
defaultModel: string;
2121
defaultFramework: AgentFramework;
22+
desktopNotifications: boolean;
2223

2324
setAutoRunTasks: (autoRun: boolean) => void;
2425
setDefaultRunMode: (mode: DefaultRunMode) => void;
@@ -28,6 +29,7 @@ interface SettingsStore {
2829
setCreatePR: (createPR: boolean) => void;
2930
setDefaultModel: (model: string) => void;
3031
setDefaultFramework: (framework: AgentFramework) => void;
32+
setDesktopNotifications: (enabled: boolean) => void;
3133
}
3234

3335
export const useSettingsStore = create<SettingsStore>()(
@@ -41,6 +43,7 @@ export const useSettingsStore = create<SettingsStore>()(
4143
createPR: true,
4244
defaultModel: DEFAULT_MODEL,
4345
defaultFramework: DEFAULT_FRAMEWORK,
46+
desktopNotifications: true,
4447

4548
setAutoRunTasks: (autoRun) => set({ autoRunTasks: autoRun }),
4649
setDefaultRunMode: (mode) => set({ defaultRunMode: mode }),
@@ -51,6 +54,8 @@ export const useSettingsStore = create<SettingsStore>()(
5154
setCreatePR: (createPR) => set({ createPR }),
5255
setDefaultModel: (model) => set({ defaultModel: model }),
5356
setDefaultFramework: (framework) => set({ defaultFramework: framework }),
57+
setDesktopNotifications: (enabled) =>
58+
set({ desktopNotifications: enabled }),
5459
}),
5560
{
5661
name: "settings-storage",

apps/array/src/renderer/features/task-detail/components/TaskLogsPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
useSessionActions,
55
useSessionForTask,
66
} from "@features/sessions/stores/sessionStore";
7+
import { useSettingsStore } from "@features/settings/stores/settingsStore";
78
import { useTaskViewedStore } from "@features/sidebar/stores/taskViewedStore";
89
import { useTaskData } from "@features/task-detail/hooks/useTaskData";
910
import {
@@ -95,7 +96,8 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
9596
}
9697

9798
const isWindowFocused = document.hasFocus();
98-
if (!isWindowFocused) {
99+
const { desktopNotifications } = useSettingsStore.getState();
100+
if (!isWindowFocused && desktopNotifications) {
99101
trpcVanilla.dockBadge.show.mutate();
100102
}
101103
} catch (error) {

apps/array/src/renderer/sagas/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)