mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
current database in app title
This commit is contained in:
parent
8a60e54d3b
commit
bb3c17d6d5
@ -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);
|
||||
|
@ -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 />
|
||||
|
17
packages/web/src/utility/AppTitleProvider.svelte
Normal file
17
packages/web/src/utility/AppTitleProvider.svelte
Normal 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>
|
Loading…
Reference in New Issue
Block a user