|
|
@@ -1,12 +1,14 @@ |
|
|
|
const { app, BrowserWindow, powerMonitor } = require('electron'); |
|
|
|
const { app, BrowserWindow, powerMonitor, Tray, Menu } = require('electron'); |
|
|
|
const path = require('path'); |
|
|
|
const os = require('os'); |
|
|
|
|
|
|
|
let tray; |
|
|
|
let mainWindow; |
|
|
|
const endpoint = "https://workx.webtrigon.com/api/v1/device/presence/"; |
|
|
|
|
|
|
|
app.on('ready', () => { |
|
|
|
createMainWindow(); |
|
|
|
createTray(); |
|
|
|
|
|
|
|
const macAddress = getMacAddress(); |
|
|
|
console.log('MAC Address:', macAddress); |
|
|
@@ -92,3 +94,28 @@ function getMacAddress() { |
|
|
|
} |
|
|
|
return null; // If no MAC address found |
|
|
|
} |
|
|
|
|
|
|
|
function createTray() { |
|
|
|
tray = new Tray(path.join(__dirname, 'logo.png')); |
|
|
|
const contextMenu = Menu.buildFromTemplate([ |
|
|
|
{ |
|
|
|
label: 'Show App', |
|
|
|
click: () => { |
|
|
|
mainWindow.show(); // Show the main window |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: 'Quit', |
|
|
|
click: () => { |
|
|
|
app.quit(); // Quit the app |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
|
|
|
|
tray.setToolTip('Monitoring Tool'); |
|
|
|
tray.setContextMenu(contextMenu); |
|
|
|
|
|
|
|
tray.on('click', () => { |
|
|
|
mainWindow.show(); // Show the main window when the tray icon is clicked |
|
|
|
}); |
|
|
|
} |