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
171 changes: 140 additions & 31 deletions app.go

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import {
DownloadModel,
GetConfig,
SetAutoPaste,
SetPasteSubmit,
SetAirPodsControlEnabled,
SetAutoStopSilence,
SetSoundEnabled,
GetHistory,
ClearHistory,
Expand Down Expand Up @@ -60,6 +63,9 @@ interface Config {
openaiApiKey?: string;
audioInputDevice?: string;
autoPaste: boolean;
pasteSubmit: boolean;
airPodsControlEnabled: boolean;
autoStopSilence: boolean;
soundEnabled?: boolean;
}

Expand Down Expand Up @@ -340,6 +346,21 @@ function App() {
GetConfig().then((c: Config) => setConfig(c));
}, []);

const handlePasteSubmitChange = useCallback(async (enabled: boolean) => {
await SetPasteSubmit(enabled);
GetConfig().then((c: Config) => setConfig(c));
}, []);

const handleAirPodsControlChange = useCallback(async (enabled: boolean) => {
await SetAirPodsControlEnabled(enabled);
GetConfig().then((c: Config) => setConfig(c));
}, []);

const handleAutoStopSilenceChange = useCallback(async (enabled: boolean) => {
await SetAutoStopSilence(enabled);
GetConfig().then((c: Config) => setConfig(c));
}, []);

const handleSoundEnabledChange = useCallback(async (enabled: boolean) => {
await SetSoundEnabled(enabled);
GetConfig().then((c: Config) => setConfig(c));
Expand Down Expand Up @@ -850,6 +871,54 @@ function App() {
</label>
</div>

<div className="setting-row">
<div className="setting-info">
<label>Submit after paste</label>
<p>Press Return after auto-pasting the transcript</p>
</div>
<label className="switch">
<input
type="checkbox"
checked={config?.pasteSubmit ?? false}
onChange={(e) => handlePasteSubmitChange(e.target.checked)}
disabled={!(config?.autoPaste ?? true)}
/>
<span className="slider" />
</label>
</div>

{platform === 'darwin' && (
<div className="setting-row">
<div className="setting-info">
<label>AirPods media mode</label>
<p>Keep a silent media session active so AirPods/media play-pause can control recording</p>
</div>
<label className="switch">
<input
type="checkbox"
checked={config?.airPodsControlEnabled ?? false}
onChange={(e) => handleAirPodsControlChange(e.target.checked)}
/>
<span className="slider" />
</label>
</div>
)}

<div className="setting-row">
<div className="setting-info">
<label>Auto-stop on silence</label>
<p>Stop recording after a short pause in speech</p>
</div>
<label className="switch">
<input
type="checkbox"
checked={config?.autoStopSilence ?? false}
onChange={(e) => handleAutoStopSilenceChange(e.target.checked)}
/>
<span className="slider" />
</label>
</div>

<div className="setting-row">
<div className="setting-info">
<label>Sound feedback</label>
Expand Down
8 changes: 8 additions & 0 deletions frontend/wailsjs/go/main/App.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ export function QuitApp():Promise<void>;

export function RequestMicrophonePermission():Promise<string>;

export function SetAirPodsControlEnabled(arg1:boolean):Promise<void>;

export function SetAudioInputDevice(arg1:string):Promise<void>;

export function SetAutoPaste(arg1:boolean):Promise<void>;

export function SetAutoStopSilence(arg1:boolean):Promise<void>;

export function SetCancelHotkey(arg1:string):Promise<void>;

export function SetModel(arg1:string):Promise<void>;
Expand All @@ -67,6 +71,8 @@ export function SetOnboardingCompleted(arg1:boolean):Promise<void>;

export function SetOpenAIKey(arg1:string):Promise<void>;

export function SetPasteSubmit(arg1:boolean):Promise<void>;

export function SetProvider(arg1:string):Promise<void>;

export function SetRecordingHotkey(arg1:string):Promise<void>;
Expand All @@ -84,3 +90,5 @@ export function StartRecording():Promise<void>;
export function StopRecording():Promise<void>;

export function ToggleRecording():Promise<void>;

export function ToggleRecordingFromMediaControl():Promise<void>;
16 changes: 16 additions & 0 deletions frontend/wailsjs/go/main/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export function RequestMicrophonePermission() {
return window['go']['main']['App']['RequestMicrophonePermission']();
}

export function SetAirPodsControlEnabled(arg1) {
return window['go']['main']['App']['SetAirPodsControlEnabled'](arg1);
}

export function SetAudioInputDevice(arg1) {
return window['go']['main']['App']['SetAudioInputDevice'](arg1);
}
Expand All @@ -114,6 +118,10 @@ export function SetAutoPaste(arg1) {
return window['go']['main']['App']['SetAutoPaste'](arg1);
}

export function SetAutoStopSilence(arg1) {
return window['go']['main']['App']['SetAutoStopSilence'](arg1);
}

export function SetCancelHotkey(arg1) {
return window['go']['main']['App']['SetCancelHotkey'](arg1);
}
Expand All @@ -130,6 +138,10 @@ export function SetOpenAIKey(arg1) {
return window['go']['main']['App']['SetOpenAIKey'](arg1);
}

export function SetPasteSubmit(arg1) {
return window['go']['main']['App']['SetPasteSubmit'](arg1);
}

export function SetProvider(arg1) {
return window['go']['main']['App']['SetProvider'](arg1);
}
Expand Down Expand Up @@ -165,3 +177,7 @@ export function StopRecording() {
export function ToggleRecording() {
return window['go']['main']['App']['ToggleRecording']();
}

export function ToggleRecordingFromMediaControl() {
return window['go']['main']['App']['ToggleRecordingFromMediaControl']();
}
6 changes: 6 additions & 0 deletions frontend/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export namespace models {
openaiApiKey?: string;
audioInputDevice?: string;
autoPaste: boolean;
pasteSubmit: boolean;
airPodsControlEnabled: boolean;
autoStopSilence: boolean;
showNotification: boolean;
recordingHotkey: string;
cancelHotkey: string;
Expand All @@ -132,6 +135,9 @@ export namespace models {
this.openaiApiKey = source["openaiApiKey"];
this.audioInputDevice = source["audioInputDevice"];
this.autoPaste = source["autoPaste"];
this.pasteSubmit = source["pasteSubmit"];
this.airPodsControlEnabled = source["airPodsControlEnabled"];
this.autoStopSilence = source["autoStopSilence"];
this.showNotification = source["showNotification"];
this.recordingHotkey = source["recordingHotkey"];
this.cancelHotkey = source["cancelHotkey"];
Expand Down
Loading