Pomodoro Timer for Streamdeck

Hi!
New (kinda) user here, longtime keyboard maestro user. The stream deck control has made me start digging in a bit more.

I can see timers for the touch bar, can they just be transferred to the SD? Otherwise, any tips on setting up a Pomo timer?

Cheers!

Edit: Added Stream Deck tag

Do without. You're supposed to work when you're in the flow and stop when the flow ends or your girlfriend/boyfriend gets annoyed. Tomatoes can't help you there. Just sayin'... :slightly_smiling_face:

Ok, how about an egg timer for my eggs? :wink:

I don't know your eggs :joy: But I know how people function and I promise you that you don't need tomatoes or eggs to be productive.

Seriously, I unfortunately do not know how to set your pomo timer.

Can you explain what exact functionality you'd need?
Timers should be easy to do (very similar to Touch Bar), is a Pomodoro timer something special?

Oh, you don't know the famous (and useless) Pomodoro technique?

Nah my mindset while working is pure chaos, I can't work with anything that brings structure :smiley:

Pomodoro means simplified, work a certain amount of time, then take a 25 minute break, then work again....and so on.

Ok so you'll need a timer where you can specify multiple time slots and maybe different colors?

Like 10 minute timer (working) => Widget is red
15 minute timer (pause) => Widget is blue

and so on?

I can post some example for that tomorrow, it can be done using a script widget.

In fact, it's more complicated than that. Pomodoro suggests that the working periods become shorter from cycle to cycle, while the breaks, conversely, become longer and longer.

Hey @Andreas_Hegenberg!

@Frank1 is probably right about the famous pomodoro technique, but I would love a timer, and the version I'm familiar with is pretty simple, like what you suggested:

25 minute timer (working 1) => Widget is red
5 minute timer (pause 1) => Widget is blue
25 minute timer (working 2) => Widget is red
5 minute timer (pause 2) => Widget is blue
25 minute timer (working 3) => Widget is red
5 minute timer (pause 3) => Widget is blue
25 minute timer (working 4) => Widget is red
15 minute timer (pause 4) => Widget is blue.

I had one on the SD but hitting the button paused the timer, whereas the functionality I would be looking for ideally would be that at the end of the timer an alarm would go off, then wait for me to hit it again to progress to the next stage. And if I pressed the button before the time had passed, it would progress to the next stage. Fancy extra's would be choosing your own alarm sound and a long press to pause/unpause, but hey, I'm dreaming here.

Admittedly, I've made it more complicated. Even a single 25min / 5 min timer would be great, or even one button for 25mins and one button for 5 mins.

I'm curious as to whether someone with little coding experience could take a touchbar timer and convert for SD, or is it a bit trickier than that.

I'm away for the night, thanks for the response and the app, it's bringing my SD to life. (Though I have been using a few simple BTT trackpad shortcuts for years now, they are second nature now).

1 Like

I wish you a good night :smiley:

image

1 Like

So of course I forgot the most gadgety element. The timer counting down on the steam deck.

If nothing else, it's cool.

Hey!
Any suggestions on where I should look to try to get a timer? :smiley:
Or how I should learn to transform a Touch Bar script into a SD script?

You might want to give Tomighty a try.
image
This slightly older free menubar app still works well.

You can download it here https://www.macupdate.com

Sorry I didn't get to this yet.
If you know some Java Script you can maybe expand on this:

this example just counts down from 300, you would need to do some formatting to get minutes and seconds, but this should be relatively easy:

the assigned action will reset the time when the button is pressed

The widget script:

(async ()=> {

let timeAllowed = 300; //seconds to count down from
let startTime = await callBTT('get_number_variable', {variable_name:'timer_start_time'}); // the time the timer was started, this is set in the assigned action
let timePassed = Math.round((Date.now()-startTime)/1000); // converting from milliseconds to seconds and rounding

returnToBTT(timeAllowed - timePassed + ' s'); // returning the formatted value to BTT, so it can display it on the button

})();

The action script (just to set set the current time when pressing the button)

(async ()=> {
let currentTime = Date.now(); // current time in milliseconds since 1970
let result = await callBTT('set_number_variable', {variable_name:'timer_start_time', to: currentTime});
returnToBTT('timer reset');
})();

Here the full button config (copy & paste into BTT)

Summary
[
  {
    "BTTStreamDeckButtonName" : "Apple\nScript",
    "BTTTriggerType" : 725,
    "BTTTriggerTypeDescription" : "Apple Script Widget",
    "BTTTriggerClass" : "BTTTriggerTypeStreamDeck",
    "BTTPredefinedActionType" : 281,
    "BTTPredefinedActionName" : "Run Real JavaScript",
    "BTTRealJavaScriptString" : "(async ()=> {\nlet current = Date.now();\nlet result = await callBTT('set_number_variable', {variable_name:'timer_start_time', to: current});\n\n\nreturnToBTT(current);\n\n})();",
    "BTTEnabled2" : 1,
    "BTTAlternateModifierKeys" : 0,
    "BTTRepeatDelay" : 0,
    "BTTUUID" : "C6DDEFD2-F418-45AE-B63B-A4BEC597BEEB",
    "BTTNotesInsteadOfDescription" : 0,
    "BTTEnabled" : 1,
    "BTTModifierMode" : 0,
    "BTTOrder" : 0,
    "BTTDisplayOrder" : 0,
    "BTTMergeIntoTouchBarGroups" : 0,
    "BTTTriggerConfig" : {
      "BTTScriptSettings" : {
        "BTTScriptType" : 3,
        "BTTAppleScriptString" : "(async ()=> {\n\nlet timeAllowed = 300; \/\/seconds\n\nlet startTime = await callBTT('get_number_variable', {variable_name:'timer_start_time'});\n\nlet timePassed = Math.round((Date.now()-startTime)\/1000);\n\nreturnToBTT(timeAllowed - timePassed + ' s');\n\n})();",
        "BTTAppleScriptUsePath" : false
      },
      "BTTStreamDeckAlternateBackgroundColor" : "108.194754, 155.000000, 201.000000, 255.000000",
      "BTTStreamDeckIconColor2" : "255, 255, 255, 255",
      "BTTStreamDeckIconColor3" : "255, 255, 255, 255",
      "BTTStreamDeckAlternateIconColor1" : "255, 255, 255, 255",
      "BTTStreamDeckAlternateIconColor2" : "255, 255, 255, 255",
      "BTTStreamDeckImageHeight" : 50,
      "BTTStreamDeckBackgroundColor" : "255.000000, 192.000004, 114.000001, 255.000000",
      "BTTStreamDeckCornerRadius" : 12,
      "BTTStreamDeckAlternateIconColor3" : "255, 255, 255, 255",
      "BTTScriptUpdateInterval" : 1,
      "BTTStreamDeckAlternateImageHeight" : 50,
      "BTTStreamDeckAttributedTitle" : "cnRmZAAAAAADAAAAAgAAAAcAAABUWFQucnRmAQAAAC6UAQAAKwAAAAEAAACMAQAAe1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcY29jb2FydGYyNzA2Clxjb2NvYXRleHRzY2FsaW5nMFxjb2NvYXBsYXRmb3JtMHtcZm9udHRibFxmMFxmbmlsXGZjaGFyc2V0MCBTRkNvbXBhY3QtUmVndWxhcjt9CntcY29sb3J0Ymw7XHJlZDI1NVxncmVlbjI1NVxibHVlMjU1O1xyZWQyNTVcZ3JlZW4yNTVcYmx1ZTI1NTt9CntcKlxleHBhbmRlZGNvbG9ydGJsOztcY3NnZW5lcmljcmdiXGMxMDAwMDBcYzEwMDAwMFxjMTAwMDAwO30KXHBhcmRcdHg1NjBcdHgxMTIwXHR4MTY4MFx0eDIyNDBcdHgyODAwXHR4MzM2MFx0eDM5MjBcdHg0NDgwXHR4NTA0MFx0eDU2MDBcdHg2MTYwXHR4NjcyMFxwYXJkaXJuYXR1cmFsXHFjXHBhcnRpZ2h0ZW5mYWN0b3IwCgpcZjBcZnM1MCBcY2YyIEFwcGxlXApTY3JpcHR9AQAAACMAAAABAAAABwAAAFRYVC5ydGYQAAAAG0NgY7YBAAAAAAAAAAAAAA==",
      "BTTStreamDeckAlternateCornerRadius" : 12,
      "BTTStreamDeckIconColor1" : "255, 255, 255, 255"
    }
  }
]

Thanks so much. I’ll look into minutes and seconds.

I appreciate this very much! :pray:

Hey Frank. Love that site, I wasn’t familiar with it, gonna check it out some more. I have various timer apps, though this one does look good. I’m just really keen to try to work out how to use BTT and the SD together. And I love the idea of the button counting down. It’s the simple (?) things that make me happy!

Cheers!

I have got this running, which is no mean feat as I have no idea what I'm doing! :grinning:

It's displaying the remaining seconds and counting down.

Could anyone direct me to a decent 'teach myself javascript' site to start working on things like: 1) adding minutes and second.
2) having the second press of the button pause (and then unpause on 3rd press)
3) Long hold to reset the timer.

Obviously a javascript course isn't going to address any of them, but the problem I've always found with JS for me is that I've never had a sandbox in which to use it. I feel like I could use this as a sandbox, it would give me some purpose to my tinkering. So I might get there. The actual features aren't that important, as Frank said, there are plenty of apps that do that.

Actually, I think I could manage the long hold myself, because the default action is to reset the timer, so I should be able to take that from the action script and put it in for a long hold. In fact, I'll try that now.

By god, I'm a programmer. :rofl:

(async ()=> {

let timeAllowed = 300; //seconds to count down from
let startTime = await callBTT('get_number_variable', {variable_name:'timer_start_time'}); // the time the timer was started, this is set in the assigned action
let timePassed = Math.round((Date.now()-startTime)/1000); // converting from milliseconds to seconds and rounding

returnToBTT(timeAllowed - timePassed + ' s'); // returning the formatted value to BTT, so it can display it on the button

// If the count down is finished, write some text 
  if (timeAllowed - timePassed < 0) returnToBTT("Time!")
  })();