I want to achieve the sticky behaviour of notifications in the electron desktop application until the user clicks on the notification itself.
I am using node-notifier to achieve this behaviour following this documentaion and using ngx-electron to use ElectronService for importing the main.js file in the angular component file.
Here is my main.js file:
const notifier = require('node-notifier')
exports.notifier = (msg) => {
notifier.notify({
title: 'Notify Me',
message: msg,
wait: true,
timeout: 1500000,
sound: true,
icon: './assets/images/logo.png'
});
app.component.ts:
import {ElectronService} from 'ngx-electron';
@Component({
selector: 'app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
public main_js : any;
constructor(private _electronService: ElectronService ) {
this.main_js = this._electronService.remote.require("./main.js");
this.getTasks();
}
getTasks() {
var message = 'New Task Assigned!!!';
this.main_js.notifier(message);
}
}
Electron App Notification:
Currently,I am checking this notification behaviour on Windows Platform and the notification remains sticky until and unless user takes any action including any key press from keyboard or any mouse movement.
I want notification to stuck on the screen until the user clicks on close label of notification itself and not closes on clicking any other part of the screen.