From e65c4f36f33bf5225e23aba433ca44bc82dd6898 Mon Sep 17 00:00:00 2001 From: Ege Eren <32365178+egeren@users.noreply.github.com> Date: Mon, 28 Feb 2022 23:07:57 +0300 Subject: [PATCH] project name added to window title --- electron/main.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/electron/main.ts b/electron/main.ts index 3ba0a229b4..2a98261ff6 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -32,7 +32,7 @@ import ElectronStore from 'electron-store'; import {setUserDirs, updateNewVersion} from '@redux/reducers/appConfig'; import {NewVersionCode} from '@models/appconfig'; import {K8sResource} from '@models/k8sresource'; -import {isInPreviewModeSelector, kubeConfigContextSelector, unsavedResourcesSelector} from '@redux/selectors'; +import {isInPreviewModeSelector, kubeConfigContextSelector, unsavedResourcesSelector, activeProjectSelector} from '@redux/selectors'; import {HelmChart, HelmValuesFile} from '@models/helm'; import log from 'loglevel'; import {PROCESS_ENV} from '@utils/env'; @@ -335,7 +335,8 @@ export const createWindow = (givenPath?: string) => { subscribeToStoreStateChanges(win.webContents, (storeState) => { createMenu(storeState, dispatch); - setWindowTitle(storeState, win); + let projectName = activeProjectSelector(storeState)?.name; + setWindowTitle(storeState, win, projectName); unsavedResourceCount = unsavedResourcesSelector(storeState).length; }); @@ -466,7 +467,7 @@ if (MONOKLE_RUN_AS_NODE) { terminal().catch(e => log.error(e)); -export const setWindowTitle = (state: RootState, window: BrowserWindow) => { +export const setWindowTitle = (state: RootState, window: BrowserWindow, projectName?: String) => { if (window.isDestroyed()) { return; } @@ -513,7 +514,7 @@ export const setWindowTitle = (state: RootState, window: BrowserWindow) => { } if (fileMap && fileMap[ROOT_FILE_ENTRY] && fileMap[ROOT_FILE_ENTRY].filePath) { windowTitle = fileMap[ROOT_FILE_ENTRY].filePath; - window.setTitle(`Monokle - ${windowTitle}`); + window.setTitle(`Monokle - ${projectName} -${windowTitle}`); return; } window.setTitle(windowTitle);