Skip to content

Commit f6a0678

Browse files
authored
feat: Make cursor glow disabled by default, have a setting and a binding relationship with dark mode (#509)
1 parent e6b9217 commit f6a0678

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

apps/array/src/renderer/components/CursorGlow.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { useSettingsStore } from "@features/settings/stores/settingsStore";
12
import { useThemeStore } from "@stores/themeStore";
23
import { useEffect, useState } from "react";
34

45
export function CursorGlow() {
56
const isDarkMode = useThemeStore((state) => state.isDarkMode);
7+
const cursorGlow = useSettingsStore((state) => state.cursorGlow);
68
const [mousePos, setMousePos] = useState<{ x: number; y: number } | null>(
79
null,
810
);
@@ -16,8 +18,7 @@ export function CursorGlow() {
1618
return () => window.removeEventListener("mousemove", handleMouseMove);
1719
}, []);
1820

19-
// Only show in dark mode
20-
if (!isDarkMode || !mousePos) return null;
21+
if (!isDarkMode || !cursorGlow || !mousePos) return null;
2122

2223
return (
2324
<div

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

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ export function SettingsView() {
5454
const {
5555
autoRunTasks,
5656
createPR,
57+
cursorGlow,
5758
desktopNotifications,
5859
setAutoRunTasks,
5960
setCreatePR,
61+
setCursorGlow,
6062
setDesktopNotifications,
6163
} = useSettingsStore();
6264
const terminalLayoutMode = useTerminalLayoutStore(
@@ -127,8 +129,24 @@ export function SettingsView() {
127129
new_value: !isDarkMode,
128130
old_value: isDarkMode,
129131
});
132+
// Turn off cursor glow when switching to light mode
133+
if (isDarkMode && cursorGlow) {
134+
setCursorGlow(false);
135+
}
130136
toggleDarkMode();
131-
}, [isDarkMode, toggleDarkMode]);
137+
}, [isDarkMode, toggleDarkMode, cursorGlow, setCursorGlow]);
138+
139+
const handleCursorGlowChange = useCallback(
140+
(checked: boolean) => {
141+
track(ANALYTICS_EVENTS.SETTING_CHANGED, {
142+
setting_name: "cursor_glow",
143+
new_value: checked,
144+
old_value: cursorGlow,
145+
});
146+
setCursorGlow(checked);
147+
},
148+
[cursorGlow, setCursorGlow],
149+
);
132150

133151
const handleTerminalLayoutChange = useCallback(
134152
(value: "split" | "tabbed") => {
@@ -237,16 +255,39 @@ export function SettingsView() {
237255
<Card>
238256
<Flex direction="column" gap="4">
239257
<Flex align="center" justify="between">
240-
<Text size="1" weight="medium">
241-
Dark mode
242-
</Text>
258+
<Flex direction="column" gap="1">
259+
<Text size="1" weight="medium">
260+
Dark mode
261+
</Text>
262+
<Text size="1" color="gray">
263+
Use dark theme for the interface
264+
</Text>
265+
</Flex>
243266
<Switch
244267
checked={isDarkMode}
245268
onCheckedChange={handleDarkModeChange}
246269
size="1"
247270
/>
248271
</Flex>
249272

273+
{isDarkMode && (
274+
<Flex align="center" justify="between">
275+
<Flex direction="column" gap="1">
276+
<Text size="1" weight="medium">
277+
Cursor glow
278+
</Text>
279+
<Text size="1" color="gray">
280+
Show a glow effect that follows your cursor
281+
</Text>
282+
</Flex>
283+
<Switch
284+
checked={cursorGlow}
285+
onCheckedChange={handleCursorGlowChange}
286+
size="1"
287+
/>
288+
</Flex>
289+
)}
290+
250291
<Flex direction="column" gap="2">
251292
<Text size="1" weight="medium">
252293
Terminal layout

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface SettingsStore {
1515
createPR: boolean;
1616
defaultModel: string;
1717
desktopNotifications: boolean;
18+
cursorGlow: boolean;
1819

1920
setAutoRunTasks: (autoRun: boolean) => void;
2021
setDefaultRunMode: (mode: DefaultRunMode) => void;
@@ -24,6 +25,7 @@ interface SettingsStore {
2425
setCreatePR: (createPR: boolean) => void;
2526
setDefaultModel: (model: string) => void;
2627
setDesktopNotifications: (enabled: boolean) => void;
28+
setCursorGlow: (enabled: boolean) => void;
2729
}
2830

2931
export const useSettingsStore = create<SettingsStore>()(
@@ -37,6 +39,7 @@ export const useSettingsStore = create<SettingsStore>()(
3739
createPR: true,
3840
defaultModel: DEFAULT_MODEL,
3941
desktopNotifications: true,
42+
cursorGlow: false,
4043

4144
setAutoRunTasks: (autoRun) => set({ autoRunTasks: autoRun }),
4245
setDefaultRunMode: (mode) => set({ defaultRunMode: mode }),
@@ -48,6 +51,7 @@ export const useSettingsStore = create<SettingsStore>()(
4851
setDefaultModel: (model) => set({ defaultModel: model }),
4952
setDesktopNotifications: (enabled) =>
5053
set({ desktopNotifications: enabled }),
54+
setCursorGlow: (enabled) => set({ cursorGlow: enabled }),
5155
}),
5256
{
5357
name: "settings-storage",

0 commit comments

Comments
 (0)