Skip to content

Commit

Permalink
wulkano#129 Update context menu
Browse files Browse the repository at this point in the history
- shorten item names
- re-arrange order of items
- add quit option
  • Loading branch information
thethomasz committed Sep 4, 2022
1 parent 9dc2279 commit 2095f7a
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions main/menus/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,36 @@ import {Menu} from 'electron';
import {MenuItemId, MenuOptions} from './utils';
import {pauseRecording, resumeRecording, stopRecording} from '../aperture';

const getRecordMenuTemplate = async (): Promise<MenuOptions> => [
getStopRecordingMenuItem(),
getPauseRecordingMenuItem()
];

const getPausedMenuTemplate = async (): Promise<MenuOptions> => [
getStopRecordingMenuItem(),
getResumeRecordingMenuItem()
];

const getStopRecordingMenuItem = () => ({
id: MenuItemId.stopRecording,
label: 'Stop Recording',
label: 'Stop',
click: stopRecording
});

const getPauseRecordingMenuItem = () => ({
id: MenuItemId.pauseRecording,
label: 'Pause Recording',
label: 'Pause',
click: pauseRecording
});

const getResumeRecordingMenuItem = () => ({
id: MenuItemId.resumeRecording,
label: 'Resume Recording',
label: 'Resume',
click: resumeRecording
});

export const getRecordMenu = async (isPaused: boolean) => {
if (isPaused) {
return Menu.buildFromTemplate(await getPausedMenuTemplate());
const getRecordMenuTemplate = (isPaused: boolean): MenuOptions => [
isPaused ? getResumeRecordingMenuItem() : getPauseRecordingMenuItem(),
getStopRecordingMenuItem(),
{
type: 'separator'
},
{
role: 'quit',
accelerator: 'Command+Q'
}
];

return Menu.buildFromTemplate(await getRecordMenuTemplate());
export const getRecordMenu = async (isPaused: boolean) => {
return Menu.buildFromTemplate(getRecordMenuTemplate(isPaused));
};

0 comments on commit 2095f7a

Please sign in to comment.