Skip to content

Commit

Permalink
voice mode stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed Dec 23, 2024
1 parent 358a2f4 commit e111b92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/tray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ export default class {
menuItems = menuItems.concat([
{ label: 'Quick Prompt', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.prompt), click: PromptAnywhere.open },
{ label: 'New Chat', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.chat), click: window.openMainWindow },
{ label: 'Realtime Chat', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.realtime), click: window.openRealtimeChatWindow },
{ label: 'Scratchpad', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.scratchpad), click: () => window.openScratchPad() },
{ label: 'Run AI Command', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.command), click: Commander.initCommand },
{ type: 'separator' },
{ label: 'Read Aloud', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.readaloud), click: ReadAloud.read },
{ label: 'Start Dictation', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.transcribe), click: Transcriber.initTranscription },
{ label: 'Voice Mode', accelerator: shortcuts.shortcutAccelerator(configShortcuts?.realtime), click: window.openRealtimeChatWindow },
{ type: 'separator' },
{ label: 'Settings…', click: window.openSettingsWindow },
{ type: 'separator' },
Expand Down
7 changes: 7 additions & 0 deletions src/settings/SettingsShortcuts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<label>Dictation</label>
<InputShortcut v-model="transcribe" @change="save" />
</div>
<div class="group">
<label>Voice Mode</label>
<InputShortcut v-model="realtime" @change="save" />
</div>
</div>
</template>

Expand All @@ -45,6 +49,7 @@ const scratchpad = ref(null)
const command = ref(null)
const readaloud = ref(null)
const transcribe = ref(null)
const realtime = ref(null)
const load = () => {
prompt.value = store.config.shortcuts.prompt
Expand All @@ -53,6 +58,7 @@ const load = () => {
command.value = store.config.shortcuts.command
readaloud.value = store.config.shortcuts.readaloud
transcribe.value = store.config.shortcuts.transcribe
realtime.value = store.config.shortcuts.realtime
}
const save = () => {
Expand All @@ -62,6 +68,7 @@ const save = () => {
store.config.shortcuts.command = command.value
store.config.shortcuts.readaloud = readaloud.value
store.config.shortcuts.transcribe = transcribe.value
store.config.shortcuts.realtime = realtime.value
store.saveSettings()
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/tray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ test('Creates tray', async () => {
tray.install()
expect(tray.tray).toBeDefined()
expect(Menu.buildFromTemplate).toHaveBeenCalled()
expect(Menu.buildFromTemplate.mock.calls[0][0]).toHaveLength(11)
expect(Menu.buildFromTemplate.mock.calls[0][0]).toHaveLength(12)
expect(Menu.buildFromTemplate.mock.calls[0][0].map((item: any) => item.label)).toEqual([
'Quick Prompt', 'New Chat', 'Realtime Chat', 'Scratchpad', 'Run AI Command', 'Read Aloud', 'Start Dictation', undefined, 'Settings…', undefined, 'Quit'
'Quick Prompt', 'New Chat', 'Scratchpad', 'Run AI Command', undefined, 'Read Aloud', 'Start Dictation', 'Voice Mode', undefined, 'Settings…', undefined, 'Quit'
]);
expect(tray.tray.setContextMenu).toHaveBeenCalled()
expect(tray.tray.on).toHaveBeenCalledTimes(2)
Expand Down

0 comments on commit e111b92

Please sign in to comment.