// 引入electron并创建一个Browserwindow
const {
app, BrowserWindow, globalShortcut, Tray, Menu, ipcMain, dialog } = require('electron')
const path = require('path')
const url = require('url')
const pathName = path.join(__dirname, 'demo/javascript/src/NiuniuCapture.exe')
// 保持window对象的全局引用,避免JavaScript对象被垃圾回收时,窗口被自动关闭.
let mainWindow
let tray = null;
var count = 0, timer = null;
var count1 = 0, timer1 = null;
//设置快捷键
app.on('ready', function () {
globalShortcut.register('ctrl+alt+o', function () {
mainWindow.webContents.send('main-process-messages', 'StartCapture')
});
// var t1=setInterval(function(){
// if(!mainWindow.isMinimized()){
// clearInterval(timer);
// }
// })
});
function createWindow() {
//创建浏览器窗口,宽高自定义
mainWindow = new BrowserWindow({
width: 1024, height: 700, minWidth: 712, minHeight: 505, maximizable: true, icon: '/icon.ico', backgroundColor: '#ffffff', frame: false, show: false
})
mainWindow.once('ready-to-show', () => {
mainWindow.show()
})
//加载应用----- electron-quick-start中默认的加载入口
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}
electron 任务栏提示和托盘闪烁
最新推荐文章于 2024-07-01 16:47:29 发布
本文详细介绍了如何使用Electron框架在任务栏创建提示以及实现托盘图标闪烁,帮助开发者提升桌面应用的用户体验。通过示例代码展示了具体的实现步骤,包括设置通知事件、触发托盘闪烁等关键功能。
摘要由CSDN通过智能技术生成