-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add wakelock support #1984
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
base: master
Are you sure you want to change the base?
Add wakelock support #1984
Conversation
There could absolutely be cases where this can be useful, but we can't assume that all users want to prevent their screen from locking when they are connected to a session. It should probably be an opt-in feature. |
It should probably be an opt-in feature. 100% agree. This feature is controlled by the newly added If you want, I can try to plumb this configuration option into the (advanced) settings in the UI. This would also require me to add support for toggling the configuration at runtime. |
That sounds great! 😃 |
How are you progressing on this? 🙂 |
644c520
to
78695ba
Compare
Thanks for checking up on this. I have rewritten this, but am currently working on tests. I am at a conference this/next week, but will try to get the tests finished after that. I have pushed my new changes to this PR, but I want to clean them up a little:
|
dff09ce
to
87c7227
Compare
Add a new configuration option `request_wakelock` to allow noVNC to stop the local display from going to sleep. This is especially useful with view-only sessions. This new option has been added to the configuration UI, making it easier for users to configure. When this option is changed at runtime, we will request/release the wake lock. We only hold the view lock while connected to a server. We will also attempt to reacquire the wakelock if we lost it due to a visibility change (the tab becoming inactive, or during the transition into/from fullscreen). All existing unittests have been run, and the change has been manually tested in Firefox 142. Additional tests will be added later.
Add an error state to the WakeLockManager state machine. This adds a transition that can be detected from tests (it otherwise serves no purpose, and the system immediatly transitions back into the released state).
Dispatch an event on each state transition inside the WakeLockManager. This gives the unit tests something to synchronise on, allowing us to write fast, flake-free tests.
87c7227
to
63a63d1
Compare
Add tests to for both the `rfb` side (calling into the new wakelock code), and the new wakelock class (which tracks the desired state and how to get there).
63a63d1
to
428b1f7
Compare
Actually... I ended up finding some time to hack on the last few things I wanted with this. I have updated this PR. Not sure if you would like me to squash these down commits. |
Add a new configuration option
use_wakelock
to allow noVNC to stop the local display from going to sleep. This is especially useful with view-only sessions.We only hold the view lock while connected to a server. We will also attempt to reacquire the wakelock if we lost it due to a visibility change (the tab becoming inactive, or during the transition into/from fullscreen).
All existing unittests have been run (with #1983 manually patched into my working directory), and the change has been manually tested in Firefox 142.