Code Monkey home page Code Monkey logo

Comments (18)

moltar avatar moltar commented on May 17, 2024 1

I think this is still an issue.

I just had a 5 minute timer go off. Full screen.
I closed the lid.
10 minutes passed
I opened the lid, and the timer was still at 4 minutes.

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

Describe the bug

Timer stops working when computer goes to sleep.

To Reproduce

  1. Start timer.
  2. Close computer lid
  3. Wait 2 minutes
  4. Open lid and wait for computer to wake up
  5. Observe timer had not subtracted 2 minutes, and it is currently stopped (not counting).

Expected behavior

Timer continues counting after re-opening of the computer.

Screenshots

N/A

Desktop (please complete the following information):

  • OS: macOS Catalina
  • Version: 10.15.4 (19E287)

Additional context

This feature is mostly important for break timers. When I am on a 15 minute break, the computer may fall asleep.

I've also encountered that and I have no idea how to prevent Operating System to not fall asleep while timer still running.

Anyway thanks for informing me. I will try to fix that ASAP on my next release.

from pomatez.

moltar avatar moltar commented on May 17, 2024

I think the solution would be not to store the remaining seconds, but rather store the start date, and then calculate the remaining time based on that.

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

I'm not that good enough to comprehend what do you mean by that. If possible can you provide some good example on how to do that?

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

I have tried the PowerSaveBlocker of Electron preventing the Operating System from entering sleep mode before but it didn't work on my Laptop.

from pomatez.

moltar avatar moltar commented on May 17, 2024

I am not sure how the app works. But I am assuming there is a sort of thing:

let remainingSeconds = 100

setInterval(() => remainingSeconds = remainingSeconds - 1, 1000)

But instead, should be something like:

const timeStartDate = new Date()
const timerDurationMs = 15 * 60 * 1000
let remainingTime = 0

setInterval(() => {
  remainingTime = timerDurationMs - (new Date().getTime() - timeStartDate.getTime())
}), 1000)

That way, the hard date is saved, and it can always be referenced again.

But maybe this is already how it works, I am not sure.

from pomatez.

moltar avatar moltar commented on May 17, 2024

Then probably want an event like resume when it comes back from sleep to fire of the timers in the UI again:

https://www.electronjs.org/docs/api/power-monitor

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

I am not sure how the app works. But I am assuming there is a sort of thing:

let remainingSeconds = 100

setInterval(() => remainingSeconds = remainingSeconds - 1, 1000)

But instead, should be something like:

const timeStartDate = new Date()
const timerDurationMs = 15 * 60 * 1000
let remainingTime = 0

setInterval(() => {
  remainingTime = timerDurationMs - (new Date().getTime() - timeStartDate.getTime())
}), 1000)

That way, the hard date is saved, and it can always be referenced again.

But maybe this is already how it works, I am not sure.

Does it prevent the Operating System from asleep?

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

Then probably want an event like resume when it comes back from sleep to fire of the timers in the UI again:

https://www.electronjs.org/docs/api/power-monitor

I've also tried it before and it didn't work. I will try it again combining powerMonitor and PowerSaveBlocker with the latest Electron release.

from pomatez.

moltar avatar moltar commented on May 17, 2024

Does it prevent the Operating System from asleep?

Not, but it will re-start from the right time if it wakes up at least.

Otherwise the time is frozen at the time when the system went to sleep.

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

I'm working with the new features of the app right now and will try to fix some bugs including the issue you've posted. I really appreciate your suggestion and will try it if my solutions didn't fix the issue at least.

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

Hi @moltar . I just released new version of the app.

Please visit v2.10.0-beta Release Note.
Also, let me know if the bug you've encountered fixed by this latest version of the app. Have a great day!

from pomatez.

moltar avatar moltar commented on May 17, 2024

Ok, thanks. Upgraded, will try next week.

from pomatez.

moltar avatar moltar commented on May 17, 2024

Got the following immediately after launching the upgraded version:

image

And I can't quit the app now.

from pomatez.

moltar avatar moltar commented on May 17, 2024

The window is squished:

image

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

@moltar just go to Settings and just press Restore Default.

It might happened due to old settings are not compatible with the new features.

Please let me know the results.

from pomatez.

moltar avatar moltar commented on May 17, 2024

just go to Settings and just press Restore Default.

That did fix it, thanks.

from pomatez.

roldanjr avatar roldanjr commented on May 17, 2024

I'm sorry @moltar but I think it is not an issue.

Just don't closed the lid or manually sleep the computer because the app doesn't have the full control to prevent you from making your computer off / sleep. The only concern here is that the app will prevent your computer from automatically sleeping while your computer is on idle especially when full-screen persisted and preventing you from working.

If you really want to take that break. I suggest just don't close the lid. Just wait for the break to finished.

from pomatez.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.