mirror of
https://github.com/LinoSchmidt/StickExporterTX.git
synced 2026-03-21 01:51:15 +01:00
Added notification badge
This commit is contained in:
16
src/index.ts
16
src/index.ts
@@ -54,6 +54,10 @@ if (require('electron-squirrel-startup')) {
|
|||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(platform === Platform.Windows) {
|
||||||
|
app.setAppUserModelId(app.name);
|
||||||
|
}
|
||||||
|
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
@@ -109,7 +113,15 @@ const createWindow = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('setProgress', (event, arg) => {
|
ipcMain.on('setProgress', (event, arg) => {
|
||||||
mainWindow.setProgressBar(parseFloat(arg));
|
const progress = parseFloat(arg);
|
||||||
|
mainWindow.setProgressBar(progress);
|
||||||
|
if(progress === 1 && !mainWindow.isFocused()) {
|
||||||
|
app.setBadgeCount(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.on('focus', () => {
|
||||||
|
app.setBadgeCount(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.on('close', () => {
|
mainWindow.on('close', () => {
|
||||||
@@ -119,6 +131,8 @@ const createWindow = () => {
|
|||||||
ipcMain.on('openApp', () => {
|
ipcMain.on('openApp', () => {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mainWindow.setIcon(path.join(__dirname, '../assets/icon.png'));
|
||||||
};
|
};
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
|
|||||||
Reference in New Issue
Block a user