# TouchBar Pomodoro - Keeping stuff from other apps in our Touch Bar!

**URL:** <https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908>\
**Category:** Setup/Preset Sharing\
**Tags:** touch-bar, applescript\
**Created:** [January 9, 2020, 9:55pm UTC](https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908 "2020-01-09T21:55:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Azhir](https://community.folivora.ai/user_avatar/community.folivora.ai/azhir/32/7956_2.png) [@Azhir](https://community.folivora.ai/u/Azhir)\
**Post date:** [January 9, 2020, 9:55pm UTC](https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908/1 "2020-01-09T21:55:40Z")

</div>

Hi,  
So I've recently started using BTT GodenChaos for my TouchBar experience on Mac.  
I found this really cool little Pomodoro app that essentially creates an pomodoro timer in your TouchBar. I wanted to find a way to keep it running or create a widget that allows me to keep touch-bar widgets / icons from applications.

I'm trying to get this Pomodoro Tomato Bar widget to work with @goldenchaos and think it will be a great extension to the program. If I'm able to figure out how to get this working I'm more than happy to create a tutorial for programming novices like myself.

> **[ivoronin/TomatoBar](https://github.com/ivoronin/TomatoBar)**
>
> Pomodoro Technique Timer for macOS with Touch Bar support - ivoronin/TomatoBar

---

<div class="post-metadata">

**Author:** ![oliviermattelaer](https://community.folivora.ai/user_avatar/community.folivora.ai/oliviermattelaer/32/67_2.png) [@oliviermattelaer](https://community.folivora.ai/u/oliviermattelaer)\
**Post date:** [January 10, 2020, 10:49pm UTC](https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908/2 "2020-01-10T22:49:40Z")

</div>

I take the challenge to do a small BTT series of script in order to do something with that idea.  
Here is the preset

> **[BetterTouchTool Community](https://community.folivora.ai/session/sso_provider?sso=bm9uY2U9MTcxODAyMDdjMDNiNDk3NTJiMTA1M2Q2MWFmYjQzMDImcmV0dXJuX3Nzb191cmw9aHR0cHM6Ly9zaGFyZS5mb2xpdm9yYS5haS9kaXNjb3Vyc2Vfc3NvL3ZlcmlmeV9kaXNjb3Vyc2Vfc3Nv&sig=0f6eed63fe8d7628d1f8d30eb57902b10565ccd4f9fe2a3faaa45a47340d82a9)**
>
> The official place to discuss BetterTouchTool and share your setups.

  
(But i doubt that the activation group that I use is shared so you might need to create it.

Let me explain the idea (such that it works as a tutorial as well)

In the "all app" section of the touchbar, I have created one button:

 ![Touch Bar Shot 2020-01-10 at 23.26.46](https://community.folivora.ai/uploads/default/original/2X/9/9d67f72ae1920623cba431826f15dd72dbb55680.png)  
If I press the button, I have configure an applescript opening an invite  
 ![Screenshot 2020-01-10 at 23.27.49](https://community.folivora.ai/uploads/default/original/2X/9/90abc52c400e08717c551b695bd7ac5b9784cde6.png)

Which allows to setup the time for the timer.  
The associated applescript is here

```auto

set theResponse to display dialog "Enter number of minuts for the timer" default answer "3" with icon note buttons {"Cancel", "Continue"} default button "Continue"
if button returned of theResponse is not "Continue" then
	return
else
	set nb_min to text returned of theResponse as integer
end if

set nb_sec to nb_min * 60

tell application "BetterTouchTool"
	set_persistent_string_variable "customVariable1" to "running" shared_secret ""
	set_persistent_number_variable "countdown" to nb_sec shared_secret ""
end tell

```

Here you can see that I setup two variable of BTT, one call customVariable1 (will explain why later)  
and the second one, the number of second of the timer.

The reason of the variable customVariable1 is that you can trigger activationgroup based on the value of that variable (see image)

 ![Screenshot 2020-01-10 at 23.32.04](https://community.folivora.ai/uploads/default/original/2X/f/f7322781592222d373589afb39b273dd7089a16a.jpeg)  
This group has a single button (which stop the timer if pressed).  
 ![Touch Bar Shot 2020-01-10 at 23.42.16](https://community.folivora.ai/uploads/default/original/2X/c/c8114ea120cd914383cb327763dd93bc5fb1ce89.png)

Additionally, I have configure a trigger in the "named and other triggers" section.  
I setup a trigger that start to run an applescript as soon as the activation group is activated.

```auto
tell application "BetterTouchTool"
	set nb_sec to get_number_variable ("countdown") shared_secret ""
	repeat while nb_sec is not 0
		set nb_min to nb_sec div 60
		set nb_sec_add to nb_sec mod 60 as integer
		update_trigger "00ED63F8-DA13-4C43-BAC4-AB7D5A032C3C" json "{\"BTTTouchBarButtonName\" : \"" & nb_min & "m" & nb_sec_add & "s\"}" shared_secret ""
		delay 1
		set nb_sec to nb_sec - 1
	end repeat
	set_persistent_number_variable ("countdown") to 0 shared_secret ""
	set_persistent_string_variable ("customVariable1") to "not running" shared_secret ""
	trigger_named_async_without_response "stop_countdown" shared_secret ""
	
end tell

```

So this script

1. Update the name of the button (with the remaining time) every second
2. called a named trigger when we reach the end of the countdown
3. deactivate the conditional group at the end of the countdown (by resetting the variable)

The named\_trigger allows to setup any BTT action. For the demo here, this is just showing a HUD on the screen written stop (but you have all the options of BTT).

 ![Screenshot 2020-01-10 at 23.39.42](https://community.folivora.ai/uploads/default/original/2X/c/c05913c56c857e31975545d759a7863e71607b4e.png)

This is more a proof of concept (and me having fun and experimenting some idea) than a full solution.  
This has therefore many limitation (only one count-down, no reset of the timer, ...)  
But this is something that we can discuss and that everyone should be able to customize to his own needs.

---

<div class="post-metadata">

**Author:** ![Forrestus](https://community.folivora.ai/user_avatar/community.folivora.ai/forrestus/32/16214_2.png) [@Forrestus](https://community.folivora.ai/u/Forrestus)\
**Post date:** [October 19, 2020, 8:22pm UTC](https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908/3 "2020-10-19T20:22:57Z")

</div>

The link to the preset appears to be invalid.

---

<div class="post-metadata">

**Author:** ![Future\_Face](https://community.folivora.ai/user_avatar/community.folivora.ai/future_face/32/13410_2.png) [@Future\_Face](https://community.folivora.ai/u/Future_Face)\
**Post date:** [October 23, 2020, 12:32am UTC](https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908/4 "2020-10-23T00:32:07Z")

</div>

I second that. this would be a nice preset to have

---

<div class="post-metadata">

**Author:** ![Future\_Face](https://community.folivora.ai/user_avatar/community.folivora.ai/future_face/32/13410_2.png) [@Future\_Face](https://community.folivora.ai/u/Future_Face)\
**Post date:** [December 18, 2020, 9:41pm UTC](https://community.folivora.ai/t/touchbar-pomodoro-keeping-stuff-from-other-apps-in-our-touch-bar/12908/5 "2020-12-18T21:41:57Z")

</div>

> [@A simple timer widget for your touchbar!](https://community.folivora.ai/t/a-simple-timer-widget-for-your-touchbar/19434/):
>
> Future – Timer Preset I made a timer preset using code from @Caliguvara's BLueBiRD preset, and based off a picture @yuuiko posted. Open the group to show timers. Select one to highlight it. Press start to start the timer! To reset the timer, hold the timer widget. To (hopefully) do: Make an actual alarm sound play when the timer is done. Menu bar icon that trigg…
