Skip to content

Add a "Continue After Zero" option to notify but not stop at 0#69

Open
thisismiller wants to merge 2 commits into
eatgrass:masterfrom
thisismiller:infinite-mode
Open

Add a "Continue After Zero" option to notify but not stop at 0#69
thisismiller wants to merge 2 commits into
eatgrass:masterfrom
thisismiller:infinite-mode

Conversation

@thisismiller

@thisismiller thisismiller commented Sep 29, 2024

Copy link
Copy Markdown
Contributor

I found myself getting annoyed that I'd be focused on working on something, and would have to keep restarting a pomodoro on the same task. So I made some changes so that it will notify as a reminder, but keep the clock going for when I'm focused working, and I'll manually stop the timer when I'm done. This is a simpler version version of "flow mode" found in some pomodoro software, of which there's a request for it in #46. It's probably easiest explained just with a screenshot:

image

Feel free to request renames/refactors, as this is a bit more invasive of a change. I'm not in love with the name "Continue After Zero", but I'm failing to think of something short to call it that's more obvious as to what it does.

Aside from adding the new setting, this required:

  • Adding a 'Skip' or 'Next' button to do a Reset+Mode Change. If you want to end your Work and move to Break, this gives you one button to click to do that.
  • Making Timer.timeup be called only once upon the completing tick, as there's now many ticks during which state.elapsed > state.count.
  • Separating logging a completed pomodoro from the notification, so that we can still notify at the intended time, but wait until the user ends the session to log the final duration. This required exposing resolveLogFile from Logger and a bit of wasteful reconstructing of TimerContext, but it'll only run once anyway.
  • Continue After Zero applies equally to Break time.

Checking the "Continue After Zero" box effectively renders Auto-start ignored. If you have Auto-start checked, and click the skip ▷▷ button, it doesn't start the next pomodoro. This is because there's no handling of auto-start in Timer.reset... and I'm kind of unclear if there should be? I could make an actual Timer.skip() to add auto-start handling for this, but if the reset ⟲ button doesn't Auto-start then the skip one probably shouldn't also?

The skip ▷▷ button is just exactly the start button ▷, which I duplicated in inkscape, put it next to the original with a tiny space, and then shrunk the width by 50% so it'd take up about the same amount of space. I, again, am not really sure what's a good design for this button.

Feedback welcome, and thanks for the great plugin. If this is a bit out of the scope of what you wanted for the pomodoro plugin, no worries on rejecting the PR.

Aside from adding the new setting, this required:
- Adding a 'Skip' or 'Next' button to do a Reset+Mode Change
- Making Timer.timeup be called only once upon the completing tick
- Separating logging a completed pomodoro from the notification,
  so that we can still notify at the intended time, but wait until
  the user ends the session to log the final duration.
symo123 added a commit to symo123/obsidian-pomodoro-timer that referenced this pull request Jun 3, 2025
Comment thread src/Timer.ts Outdated
@AmadeusJJ

Copy link
Copy Markdown

Hey, thanks a lot, this is exacty what i was looking for. Can I ask you your final main.js file ? I tried making the appropriate changes but i am not familiar with ts files so it turned out pretty messy.
Thanks !

Co-authored-by: sean borg <sean_borg@hotmail.co.uk>
@thisismiller

Copy link
Copy Markdown
Contributor Author

@AmadeusJJ https://gist.github.com/thisismiller/28e77024fe2c611c79ea44cf0f852ba7

@AmadeusJJ

AmadeusJJ commented Jun 24, 2025

Copy link
Copy Markdown

@thisismiller Thanks a lot !
edit : i have added the following line
"const durationMinutes = Math.round(end.diff(begin, "minutes", true));" after line 4511 and changed the output verbose logger "log.duration" so that it gives the actual worked duration and not the one defined by the initial timer https://gist.github.com/AmadeusJJ/ec2afea1943540807eefc46e8f7e4994 (sorry i am a total noob to github and didn't succeed in proposing a change in your code 😅 )

@thisismiller

Copy link
Copy Markdown
Contributor Author

@AmadeusJJ TimerLog.duration is derived from LogContext.elapsed/60000 (in createLog), so this would seem to imply LogContext.elapsed is being maintained incorrectly? I'm not seeing that behavior though. I do use a custom template, but it prints log.duration directly, and log.duration reflects the actually elapsed time for me 🤔

@thisismiller

Copy link
Copy Markdown
Contributor Author

The log template I use is on https://transactional.blog/personal/time-tracking-in-obsidian (which also gives advice on Weekly Notes and DataView integration)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants