mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-14 11:34:43 +08:00
- 添加 captionWindowWidth 属性,用于保存字幕窗口宽度 - 修改 CaptionEngine 中的 stop 和 kill 方法,优化字幕引擎关闭逻辑 - 更新 README,添加预备模型列表
37 lines
922 B
TypeScript
37 lines
922 B
TypeScript
import { app, BrowserWindow } from 'electron'
|
|
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
|
import { controlWindow } from './ControlWindow'
|
|
import { captionWindow } from './CaptionWindow'
|
|
import { allConfig } from './utils/AllConfig'
|
|
import { captionEngine } from './utils/CaptionEngine'
|
|
|
|
app.whenReady().then(() => {
|
|
electronApp.setAppUserModelId('com.himeditator.autocaption')
|
|
|
|
app.on('browser-window-created', (_, window) => {
|
|
optimizer.watchWindowShortcuts(window)
|
|
})
|
|
|
|
controlWindow.handleMessage()
|
|
captionWindow.handleMessage()
|
|
|
|
controlWindow.createWindow()
|
|
|
|
app.on('activate', function () {
|
|
if (BrowserWindow.getAllWindows().length === 0){
|
|
controlWindow.createWindow()
|
|
}
|
|
})
|
|
})
|
|
|
|
app.on('will-quit', async () => {
|
|
captionEngine.kill()
|
|
allConfig.writeConfig()
|
|
});
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit()
|
|
}
|
|
})
|