Skip to content

Commit

Permalink
Merge pull request #1411 from egeren/feature/project-name-window-title
Browse files Browse the repository at this point in the history
project name added to window title
  • Loading branch information
erdkse authored Mar 3, 2022
2 parents f405d4d + e65c4f3 commit 1e1849e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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';
Expand Down Expand Up @@ -357,7 +357,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;
});

Expand Down Expand Up @@ -489,7 +490,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;
}
Expand Down Expand Up @@ -544,7 +545,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);
Expand Down

0 comments on commit 1e1849e

Please sign in to comment.