HomeTaskerTasker Smart NavBar #1 Cast to active PC

Tasker Smart NavBar #1 Cast to active PC

How to tell Tasker which PC is active

This smart NavBar action uses an app as the context and casts the relevant information to an active PC. It’s most useful if you want to continue media consumption on the PC of your choice. This could range from opening web interfaces of the apps (Facebook, Messenger, WhatsApp, Chrome) to sending device-specific commands.

What do I mean by “active PC”? This is the computer that has been used recently. I will base my tutorial on ActivePC write-up, so read that up for more details. I will use two ways of detecting the target machine to support more options. In the nutshell, you can cast to the target PC based on:

  • location context (WIFI connected, when EventGhost can’t be used)
  • system.unidle (EventGhost enabled PC)

In this example, I will use the Facebook app as the context and www.facebook.com page to be opened on the target machine. An icon representing my laptop, desktop, and a work computer will display dynamically in the smarter NavBar. These will update based on the location and the last computer used.

Smart NavBar: Cast to active PC

EventGost watches system.idle and system.unidle events. These are created automatically when the computer is not used for 1 min or it’s woken up by an input device, respectively. The information which device is active is sent via AutoRemote to back to your phone. At any given time, Tasker knows which was the last used machine.

There is a minute cooldown associated with the idle messages being issued on the machines, so if you change your computer and return to the same machine, the status won’t be posted. You could fix that with some EventGhost magic from this write-up and your creativity.

Cast Facebook to active PC

The Tasker profile is simple, use Application context to show a new NavBar when Facebook is open. The NavBar contains the following configuration:

  • back[1.0]
  • home[1.0]
  • task(name of the task followed by active device variable)[1.0]

The Smart NavBar will contain the icon of the active PC and will run the task responsible for sending the information to the PC.

Tasker PROJECT: NB Facebook
Profile: NB Facebook 
	Application: Facebook
Enter: NB Open Facebook 
	A1: Navigation Bar [ Left:back[1.0] 
			     Right:task(NB Facebook %ActivePC)[1.0] ] 
		If [ %DEVICELOCATION ~ home ]
	A2: Navigation Bar [ Left:back[1.0] 
			     Right:task(NB Facebook WIFI)[1.0] ] 
		If [ %DEVICELOCATION !~ home ]
	A3: Variable Set [ Name:%NBactiveApp To:Facebook ] 

Exit: NB Reset 
	A1: Variable Set [ Name:%NBactiveApp To:none] 
	A2: Navigation Bar [ Left:back[1.0]
					 Right: ] 

I have created an Entry task which sets the variable %NBactiveApp to Facebook (needed if you going to have multiple apps) and assigns a correct NavBar. The exit task simply resets the NavBar to the default (back, centre, none) settings.

Device Location Profile

Because I promised the contextual control over PC’s that cannot run EventGhost, I can use also WiFi to override this profile. I will create another profile that sets the location to: home, work, or elsewhere. Once again, I will set the %DEVICELOCATION variable as this info can be used in different projects.

Tasker PROFILE: Device Location
Profile: Device Location 
	State: Wifi Connected [ SSID:* MAC:* IP:* Active:Any ]
Enter: Set Dev Locale 
	A1: Variable Set [ Name:%DEVICELOCATION To:home] 
		If [ %WIFII ~R SlowFrog|FastBerry ]
	A2: Variable Set [ Name:%DEVICELOCATION To:work] 
		If [ %WIFII ~R ITC UK ]
	A3: Variable Set [ Name:%DEVICELOCATION To:elsewhere] 
		If [ %WIFII !~R SlowFrog|FastBerry|ITC UK ]
Exit: WIFI reset
    	A1: Variable Set [ Name:%DEVICELOCATION To:elsewhere ]

The location logic will be as follows:

  • work (target my work PC)
  • elsewhere (target my laptop)
  • home (target the active PC)

If the phone is no longer connected the %DEVICELOCATION defaults to “elsewhere“.

Now that I have the location framework, I can use this to control the active PC profile.

Set Active PC Profile

Tasker PROFILE: Set Active PC
Profile: Set ACTIVEPC 
	Event: AutoRemote [ Configuration:activePC (regex) ]
Enter: Set Active PC 
	A1: Variable Set [ Name:%ActivePC To:%arcomm ]	

	A2: If [ %NBactiveApp ~ Facebook & %DEVICELOCATION ~ home ]
		A3: Navigation Bar [ Left:back[1.0] 
				     Right:task(NB Facebook %ACTIVEPC)[1.0] ] 			
	A4: End If

I’d suggest sticking both profiles (Set Active PC & Device Location) into the “main” folder, as these can be referenced by other projects too! Especially, if you are interested in automating WhatsApp (coming soon).

Note that I have enclosed the Smart NavBar actions in IF statement, these actions are specific to Facebook action. I added the %DEVICELOCATION variable, as my dynamic options will only apply when I’m home. This way I can retain the information about the active PC without actually drawing a NavBar each time.

The active PC is stored in the variable %ACTIVEPC (if you want to know why in CAPS, read this article). Each time I change the computer, Tasker receives an AutoRemote message and updates the variable. To make my life less complicated, each computer name is taken from the Join App. I can use the verbatim spelling of the %ACTIVEPC variable to send messages to Join devices.

NB Facebook Laptop/Desktop/WiFi

The easiest way to update the icon in the NavBar was to create a duplicated task with the same action but different name and the icon.

Tasker TASK: NB Facebook Laptop/Desktop
NB Facebook Laptop 
	A1: Join Send Push [ Configuration:Url: https://www.facebook.com/
	      Device Name: %ACTIVEPC Timeout (Seconds):60 ] 
	A2: Flash [ Text:Sent to %ACTIVEPC  Long:Off ]

The location based task is slightly different and uses %DEVICELOCATION to set the correct Join push action:

Tasker TASK: NB Facebook WiFi
NB Facebook WIFI (51)
	A1: Join Send Push [ Configuration:
                Device: Laptop
		Url: https://www.facebook.com/
		 Timeout (Seconds):60 ] 
		If [ %DEVICELOCATION ~ elsewhere ]
	A2: Join Send Push [ Configuration:
                Device: Work
		Url: https://www.facebook.com/ Timeout (Seconds):60 ] 
		If [ %DEVICELOCATION ~ work ]
	A3: Flash [ Text:Done Long:Off ] 

In this case, the devices are hardcoded! Join Push messages are send based only on the %DEVICELOCATION taken from the Locale profile.

Smart NavBar integration

This is a stand-alone version of the Smart NavBar actions. Once I created the standalone versions for each NavBar Task I will show you how to integrate it together. You can read the tutorial about this now!


Android NavBar is underutilised in my opinion, so it’s cool to add extra functionality without adding any additional menus. The contextual character of the NavBar means, that the action is there when you need it most. Next up, I will add extra smart NavBar actions to WhatsApp. If you have any comments or ideas, leave it in this Reddit thread.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

New to Tasker?

Tasker Quick Start – Getting started with Tasker

From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

How to wake on LAN computers and put it to sleep with Power Menu,...

How to Wake on LAN properly via Android, Alexa, Google Assistant and Web

7 awesome Bluetooth keyboard shortcuts for Android

7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

Keep your Tasker tidy!

A better way to store Tasker credentials

The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

Who wants a piece of the pie (chart)?