diff --git a/.vscode/settings.json b/.vscode/settings.json index c21e9f5a..aa3ac164 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,8 @@ "PostgreSQL", "SQLite", "Windows", - "translation" + "translation", + "Linux" ], "svg.preview.background": "transparent" } \ No newline at end of file diff --git a/src/main/main.ts b/src/main/main.ts index bbb32ce9..6a9d3df6 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -14,7 +14,7 @@ const isDevelopment = process.env.NODE_ENV !== 'production'; const isMacOS = process.platform === 'darwin'; const isLinux = process.platform === 'linux'; const isWindows = process.platform === 'win32'; -const gotTheLock = app.requestSingleInstanceLock(); +const gotTheLock = app.requestSingleInstanceLock(); process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'; @@ -91,6 +91,11 @@ else { }); }); + + ipcMain.on('change-window-title', (event, title: string) => { + mainWindow.setTitle(title) + }); + // quit application when all windows are closed app.on('window-all-closed', () => { // on macOS it is common for applications to stay open until the user explicitly quits diff --git a/src/renderer/components/TheTitleBar.vue b/src/renderer/components/TheTitleBar.vue index 538d5a7a..057f1b39 100644 --- a/src/renderer/components/TheTitleBar.vue +++ b/src/renderer/components/TheTitleBar.vue @@ -1,5 +1,5 @@ diff --git a/src/renderer/scss/_variables.scss b/src/renderer/scss/_variables.scss index d382c724..19da6c0e 100644 --- a/src/renderer/scss/_variables.scss +++ b/src/renderer/scss/_variables.scss @@ -27,4 +27,14 @@ $titlebar-height: 1.5rem; $settingbar-width: 3rem; $explorebar-width: 14rem; $footer-height: 1.5rem; -$excluding-size: $footer-height + $titlebar-height; + +@function get-excluding-size(){ + @if $platform == linux{ + @return $footer-height; + } + @else { + @return $footer-height + $titlebar-height; + } +} + +$excluding-size: get-excluding-size(); diff --git a/src/renderer/stores/workspaces.js b/src/renderer/stores/workspaces.js index 8b0be23e..0d1ae129 100644 --- a/src/renderer/stores/workspaces.js +++ b/src/renderer/stores/workspaces.js @@ -1,4 +1,5 @@ import { defineStore, acceptHMRUpdate } from 'pinia'; +import { ipcRenderer } from 'electron'; import Store from 'electron-store'; import Connection from '@/ipc-api/Connection'; import Schema from '@/ipc-api/Schema'; @@ -342,6 +343,17 @@ export const useWorkspacesStore = defineStore('workspaces', { breadcrumbs: { ...breadcrumbsObj, ...payload } } : workspace); + + + const workspace = this.getWorkspace(this.selectedWorkspace); + if(workspace){ + const { getConnectionName } = useConnectionsStore(); + const connectionName = getConnectionName(this.selectedWorkspace); + const breadcrumbs = Object.values(workspace.value.breadcrumbs).filter(breadcrumb => breadcrumb) || [workspace.value.client]; + const windowTitle = [connectionName, ...breadcrumbs].join(' • '); + ipcRenderer.send('change-window-title', windowTitle); + } + }, addLoadedSchema (schema) { this.workspaces = this.workspaces.map(workspace => { diff --git a/webpack.renderer.config.js b/webpack.renderer.config.js index f300182d..eebdfa80 100644 --- a/webpack.renderer.config.js +++ b/webpack.renderer.config.js @@ -104,7 +104,9 @@ const config = { { loader: 'sass-loader', options: { - additionalData: '@import "@/scss/_variables.scss";', + additionalData: ` + $platform: ${process.platform}; + @import "@/scss/_variables.scss";`, sassOptions: { quietDeps: true } } }