Created
September 16, 2021 09:02
-
-
Save adodado/40eb852a20361f7e955b9ef080854002 to your computer and use it in GitHub Desktop.
Building a Cross-Platform Desktop Notification Application with Electron initial Index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { app, Tray, Menu } = require("electron"); | |
const path = require("path"); | |
const iconPath = path.join(__dirname, "icon.png"); | |
let trayApp = null; | |
function getContextMenu() { | |
let contextMenu = Menu.buildFromTemplate([ | |
{ | |
label: "Exit", | |
click: function () { | |
app.exit(); | |
}, | |
}, | |
]); | |
return contextMenu; | |
} | |
app.on("ready", () => { | |
trayApp = new Tray(iconPath); | |
var contextMenu = getContextMenu(); | |
trayApp.setToolTip("BreakTime Buddy"); | |
trayApp.setContextMenu(contextMenu); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment