Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2020-10-15 15:23:41 +03:00
1 parent 78b199b719
commit aeac903c23
8 files changed
+246 -230

No files matched your search

-2
View File
@@ -27,7 +27,6 @@ export interface UserPreferences {
downloadKubectlBinaries?: boolean;
downloadBinariesPath?: string;
kubectlBinariesPath?: string;
trayEnabled?: boolean;
openAtLogin?: boolean;
}
@@ -54,7 +53,6 @@ export class UserStore extends BaseStore<UserStoreModel> {
colorTheme: UserStore.defaultTheme,
downloadMirror: "default",
downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version
trayEnabled: true,
openAtLogin: true,
};
+2 -5
View File
@@ -88,9 +88,6 @@ app.on("will-quit", (event) => {
logger.info('APP:QUIT');
event.preventDefault(); // prevent app's default shutdown (e.g. required for telemetry, etc.)
clusterManager?.stop(); // close cluster connections
if (userStore.preferences.trayEnabled) {
return; // with tray the app remains open
} else {
app.exit(); // forced app.quit()
}
return; // skip exit to make tray work, to quit go to app's global menu or tray's menu
// app.exit(); // forced app.quit
})
+7
View File
@@ -67,6 +67,13 @@ export function createTrayMenu(windowManager: WindowManager): Menu {
showAbout(browserWindow);
},
},
{ type: 'separator' },
{
label: "Open Lens",
async click() {
await windowManager.ensureMainWindow()
},
},
{
label: "Preferences",
async click() {
+2 -11
View File
@@ -1,7 +1,6 @@
import type { ClusterId } from "../common/cluster-store";
import { clusterStore } from "../common/cluster-store";
import { userStore } from "../common/user-store";
import { observable, reaction } from "mobx";
import { observable } from "mobx";
import { app, BrowserWindow, dialog, ipcMain, shell, webContents } from "electron"
import windowStateKeeper from "electron-window-state"
import { initMenu } from "./menu";
@@ -82,15 +81,7 @@ export class WindowManager {
}
protected initTray() {
this.disposers.trayAutoBind = reaction(() => userStore.preferences.trayEnabled, isEnabled => {
if (isEnabled) {
this.disposers.trayAutoUpdater = initTray(this);
} else if (this.disposers.trayAutoUpdater) {
this.disposers.trayAutoUpdater();
}
}, {
fireImmediately: true
});
this.disposers.trayAutoUpdater = initTray(this);
}
protected bindEvents() {
@@ -175,23 +175,10 @@ export class Preferences extends React.Component {
<h2><Trans>Auto start-up</Trans></h2>
<Checkbox
label={<Trans>Open on start-up</Trans>}
label={<Trans>Automatically start Lens on login</Trans>}
value={preferences.openAtLogin}
onChange={v => preferences.openAtLogin = v}
/>
<small className="hint">
<Trans>Opens Lens app on operation system login</Trans>
</small>
<h2><Trans>Tray icon</Trans></h2>
<Checkbox
label={<Trans>Enable tray icon</Trans>}
value={preferences.trayEnabled}
onChange={v => preferences.trayEnabled = v}
/>
<small className="hint">
<Trans>Adds OS-level tray icon and menu to get quick access to Lens</Trans>
</small>
<h2><Trans>Certificate Trust</Trans></h2>
<Checkbox