current database in app title

This commit is contained in:
Jan Prochazka 2022-01-30 10:00:02 +01:00
parent 8a60e54d3b
commit bb3c17d6d5
3 changed files with 22 additions and 0 deletions

View File

@ -164,6 +164,9 @@ ipcMain.on('update-commands', async (event, arg) => {
ipcMain.on('close-window', async (event, arg) => {
mainWindow.close();
});
ipcMain.on('set-title', async (event, arg) => {
mainWindow.setTitle(arg);
});
ipcMain.handle('showOpenDialog', async (event, options) => {
const res = electron.dialog.showOpenDialogSync(mainWindow, options);

View File

@ -16,6 +16,7 @@
import { subscribePermissionCompiler } from './utility/hasPermission';
import { apiCall } from './utility/api';
import { getUsedApps } from './utility/metadataLoaders';
import AppTitleProvider from './utility/AppTitleProvider.svelte';
let loadedApi = false;
@ -70,6 +71,7 @@
<DataGridRowHeightMeter />
<CommandListener />
<PluginsProvider />
<AppTitleProvider />
{#if $loadingPluginStore?.loaded}
<OpenTabsOnStartup />
<Screen />

View File

@ -0,0 +1,17 @@
<script lang="ts">
import { currentDatabase } from '../stores';
import getElectron from './getElectron';
$: title = $currentDatabase?.name ? `${$currentDatabase?.name} - DbGate` : 'DbGate';
$: {
const electron = getElectron();
if (electron) {
electron.send('set-title', title);
}
}
</script>
<svelte:head>
<title>{title}</title>
</svelte:head>