feat: 调整项目多标签切换方案

This commit is contained in:
DEV_DSW
2026-01-19 16:16:56 +08:00
parent bd54a3e88a
commit c6e07ed414
22 changed files with 42 additions and 1209 deletions

View File

@@ -1,9 +1,9 @@
import { app, BrowserWindow } from 'electron'
import { setupWindows } from '@main/wins'
import { CONFIG_KEYS } from '@common/constants'
import started from 'electron-squirrel-startup'
import configManager from '@main/service/config-service'
import logManager from '@main/service/logger'
import { CONFIG_KEYS } from '@common/constants'
import path from "path";
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (started) {
@@ -18,19 +18,32 @@ process.on('unhandledRejection', (reason, promise) => {
logManager.error('unhandledRejection', reason, promise);
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
setupWindows();
// 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.
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
setupWindows();
}
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1920,
height: 1080,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
},
});
// and load the index.html of the app.
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
} else {
mainWindow.loadFile(
path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`)
);
}
// Open the DevTools.
mainWindow.webContents.openDevTools();
};
app.whenReady().then(() => {
createWindow();
});
// Quit when all windows are closed, except on macOS. There, it's common
@@ -43,5 +56,10 @@ app.on('window-all-closed', () => {
}
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
// 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.
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});