mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
- Update window vibrancy to 'sidebar' for better visual effect - Refine input bar styling with softer background and rounded corners - Adjust toolbar button sizes and styling - Modify topic position selection to use Segmented component - Tweak light theme background opacity
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
|
import { app } from 'electron'
|
|
import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer'
|
|
|
|
import { registerIpc } from './ipc'
|
|
import { registerShortcuts } from './services/ShortcutService'
|
|
import { TrayService } from './services/TrayService'
|
|
import { windowService } from './services/WindowService'
|
|
import { updateUserDataPath } from './utils/upgrade'
|
|
|
|
// Check for single instance lock
|
|
if (!app.requestSingleInstanceLock()) {
|
|
app.quit()
|
|
process.exit(0)
|
|
} else {
|
|
// 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(async () => {
|
|
await updateUserDataPath()
|
|
|
|
// Set app user model id for windows
|
|
electronApp.setAppUserModelId(import.meta.env.VITE_MAIN_BUNDLE_ID || 'com.kangfenmao.CherryStudio')
|
|
|
|
const mainWindow = windowService.createMainWindow()
|
|
new TrayService()
|
|
|
|
app.on('activate', function () {
|
|
const mainWindow = windowService.getMainWindow()
|
|
if (!mainWindow || mainWindow.isDestroyed()) {
|
|
windowService.createMainWindow()
|
|
} else {
|
|
windowService.showMainWindow()
|
|
}
|
|
})
|
|
|
|
registerShortcuts(mainWindow)
|
|
|
|
registerIpc(mainWindow, app)
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
installExtension(REDUX_DEVTOOLS)
|
|
.then((name) => console.log(`Added Extension: ${name}`))
|
|
.catch((err) => console.log('An error occurred: ', err))
|
|
}
|
|
})
|
|
|
|
// Listen for second instance
|
|
app.on('second-instance', () => {
|
|
windowService.showMainWindow()
|
|
})
|
|
|
|
app.on('browser-window-created', (_, window) => {
|
|
optimizer.watchWindowShortcuts(window)
|
|
})
|
|
|
|
app.on('before-quit', () => {
|
|
app.isQuitting = true
|
|
})
|
|
|
|
// 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 require them here.
|
|
}
|