test
This commit is contained in:
15
src/main/browsers/trans.ts
Normal file
15
src/main/browsers/trans.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { BrowserWindow } from 'electron';
|
||||||
|
|
||||||
|
export const createTransWindow = () => {
|
||||||
|
const window = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
transparent: true,
|
||||||
|
frame: false,
|
||||||
|
});
|
||||||
|
window.loadURL('https://www.baidu.com');
|
||||||
|
setTimeout(() => {
|
||||||
|
window.setPosition(0, 0, true);
|
||||||
|
}, 1000);
|
||||||
|
return window;
|
||||||
|
};
|
||||||
@@ -9,6 +9,7 @@ import { checkShowPage } from './window/page/index.ts';
|
|||||||
import { closeProcess, createProcess } from './process/index.ts';
|
import { closeProcess, createProcess } from './process/index.ts';
|
||||||
import { getElectronResourcePath, isMac } from './system/env.ts';
|
import { getElectronResourcePath, isMac } from './system/env.ts';
|
||||||
import { checkForUpdates } from './updater/index.ts';
|
import { checkForUpdates } from './updater/index.ts';
|
||||||
|
import { createTransWindow } from './browsers/trans.ts';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
@@ -22,25 +23,28 @@ async function createWindow() {
|
|||||||
log.info('createWindow');
|
log.info('createWindow');
|
||||||
log.info('path', getLogPath());
|
log.info('path', getLogPath());
|
||||||
const _session = createSession();
|
const _session = createSession();
|
||||||
mainWindow = new BrowserWindow({
|
// mainWindow = new BrowserWindow({
|
||||||
width: 800,
|
// width: 800,
|
||||||
height: 600,
|
// height: 600,
|
||||||
webPreferences: {
|
// webPreferences: {
|
||||||
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
|
// preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
|
||||||
session: _session,
|
// session: _session,
|
||||||
webSecurity: false,
|
// webSecurity: false,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
loadMenu();
|
loadMenu();
|
||||||
await checkShowPage(mainWindow);
|
// await checkShowPage(mainWindow);
|
||||||
|
let transWindow = createTransWindow();
|
||||||
mainWindow.on('closed', () => {
|
transWindow.on('closed', () => {
|
||||||
mainWindow = null;
|
transWindow = null;
|
||||||
});
|
});
|
||||||
|
// mainWindow.on('closed', () => {
|
||||||
|
// mainWindow = null;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
await createProcess();
|
// await createProcess();
|
||||||
createWindow();
|
createWindow();
|
||||||
if (!isMac()) {
|
if (!isMac()) {
|
||||||
checkForUpdates();
|
checkForUpdates();
|
||||||
|
|||||||
Reference in New Issue
Block a user