mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add copy button on 'About Lens' dialog
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8ada3c7505
commit
c08c50501c
@ -70,7 +70,8 @@ const applicationMenuItemsInjectable = getInjectable({
|
|||||||
label: `About ${productName}`,
|
label: `About ${productName}`,
|
||||||
id: "about",
|
id: "about",
|
||||||
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
||||||
showAbout(browserWindow);
|
showAbout(browserWindow)
|
||||||
|
.catch(error => logger.error(`[MENU]: Failed to show Lens About view`, { error }));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...ignoreIf(autoUpdateDisabled, [
|
...ignoreIf(autoUpdateDisabled, [
|
||||||
@ -287,7 +288,8 @@ const applicationMenuItemsInjectable = getInjectable({
|
|||||||
label: `About ${productName}`,
|
label: `About ${productName}`,
|
||||||
id: "about",
|
id: "about",
|
||||||
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
click(menuItem: MenuItem, browserWindow: BrowserWindow) {
|
||||||
showAbout(browserWindow);
|
showAbout(browserWindow)
|
||||||
|
.catch(error => logger.error(`[MENU]: Failed to show Lens About view`, { error }));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...ignoreIf(autoUpdateDisabled, [
|
...ignoreIf(autoUpdateDisabled, [
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { BrowserWindow } from "electron";
|
import type { BrowserWindow } from "electron";
|
||||||
import { app, dialog, Menu } from "electron";
|
import { app, clipboard, dialog, Menu } from "electron";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { appName, isWindows, productName } from "../../common/vars";
|
import { appName, isWindows, productName } from "../../common/vars";
|
||||||
@ -20,22 +20,28 @@ export function initMenu(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showAbout(browserWindow: BrowserWindow) {
|
export async function showAbout(browserWindow: BrowserWindow) {
|
||||||
const appInfo = [
|
const appInfo = [
|
||||||
`${appName}: ${app.getVersion()}`,
|
`${appName}: ${app.getVersion()}`,
|
||||||
`Electron: ${process.versions.electron}`,
|
`Electron: ${process.versions.electron}`,
|
||||||
`Chrome: ${process.versions.chrome}`,
|
`Chrome: ${process.versions.chrome}`,
|
||||||
`Node: ${process.versions.node}`,
|
`Node: ${process.versions.node}`,
|
||||||
packageJson.copyright,
|
packageJson.copyright,
|
||||||
];
|
].join("\n");
|
||||||
|
|
||||||
dialog.showMessageBoxSync(browserWindow, {
|
const result = await dialog.showMessageBox(browserWindow, {
|
||||||
title: `${isWindows ? " ".repeat(2) : ""}${appName}`,
|
title: `${isWindows ? " ".repeat(2) : ""}${appName}`,
|
||||||
type: "info",
|
type: "info",
|
||||||
buttons: ["Close"],
|
buttons: ["Close", "Copy"],
|
||||||
message: productName,
|
message: productName,
|
||||||
detail: appInfo.join("\r\n"),
|
detail: appInfo,
|
||||||
|
cancelId: 0,
|
||||||
|
defaultId: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result.response === 0) {
|
||||||
|
clipboard.writeText(appInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildMenu(
|
export function buildMenu(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user