Menu > Help > version copied to clipboard on click (#1944)

This commit is contained in:
Colton Shaw 2022-01-07 14:04:15 -05:00 committed by GitHub
parent a49d748c16
commit 8ad949eedb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@
// See LICENSE.txt for license information.
'use strict';
import {app, ipcMain, Menu, MenuItemConstructorOptions, MenuItem, session, shell, WebContents, webContents} from 'electron';
import {app, ipcMain, Menu, MenuItemConstructorOptions, MenuItem, session, shell, WebContents, webContents, clipboard} from 'electron';
import {OPEN_TEAMS_DROPDOWN, SHOW_NEW_SERVER_MODAL} from 'common/communication';
import {Config} from 'common/config';
@ -267,12 +267,17 @@ export function createTemplate(config: Config) {
});
submenu.push(separatorItem);
}
submenu.push({
// eslint-disable-next-line no-undef
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
label: `Version ${app.getVersion()}${__HASH_VERSION__ ? ` commit: ${__HASH_VERSION__}` : ''}`,
enabled: false,
const version = `Version ${app.getVersion()}${__HASH_VERSION__ ? ` commit: ${__HASH_VERSION__}` : ''}`;
submenu.push({
label: version,
enabled: true,
click() {
clipboard.writeText(version);
},
});
template.push({label: 'Hel&p', submenu});