Skip to content

Commit

Permalink
fix: electron open at login notification showed up on every start up
Browse files Browse the repository at this point in the history
  • Loading branch information
roldanjr authored and sekwah41 committed Nov 19, 2023
1 parent bb08a44 commit 654c4db
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/electron/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,16 @@ ipcMain.on(TRAY_ICON_UPDATE, (e, dataUrl) => {
});

ipcMain.on(SET_OPEN_AT_LOGIN, (e, { openAtLogin }) => {
store.safeSet("openAtLogin", openAtLogin);
app.setLoginItemSettings({
openAtLogin: openAtLogin,
openAsHidden: openAtLogin,
});
const storeOpenAtLogin = store.safeGet("openAtLogin");

if (storeOpenAtLogin !== openAtLogin) {
store.safeSet("openAtLogin", openAtLogin);

app.setLoginItemSettings({
openAtLogin: openAtLogin,
openAsHidden: openAtLogin,
});
}
});

app.on("window-all-closed", () => {
Expand Down

0 comments on commit 654c4db

Please sign in to comment.