Skip to content

Commit c170f21

Browse files
committed
Desktop notification setting
1 parent 21c813f commit c170f21

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ export function SettingsView() {
5656
autoRunTasks,
5757
defaultRunMode,
5858
createPR,
59+
desktopNotifications,
5960
setAutoRunTasks,
6061
setDefaultRunMode,
6162
setCreatePR,
63+
setDesktopNotifications,
6264
} = useSettingsStore();
6365
const terminalLayoutMode = useTerminalLayoutStore(
6466
(state) => state.terminalLayoutMode,
@@ -251,6 +253,30 @@ export function SettingsView() {
251253

252254
<Box className="border-gray-6 border-t" />
253255

256+
{/* Chat Section */}
257+
<Flex direction="column" gap="3">
258+
<Heading size="3">Chat</Heading>
259+
<Card>
260+
<Flex align="center" justify="between">
261+
<Flex direction="column" gap="1">
262+
<Text size="1" weight="medium">
263+
Desktop notifications
264+
</Text>
265+
<Text size="1" color="gray">
266+
Show notifications when the agent finishes working on a task
267+
</Text>
268+
</Flex>
269+
<Switch
270+
checked={desktopNotifications}
271+
onCheckedChange={setDesktopNotifications}
272+
size="1"
273+
/>
274+
</Flex>
275+
</Card>
276+
</Flex>
277+
278+
<Box className="border-gray-6 border-t" />
279+
254280
{/* Task Execution Section */}
255281
<Flex direction="column" gap="3">
256282
<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)