Skip to content

Commit e93fea4

Browse files
committed
feat: add about and help commands in tray
1 parent f800b83 commit e93fea4

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "storytel-player",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"email": "andrea@debbaweb.it",
55
"description": "Storytel Unofficial Player - Storytel audiobook player for desktop",
66
"main": "dist/electron/main.js",

src/modules/tray.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Tray, Menu, app} from 'electron';
1+
import {Tray, Menu, app, shell, dialog} from 'electron';
22
import * as path from 'path';
33
import {PlayingState} from '../types';
44
import {WindowManager} from './window';
@@ -85,6 +85,44 @@ export class TrayManager {
8585

8686
menuTemplate.push({type: 'separator'});
8787

88+
menuTemplate.push({
89+
label: "About",
90+
click: () => {
91+
const appInfo = [];
92+
appInfo.push(`storytel-player@${app.getVersion()}\n`);
93+
for (const prop in process.versions) {
94+
if (
95+
prop === "node" ||
96+
prop === "v8" ||
97+
prop === "electron" ||
98+
prop === "chrome"
99+
) {
100+
appInfo.push(`${prop}: ${process.versions[prop]}`);
101+
}
102+
}
103+
dialog.showMessageBoxSync(this.windowManager.getWindow()!, {
104+
buttons: ["OK"],
105+
title: "About",
106+
normalizeAccessKeys: true,
107+
defaultId: 0,
108+
cancelId: 0,
109+
message: appInfo.join("\n"),
110+
type: "info",
111+
});
112+
}
113+
}, {
114+
label: "Help",
115+
submenu: [
116+
{
117+
label: "Github Project",
118+
click: () =>
119+
shell.openExternal(
120+
"https://github.com/debba/storytel-player"
121+
),
122+
}
123+
]
124+
});
125+
88126
if (this.currentPlayingState.isAuthenticated) {
89127
menuTemplate.push({
90128
label: i18n.t('tray.logout'),

0 commit comments

Comments
 (0)