Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wishlist] pause sleep when screen is turned on #511

Open
hydrargyrum opened this issue Nov 13, 2024 · 3 comments
Open

[wishlist] pause sleep when screen is turned on #511

hydrargyrum opened this issue Nov 13, 2024 · 3 comments
Labels
needinfo Further information is requested

Comments

@hydrargyrum
Copy link

hydrargyrum commented Nov 13, 2024

It would be nice if this could work:

  • in the evening, user opens plees app and presses "start" button
  • plees counter starts
  • user sleeps
  • in the middle of the night, user wakes up
  • user presses phone button to turn screen on (and show unlock screen) but does not look at screen
  • plees receives screen turned on event
  • plees stops current counter automatically
  • after 20 minutes (configurable?) without more activity, plees starts another counter automatically
  • in the morning, user wakes up
  • plees stops current counter automatically (and will not wait 20 minutes then)
  • user opens plees and stops the current sleep
  • plees would then count 2 sleeps: evening to night, then night to morning

it would also be fine if instead of stop/start in the night, a pause (new type of sleep?) is recorded

this could also work fine if user wakes up 2 or more times in the night

however be careful that sometimes notifications turn the screen on for a few seconds, this should not be recorded as a sleep pause. if the 2 can't be distinguished, maybe require user to unlock screen in order to pause for 20 minutes

the advantage is that it would not require the user to do a lot of activity on the phone with a lot of light which might make sleeping harder

@vmiklos
Copy link
Owner

vmiklos commented Nov 15, 2024

I'm trying to find something actionable in your request that is not controversial. :-)

In general, we show the average of daily sums as a stat on the screen, so there isn't really a difference between two sleeps with an interruption vs a sleep with pauses. So based on this, no need to pause a sleep: if you interrupt your sleep for some reason, just pause it & start again at a later point.

The other problem is that this app tries hard not to spy on you. The lack of listening on screen events, microphone, etc is considered a feature.

Perhaps the easiest subset of your request would be some kind of auto-start mode -- so in case the phone is idle for a defined period of time, then tracking starts automatically. I didn't check if Android gives you an event that can be used here -- it's a bit recursive (you want to do something on idle, but if you do it, you won't be idle anymore).

Anyhow, you are interested in contributing such an auto-start mode yourself or at least researching what Android APIs could be used here? Thanks.

@vmiklos vmiklos added the needinfo Further information is requested label Nov 15, 2024
@hydrargyrum
Copy link
Author

So based on this, no need to pause a sleep: if you interrupt your sleep for some reason, just pause it & start again at a later point.

And that's where the problem lies (for me): when I'm half-asleep, the last thing I want to do is to unlock my screen, struggle to search for some app while the screen brightness blinds me, spend more time by clicking a few buttons to be extra sure I'll be awake till morning. No, if I'm waking up in the night for more than a dozen minutes, I'd like to track my waking with the least effort possible. A button accessible from the lock screen (just like music players have a pause button there) would be better than unlocking but would still require to look at the screen in the middle of the night though.

I understand it's not necessarily easy to implement (I'm not an android developer, I wouldn't even know where to start).

Consider this a feature for insomniac people that would like to track their wakes even more importantly than start-end of bedtime. But of course, an app cannot accommodate every single user's specific needs! Especially if the app creator isn't compensated for that developing that app.

The other problem is that this app tries hard not to spy on you. The lack of listening on screen events, microphone, etc is considered a feature.

But the app being open-source, there's no trust issue with what the app is doing with the data: we can check it's only kept locally.

Anyhow, you are interested in contributing such an auto-start mode yourself or at least researching what Android APIs could be used here? Thanks.

I'm not an android developer but it seems this might be of interest: https://stackoverflow.com/a/25153216

Intent.ACTION_SCREEN_ON
Intent.ACTION_SCREEN_OFF

@vmiklos
Copy link
Owner

vmiklos commented Nov 17, 2024

A button accessible from the lock screen (just like music players have a pause button there) would be better

Hmm, I'm not sure random apps can add widgets to the lock screen. The music player case seems to be a special case and we should not pretend to be a music player. :-)

But we already provide a quick settings tile that is accessible without unlock, the trouble is that as soon as you tap on it, you still need to unlock. Perhaps that's something to be investigated -- maybe we just need to opt in somewhere to allow start/stop of sleep without unlock. That would be fine, as long as this would be user-configurable. Like, I don't want my kids to be able to change my sleep db, but your use-case would be improved with such a mode.

Anyhow, thanks for brainstorming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants