Tasker

Tasker Smart NavBar #5 Better clipboard manager

I continue my Smart NavBar actions series with the last standalone action – clipboard manager. So far, used the NavBar to cast stuff to active PC, automate WhatsApp, or control smart devices that are assigned to the room you are in. This time, I will add a clipboard overlay that can store up to 10 previous clipboards which is great for power users.

NavBar Clipboard manager

For this project to work, I used the clipboard manager idea I had with the fingerprint sensor. This post will explain how I used an array to create the AutoTools WebScreen. This article will focus on changes need to make this work in Smart NavBar actions.

NavBar Clipboard action

When a new clipboard is changed the %CLIP variable updates. I can monitor this to call in a new NavBar action. I want the clipboard icon to appear in the NavBar only for a couple of seconds. To achieve this I will create 2 variables that will take the value of %TIMES (%NBtimestart) and %TIMES+15 (%NBtimestop). Then I will set the NavBar icon.

TASKER PROFILE: NB Clipboard changed
Profile: NB Clipboard Changed 
	Event: Variable Set [ Variable:%CLIP Value:* User Variables Only:Off ]
Enter: NB Clip Change 
	A1: Variable Set [ Name:%NBtimestart To:%TIMES  ] 
	A2: Variable Set [ Name:%NBtimestop To:%TIMES+15  ] 
	A3: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 
	A4: Navigation Bar [ Left:back[1.0] 
						 Center:home[1.0] 
						 Right:task(NB Show Clip)[1.0] ]

These variables are used to define the duration of the time context from the 2nd profile. Unless action is taken, appearing web screen with clipboards will disappear after 15 sec.

On entry, I will simply push the clipboard value to my array and trim the array to show only 10 entries (explanation in this post). Since this is a time context, I assigned the exit task that will run once the %TIMES reflects %NBtimestop. On exit, I simply restore the original NavBar and set time variable to some arbitrary values (0,15).

NavBar Clipboard Manager 12 - for some reason we don't have an alt tag here
TASKER TASK: CM array numbers
CM array numbers (Do This First) 
	A1: Variable Set [ Name:%CMClipPosition To:1.2.3.4.5.6.7.8.9  ] 
	A2: Variable Split [ Name:%CMClipPosition Splitter:. Delete Base:Off ] 

Please note that to display the clipboard you have to create the array first. This is why you have the CM array numbers task to run first.

Extending lifespan of the clipboard

When one of the clips is used, an AutoApps command is sent. This command contains the clipboard=:=#clippressed value. Sending it to the new profile, I’m setting the element of that number from the array as my new clipboard and I’m extending the %NBtimestop by 15 sec.

TASKER PROFILE: NB Set Clipboard
Profile: NB Set Clipboard
	Event: AutoApps Command [ Configuration:Command Filter: clipboard ]
Enter: NB Set New Clip 
	A1: Set Clipboard [ Text:%CMClipboardArray(%aacomm) Add:Off ] 
	A2: Variable Set [ Name:%NBtimestop To:%TIMES+15 ] 

Additional tasks

There are 2 more tasks that I have to create. One will actually open the Clipboad Manager and display the AutoTools web screen.

TASKER TASK: NB Show Clip
NB Show Clip 
	
	A1: Navigation Bar [ Left:back[1.0] 
						 Center:home[1.0] 
						 Right:task(NB Clip Close)[1.0] ] 
	A2: AutoTools Web Screen [ Configuration:Screen Preset: Card List
		Display Mode: Dialog
		Source: /storage/emulated/0/AutoTools/cardlist/page.html
		Toast Duration: 5000
		Width: 100
		Height: fill
		Gravity: Bottom Right
		Animation: Slide In From Top
		Show Duration: 500
		Hide Duration: 250
		Close On Command: true
		Wait For Command: true
		Title: Clip
		Search Color: #ffffff
		Filter With Search: true
		Command Prefix: search
		Titles: true
		Subtitles: true
		Subtext Left: true
		Subtext Right: true
		Whole Words: true
		Drawer Width: 80%
		Card Titles: %CMClipPosition()
		Card Subtext Left: %CMClipAbrev()
		Card Commands: %CMClipPosition()
		Commands Prefix: clipboard
		Round Card Icons: true
		Background Color: #BDBDBD
		Accent Color: #F9A825
		Max Card Widths: 90%
		Max Image Heights: 75
		Title Text Size: 5
		Subtitle Text Size: 22
		Card Padding: 0
		Card Alignment: Center
		Item Separator: , Timeout (Seconds):30 ] 

The only addition to the mix is swapping the NavBar icon for the one I can use to close the clipboard. If I change my mind, I want to have an option to close the clipboard manager completely.

TASKER TASK: NB Clip Close
NB Clip Close
	A1: Navigation Bar [ Left:back[1.0] 
						 Center:home[1.0] 
						 Right:task(NB Show Clip)[1.0] ] 
	A2: AutoTools Web Screen [ Configuration:Screen Preset: Swipe
		Display Mode: Close
		Source: /storage/emulated/0/AutoTools/swipe/page.html
		Toast Duration: 5000
		Background Color: #00CE93D8
		Width: 10
		Height: 400
		Gravity: Bottom Right
		Animation: Slide In From Bottom
		Show Duration: 500
		Hide Duration: 250
		Drag: Not Draggable
		Hide Dialog Shadow: true
		Inject In Header: var a=1;
		Commands Prefix: swipe
		Swipe Left: left
		Swipe Right: right
		Swipe Up: up
		Swipe Down: down
		Border Color: #AB47BC
		Border Witdh: 3
		Border Side: Right Timeout (Seconds):30 ] 
	A3: Flash [ Text:Close Long:Off ] 
	A4: Perform Task [ Name:NB Reset Clip Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] 

The other task will run when the close clipboard is triggered and it will close the web screen and restore the original NavBar.

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. The link to that write up will be up soon!

Conclusion

This very unintrusive NavBar Clipboard Manager can help you manage multiple clipboards without taking your precious screen estate when not needed. You can change the number of stored clipboards or the way the cards look. You can download the project from this link.

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Mat Zolnierczyk

I am passionate about technology, cycling, and art. This would explain why my bike has more computing power than your average office. I own notenoughtech.com and I write for xda-developers.com and pocketables.com NotEnoughTECH | Facebook | Twitter |YouTube |Instagram | Google+ |Donate |Patreon

Avatar of Mat Zolnierczyk