How can I bring Electron app to foreground every "N" minute?

parikhparth23

I am trying to convert this EyeCare Chrome extension into an Electron app so that if you are not using the browser, this app can be installed on your machine and still reminds you to take care of your body and eyes every "N" minute.

The extension is able to open a new browser tab every "N" minute and the tab gets the focus.

I am trying to bring the Electron app to the foreground every "N" minute. I am storing the "N" value in a file and reading from it. N = User selected time (i.e. 10,20,30,40,50,60 min).

Is there a way I can make the Electron app foreground every "N" minute?

It would be great if the solution can be applied to all the platforms (Linux, Windows, and Mac).

Joshua

Use win.focus(); to bring the window to the foreground.

To focus the window every "N" minutes use setInterval like this:

var minsNum = 20; // Minutes in between each focus.
setInterval(function ()
{
    win.focus();
}, minsNum * 60 * 1000); // setInterval uses milliseconds, so we're multiplying by 1000 to get it in seconds.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I bring the Kivy window to the foreground in a Kivy desktop app?

Call the server every minute while app in Foreground

How can I bring my div to the foreground with its background color?

How to find if electron app is in foreground?

How to bring a nodejs app started with forever to foreground?

How do I bring a polygon to the foreground in OpenGL?

bring uwp app in foreground

How can I detect when an NSTimer changes every minute?

React: how can I execute function at exact minute every hour?

How can I redo something every minute in python

How i can execute a code every one minute in php?

Nativescript - How to bring app to foreground when notification is pressed

How can I launch/switch foreground app on Windows 10 IoT

How to bring a child process to foreground

How do I make cron run something every "N"th minute, where n % 5 == 1?

ServiceWorkerRegistration.showNotification in PWA, bring app to foreground

Possible to bring the app from background to foreground?

How can I access multiple instances of mainWindow in an Electron App?

How can I add a custom chrome extension to my Electron app?

How can I use ffplay from Electron.js app?

How can I call server relative URLs in a bundled Electron app?

How can I enable caching of HTML and CSS files on an Electron App?

How can I navigate in electron app from system tray icon

How can I update the time from chosen timezone every minute on my webpage?

How can I automatically update stock prices every minute without refreshing the page?

How can I make an ASP.NET WebAPI program running in an Azure instance update a database every minute?

Android how i can do GET request to my server every minute?

When I bring my app to the foreground doesn´t load the last activity

How to show alert in every ViewController when app is active (foreground)?