diff --git a/packages/desktop/src/index.html b/packages/desktop/src/index.html
index 068da5a4c..9165b97dc 100644
--- a/packages/desktop/src/index.html
+++ b/packages/desktop/src/index.html
@@ -8,9 +8,6 @@
connect-src 'self' ws://localhost:3100;
style-src 'self' 'unsafe-inline';
">
-
-
DataStory
-
diff --git a/packages/desktop/src/index.ts b/packages/desktop/src/index.ts
index cdb3a25c1..dcfe96bad 100644
--- a/packages/desktop/src/index.ts
+++ b/packages/desktop/src/index.ts
@@ -12,6 +12,8 @@ import { IpcResult } from './types';
// ************************************************************************************************
// Electron app, window etc
// ************************************************************************************************
+let mainWindow: BrowserWindow;
+
// This allows TypeScript to pick up the magic constants that's auto-generated by Forge's Webpack
// plugin that tells the Electron app where to look for the Webpack-bundled app code (depending on
@@ -69,6 +71,16 @@ ipcMain.handle('open-diagram', async(): Promise => {
if (!file.canceled && file.filePaths.length > 0) {
result.data = await fsAsync.readFile(file.filePaths[0], 'utf8');
result.isSuccess = true;
+
+ if (mainWindow) {
+ const workspace = file.filePaths[0]; // Or extract a more specific workspace name from the filePath
+ mainWindow.setTitle(`Data Story - ${workspace}`);
+
+ // Persisting the workspace setting
+ const settings = readSettings(); // Assuming this function synchronously returns the settings object
+ settings.workspace = workspace; // Update the workspace setting
+ writeSettings(settings); // Assuming this function takes the settings object and saves it
+ }
}
return result;
} catch(err) {
@@ -79,7 +91,7 @@ ipcMain.handle('open-diagram', async(): Promise => {
const createWindow = (): void => {
// Create the browser window.
- const mainWindow = new BrowserWindow({
+ mainWindow = new BrowserWindow({
height: 600,
width: 800,
webPreferences: {
@@ -118,13 +130,21 @@ app.on('ready', () => {
const settings = readSettings();
writeSettings(settings);
if (settings.workspace) loadEnvs(settings.workspace);
+
+ mainWindow.setTitle(`Data Story - ${settings.workspace || 'Untitled'}`);
});
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
- createWindow();
+ createWindow()
+
+ const settings = readSettings();
+ writeSettings(settings);
+ if (settings.workspace) loadEnvs(settings.workspace);
+
+ mainWindow.setTitle(`Data Story - ${settings.workspace || 'Untitled'}`);
}
});