Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): surface studio recording toggles in general settings

Richie McIlroyb708c684aee2
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
index 3d1bd22fc..6a241c8c5 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
@@ -4,30 +4,30 @@ import { createResource, Show } from "solid-js";
import { createStore } from "solid-js/store";
import { generalSettingsStore } from "~/store";
-import { commands, type GeneralSettingsStore } from "~/utils/tauri";
+import {
+ deriveGeneralSettings,
+ type GeneralSettingsStore,
+} from "~/utils/general-settings";
+import { commands } from "~/utils/tauri";
import { ToggleSettingItem } from "./Setting";
export default function ExperimentalSettings() {
const [store] = createResource(() => generalSettingsStore.get());
+ const osType = type();
return (
<Show when={store.state === "ready" && ([store()] as const)}>
- {(store) => <Inner initialStore={store()[0] ?? null} />}
+ {(store) => <Inner initialStore={store()[0] ?? null} osType={osType} />}
</Show>
);
}
-function Inner(props: { initialStore: GeneralSettingsStore | null }) {
+function Inner(props: {
+ initialStore: GeneralSettingsStore | null;
+ osType: ReturnType<typeof type>;
+}) {
const [settings, setSettings] = createStore<GeneralSettingsStore>(
- props.initialStore ?? {
- uploadIndividualFiles: false,
- hideDockIcon: false,
- autoCreateShareableLink: false,
- enableNotifications: true,
- enableNativeCameraPreview: false,
- autoZoomOnClicks: false,
- custom_cursor_capture2: true,
- },
+ deriveGeneralSettings(props.initialStore),
);
const handleChange = async <K extends keyof typeof settings>(
@@ -61,18 +61,17 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
expected.
</p>
</div>
- <div class="space-y-3">
- <h3 class="text-sm text-gray-12 w-fit">Recording Features</h3>
- <div class="px-3 rounded-xl border divide-y divide-gray-3 border-gray-3 bg-gray-2">
- <ToggleSettingItem
- label="Custom cursor capture in Studio Mode"
- description="Studio Mode recordings will capture cursor state separately for customisation (size, smoothing) in the editor. Currently experimental as cursor events may not be captured accurately."
- value={!!settings.custom_cursor_capture2}
- onChange={(value) =>
- handleChange("custom_cursor_capture2", value)
- }
- />
- {type() !== "windows" && (
+ <Show
+ when={props.osType !== "windows"}
+ fallback={
+ <p class="text-sm text-gray-10">
+ No experimental features are currently available on this platform.
+ </p>
+ }
+ >
+ <div class="space-y-3">
+ <h3 class="text-sm text-gray-12 w-fit">Preview</h3>
+ <div class="px-3 rounded-xl border divide-y divide-gray-3 border-gray-3 bg-gray-2">
<ToggleSettingItem
label="Native camera preview"
description="Show the camera preview using a native GPU surface instead of rendering it within the webview. This is not functional on certain Windows systems so your mileage may vary."
@@ -81,21 +80,9 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
handleChange("enableNativeCameraPreview", value)
}
/>
- )}
- <ToggleSettingItem
- label="Auto zoom on clicks"
- description="Automatically generate zoom segments around mouse clicks during Studio Mode recordings. This helps highlight important interactions in your recordings."
- value={!!settings.autoZoomOnClicks}
- onChange={(value) => {
- handleChange("autoZoomOnClicks", value);
- setTimeout(
- () => window.scrollTo({ top: 0, behavior: "instant" }),
- 5,
- );
- }}
- />
+ </div>
</div>
- </div>
+ </Show>
</div>
</div>
);
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
index 4ba8d8c8a..5af3ec3cb 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
@@ -26,12 +26,15 @@ import themePreviewDark from "~/assets/theme-previews/dark.jpg";
import themePreviewLight from "~/assets/theme-previews/light.jpg";
import { Input } from "~/routes/editor/ui";
import { authStore, generalSettingsStore } from "~/store";
+import {
+ deriveGeneralSettings,
+ type GeneralSettingsStore,
+} from "~/utils/general-settings";
import {
type AppTheme,
type CaptureWindow,
commands,
events,
- type GeneralSettingsStore,
type MainWindowRecordingStartBehaviour,
type PostDeletionBehaviour,
type PostStudioRecordingBehaviour,
@@ -66,32 +69,6 @@ const getWindowOptionLabel = (window: CaptureWindow) => {
type ExtendedGeneralSettingsStore = GeneralSettingsStore;
-const createDefaultGeneralSettings = (): ExtendedGeneralSettingsStore => ({
- uploadIndividualFiles: false,
- hideDockIcon: false,
- autoCreateShareableLink: false,
- enableNotifications: true,
- enableNativeCameraPreview: false,
- autoZoomOnClicks: false,
- custom_cursor_capture2: true,
- excludedWindows: [],
- instantModeMaxResolution: 1920,
- crashRecoveryRecording: true,
- maxFps: 60,
-});
-
-const deriveInitialSettings = (
- store: GeneralSettingsStore | null,
-): ExtendedGeneralSettingsStore => {
- const defaults = createDefaultGeneralSettings();
- if (!store) return defaults;
-
- return {
- ...defaults,
- ...store,
- };
-};
-
const INSTANT_MODE_RESOLUTION_OPTIONS = [
{ value: 1280, label: "720p" },
{ value: 1920, label: "1080p" },
@@ -214,11 +191,11 @@ function AppearanceSection(props: {
function Inner(props: { initialStore: GeneralSettingsStore | null }) {
const [settings, setSettings] = createStore<ExtendedGeneralSettingsStore>(
- deriveInitialSettings(props.initialStore),
+ deriveGeneralSettings(props.initialStore),
);
createEffect(() => {
- setSettings(reconcile(deriveInitialSettings(props.initialStore)));
+ setSettings(reconcile(deriveGeneralSettings(props.initialStore)));
});
const [windows, { refetch: refetchWindows }] = createResource(
@@ -357,7 +334,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
description: string;
value: T;
onChange: (value: T) => void;
- options: { text: string; value: any }[];
+ options: { text: string; value: T }[];
}) => {
return (
<SettingItem label={props.label} description={props.description}>
@@ -524,6 +501,24 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
value={settings.crashRecoveryRecording ?? true}
onChange={(value) => handleChange("crashRecoveryRecording", value)}
/>
+ <ToggleSettingItem
+ label="Custom cursor capture in Studio Mode"
+ description="Studio Mode recordings capture cursor state separately so you can adjust cursor size and smoothing later in the editor."
+ value={!!settings.custom_cursor_capture2}
+ onChange={(value) => handleChange("custom_cursor_capture2", value)}
+ />
+ <ToggleSettingItem
+ label="Auto zoom on clicks"
+ description="Automatically generate zoom segments around mouse clicks during Studio Mode recordings."
+ value={!!settings.autoZoomOnClicks}
+ onChange={(value) => handleChange("autoZoomOnClicks", value)}
+ />
+ <ToggleSettingItem
+ label="Capture keyboard presses for the editor"
+ description="Records keyboard presses during Studio Mode so you can generate keyboard overlays in the editor. This data is only used in the editor."
+ value={!!settings.captureKeyboardEvents}
+ onChange={(value) => handleChange("captureKeyboardEvents", value)}
+ />
<div class="flex flex-col gap-1">
<SelectSettingItem
label="Max capture framerate"