Info
Content

(Windows) Focus Grafana Over All Other Windows

Windows is not the optimal system on which to run a full screen instance of a Grafana display, but with certain automation tools it can be pretty solid.

Why is this necessary? Because you may have other applications running on your Grafana display that might pop messages up on the screen. If that happens, Windows will fire this job within 60 seconds and focus the Grafana display overĀ the topĀ of whatever message has popped up.

NOTE: This will not work with the Windows Update pop-up because the Windows update pop-up does not respond to focus commands. Windows Updates are now compulsory and you kinda just have to deal with them.

This is a Windows specific tutorial.

See also:

Requirements:

  • Windows PC
  • An operational Grafana instance

1. Install AutoHotKey

Then click on the AutoHotKey install file:

autohotkey_download.JPG

Click Express Installation:

express_installation.JPG

And then click Exit:

ahk_exit.JPG

2. Create AutoHotKey script to focus Grafana

Open Notepad and copy the code below into it:

IfWinExist, WINDOW_TITLE_HERE
     WinActivate ; use the window found above
else
     WinActivate, Calculator

Replace "WINDOW_TITLE_HERE" with the title of the Grafana dashboard you will be displaying. In order to retrieve the Grafana dashboard title, you can hover your mouse cursor over the relevant browser tab, wait a second, and the full title of that Grafana dashboard will pop up :

hover_mouse_tab.jpg

Now go to File -> Save As... to save this Notepad instance as "file_name.AHK".

file_save_as.JPG

file_name_ahk.JPG

The .AHK extension indicates that this is an AutoHotKey script that will fire the containing script when it runs. Replace "file_name" with whatever is convenient for you.

NOTE: It may be necessary to force Windows Explorer to show you file extensions - if that's the case, open a Windows Explorer instance and check the box indicated in the graphic below:

file_extensions.JPG

Once the file name extensions have been revealed, you will be able to save the Notepad file to a .AHK extension.

3. Create a Task Scheduler job to fire the AHK script on a certain interval

Go to the Cortana search bar and type "Task Scheduler", then click on Task Scheduler.

task_scheduler.JPG

In the resulting Task Scheduler window, click Create Task from the Actions menu.

create_task.JPG

Give this job a name like Focus Grafana:

Focus_Grafana_Job.JPG

Now go to the Triggers tab and click New:

triggers_tab.JPG

  • Set the schedule to Daily
  • Check repeat task every and input 1 minute
  • Set for a duration of to Indefinite
  • Name sure Enabled is checked

trigger_settings.JPG

Go to the Actions tab and click New:

actions_tab.JPG

Click Browse and browse to the location of the AHK script and double-click it.

browse_to_script.JPG

Then click OK:

click_ok.JPG

Windows will now fire the Focus Grafana AHK script every 60 seconds while a user is logged in.

Back to top