Skip to content

Commit 9da07a6

Browse files
committed
Desktop notification setting
1 parent 31b4757 commit 9da07a6

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ 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+
defaultRunMode,
57+
createPR,
58+
desktopNotifications,
59+
setAutoRunTasks,
60+
setDefaultRunMode,
61+
setCreatePR,
62+
setDesktopNotifications,
63+
} = useSettingsStore();
5664
const terminalLayoutMode = useTerminalLayoutStore(
5765
(state) => state.terminalLayoutMode,
5866
);
@@ -290,6 +298,30 @@ export function SettingsView() {
290298

291299
<Box className="border-gray-6 border-t" />
292300

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