Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/desktop/src/db/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const defaultSettings: AppSettingsData = {
preferences: {
launchAtLogin: true,
showWidgetWhileInactive: true,
showWidgetWhileActive: true,
showInDock: true,
},
transcription: {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export interface AppSettingsData {
launchAtLogin?: boolean;
minimizeToTray?: boolean;
showWidgetWhileInactive?: boolean;
showWidgetWhileActive?: boolean;
showInDock?: boolean;
};
telemetry?: {
Expand Down
10 changes: 8 additions & 2 deletions apps/desktop/src/main/core/app-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,14 @@ export class AppManager {
"preferences-changed",
async ({
showWidgetWhileInactiveChanged,
showWidgetWhileActiveChanged,
showInDockChanged,
}: {
showWidgetWhileInactiveChanged: boolean;
showWidgetWhileActiveChanged: boolean;
showInDockChanged: boolean;
}) => {
if (showWidgetWhileInactiveChanged) {
if (showWidgetWhileInactiveChanged || showWidgetWhileActiveChanged) {
const recordingManager =
this.serviceManager.getService("recordingManager");
const isIdle = recordingManager.getState() === "idle";
Expand All @@ -217,7 +219,11 @@ export class AppManager {
const settingsService = this.serviceManager.getService("settingsService");
const preferences = await settingsService.getPreferences();

if (preferences.showWidgetWhileInactive || !isIdle) {
const shouldShow = isIdle
? preferences.showWidgetWhileInactive
: preferences.showWidgetWhileActive;

if (shouldShow) {
this.windowManager.showWidget();
} else {
this.windowManager.hideWidget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export default function PreferencesSettingsPage() {
});
};

const handleShowWidgetWhileActiveChange = (checked: boolean) => {
updatePreferencesMutation.mutate({
showWidgetWhileActive: checked,
});
};

const handleMinimizeToTrayChange = (checked: boolean) => {
updatePreferencesMutation.mutate({
minimizeToTray: checked,
Expand All @@ -48,6 +54,8 @@ export default function PreferencesSettingsPage() {

const showWidgetWhileInactive =
preferencesQuery.data?.showWidgetWhileInactive ?? true;
const showWidgetWhileActive =
preferencesQuery.data?.showWidgetWhileActive ?? true;
const minimizeToTray = preferencesQuery.data?.minimizeToTray ?? false;
const launchAtLogin = preferencesQuery.data?.launchAtLogin ?? true;
const showInDock = preferencesQuery.data?.showInDock ?? true;
Expand Down Expand Up @@ -123,6 +131,25 @@ export default function PreferencesSettingsPage() {

<Separator />

{/* Show Widget While Active Section */}
<div className="flex items-center justify-between">
<div className="space-y-1">
<Label className="text-base font-medium text-foreground">
Show widget while active
</Label>
<p className="text-xs text-muted-foreground">
Show the widget on screen when recording
</p>
</div>
<Switch
checked={showWidgetWhileActive}
onCheckedChange={handleShowWidgetWhileActiveChange}
disabled={updatePreferencesMutation.isPending}
/>
</div>

<Separator />

{/* Show in Dock Section (macOS only) */}
{isMac && (
<>
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/services/settings-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface AppPreferences {
launchAtLogin: boolean;
minimizeToTray: boolean;
showWidgetWhileInactive: boolean;
showWidgetWhileActive: boolean;
showInDock: boolean;
}

Expand Down Expand Up @@ -289,6 +290,7 @@ export class SettingsService extends EventEmitter {
launchAtLogin: preferences?.launchAtLogin ?? true,
minimizeToTray: preferences?.minimizeToTray ?? true,
showWidgetWhileInactive: preferences?.showWidgetWhileInactive ?? true,
showWidgetWhileActive: preferences?.showWidgetWhileActive ?? true,
showInDock: preferences?.showInDock ?? true,
};
}
Expand Down Expand Up @@ -316,6 +318,8 @@ export class SettingsService extends EventEmitter {
changes: preferences,
showWidgetWhileInactiveChanged:
preferences.showWidgetWhileInactive !== undefined,
showWidgetWhileActiveChanged:
preferences.showWidgetWhileActive !== undefined,
showInDockChanged: preferences.showInDock !== undefined,
});
}
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/trpc/routers/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const AppPreferencesSchema = z.object({
launchAtLogin: z.boolean().optional(),
minimizeToTray: z.boolean().optional(),
showWidgetWhileInactive: z.boolean().optional(),
showWidgetWhileActive: z.boolean().optional(),
showInDock: z.boolean().optional(),
});

Expand Down