Skip to content

Commit

Permalink
Some improvements with tray icon.
Browse files Browse the repository at this point in the history
I've also added a way to "hide" a red dot when the notification is clicked.
  • Loading branch information
SpacingBat3 committed Oct 31, 2020
1 parent 60ef93d commit ce5abe2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ npm install && npm run dist
```
See [their docs](https://www.electron.build/multi-platform-build) if you wish to learn it's usage or type `npm run dist --help` for the built-in help.

Eg.
I've also made a quick script to produce binaries for all architectures on Linux:
```sh
npm run build-linux
```
To built the project for

## Package
The app uses also `electron-builder` to quickly produce unpackaged directory (eg. for testing purpouses).
Expand Down
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ function createWindow () {
if(!win.isFocused()) tray.setImage(appTrayPing);
})

ipcMain.on('notification-clicked', () => {
tray.setImage(appTrayIcon)
})

app.on('browser-window-focus', () => {
tray.setImage(appTrayIcon)
})
Expand Down
3 changes: 3 additions & 0 deletions notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ var NativeNotification = Notification
Notification = function(title, options) {
var notification = new NativeNotification(title, options)
ipc.send('receive-notification')
notification.on('click', () => {
ipc.send('notification-clicked')
})
return notification
}

Expand Down

0 comments on commit ce5abe2

Please sign in to comment.