Skip to content

Ensure screen stays on during say all#17651

Merged
seanbudd merged 6 commits into
nvaccess:masterfrom
LeonarddeR:avoidSLeep
Feb 16, 2025
Merged

Ensure screen stays on during say all#17651
seanbudd merged 6 commits into
nvaccess:masterfrom
LeonarddeR:avoidSLeep

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #17649
Partially reverts #11118
Follow up of #10111, #10643,

Summary of the issue:

On some systems (mine, for example 😉) the screen still locks during a say all even though we reset the system idle timer. We also reset the display timer in the past, but this was reverted in #11118, particularly on request of @btman16

Description of user facing changes

Added a new advanced setting that, when enabled, also resets the display timer.

Description of development approach

  1. Added new helper/wrapper methods to systemUtils
  2. Rather than resetting the timer(s) many times during a say all, we now persist the state during say all using the ES_CONTINUOUS flag. This should avoid an edge case where reading a line takes more then a minute and the sleep timer is a minute, in which case the system will still lock.

Testing strategy:

Tested on my system. Noted that with the feature flag enabled, the system doesn't lock, whereas when disabled, it does lock.

Known issues with pull request:

None known

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@LeonarddeR LeonarddeR requested review from a team as code owners January 24, 2025 13:56
@zstanecic

Copy link
Copy Markdown
Contributor

@LeonarddeR
Just for the sake of the simple check:
What do you get on your system when you write in the windows terminal the following command?
powercfg /a
It is crucial answer, because this behavior has to do with the power schemes of windows and modern standby s0, where you don't have adjustable power plans like in the past, and all is literally regulated from the firmware/bios of your computer.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

The only sleep state I have on this system is hybernate, since I unfortunately don't have S3 here. I once disabled s0 in the bios and was too lazy to re-enable it.

@zstanecic

Copy link
Copy Markdown
Contributor

btw, on some computers, it is not available to turn off the s0..

Comment thread source/gui/settingsDialogs.py Outdated
Comment thread user_docs/en/userGuide.md Outdated
Comment thread source/gui/settingsDialogs.py Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/userGuide.md Outdated
|Default |Disabled|

This option ensures that the screen stays on when reading with say all or with braille (e.g. when pressing scroll buttons).
This avoids the situation where the screen unexpectedly locks during a say all.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option name talks about system lock whereas here, you talk about screen lock. I have not reviewed this PR in detail, but reading the UG does not clarify things for me.

Are we talking about system lock, I guess session lock?) or the screen turning off (black)?

I think that you should describe both the use cases for enabled and for disabled here. Thanks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More specifically and reading #17651 (comment) by @btman16, I have concerns regarding braille.
I'd say that systems using modern standby should never enter standby, thus never lock, when reading braille.

@btman16

btman16 commented Jan 30, 2025 via email

Copy link
Copy Markdown

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@CyrilleB79 I think you are raising valid concerns here.

  1. I'm using screen lock and system lock interchangeably. When the screen is locked, the system is locked and vise versa. May be I should stick with system lock.
  2. We also need to distinguish between the system idle timer and the display idle timer. In a normal situation, resetting the system idle timer should prevent locking, however on newer system, this doesn't seem to be the case. Both in say all and when pressing a braille gesture, we're resetting the idle timer, but this doesn't seem sufficient. This is why this general setting is introduced.
  3. The reason why this general setting is disabled by default is that it resetting the display timer to prevent locking will also result in the display never going black during a say all. This means a negative impact on battery life.

I'm not sure how s3/s0 standby is related here. The problem is not the system idle timer, but the display idle timer. I don't think that's related to system power state, but to display power state, which is a different aspect.

Comment thread source/config/configSpec.py Outdated
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Feb 3, 2025
Comment thread source/braille.py
#: @type: [int, ...]
self.brailleCells = []
self._windowRowBufferOffsets: list[tuple[int, int]] = [(0, 1)]
self._windowRowBufferOffsets: list[tuple[int, int]] = [(0, 0)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are appears to be merge conflicts here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fixed now.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

There was something wrong in the merge process, I rebased on master to get rid of it.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Frankly, the UX of this new option still seems strange and I am not sure to understand it if I only read the User Guide (i.e. not the PR).

The option is called "Prevent system lock during say all or reading with braille". As a simple user, I would wonder:
Who would disable this option? I.e. who would accept that the system locks while reading with braille? If you keep the option as is, you should at least explain that for some systems, system lock is only screen becoming black. And you should explain which system can or cannot let the screen becoming black without locking the session. But that would become a very difficult explanation for all users.

As a user, I would prefer an option "Allow the screen to sleep / become black during say all or while reading braille" or something similar. And NVDA should evaluate itself if the options is relevant or not depending on the standby capabilities of the system. The option should be greyed out on systems where screen standby = session lock because there is no point in enabling session lock while reading braille.

@Adriani90

Copy link
Copy Markdown
Collaborator

What exactly is the purpose of this setting? Is it that users using say all want to have longer batery time while using NVDA? When I use NVDA actively with the keyboard, the screen doesn't get black either. So why should this be optional when using say all?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I initially thought this needn't be an option, but then @btman16 chimed in, saying that it was negatively impacting his battery life. SO that's why it is an option now.
I think I know how to name this in a more obvious way.

@LeonarddeR LeonarddeR changed the title Avoid locking the screen during say all Ensure screen stays on during say all Feb 8, 2025
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

When I use NVDA actively with the keyboard, the screen doesn't get black either. So why should this be optional when using say all?

When NVDA is reading with review cursor say all, the physical cursor isn't moving so there's basically nothing happening from a visible point of view. It makes sense not to prevent the display from turning off in that case.
That said, your remark makes me think we should limit this option to say all only, and then we might want to move it to the speech section instead.

Comment thread user_docs/en/userGuide.md
Comment thread source/gui/settingsDialogs.py Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/userGuide.md Outdated
Comment thread source/gui/settingsDialogs.py Outdated
Comment thread user_docs/en/userGuide.md Outdated
Comment thread user_docs/en/userGuide.md
@seanbudd seanbudd marked this pull request as draft February 14, 2025 02:10
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit a318b80cac

@LeonarddeR LeonarddeR marked this pull request as ready for review February 15, 2025 11:55

@Qchristensen Qchristensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I know this will be appreciated by users.

@seanbudd seanbudd merged commit 1065b05 into nvaccess:master Feb 16, 2025
@github-actions github-actions Bot added this to the 2025.1 milestone Feb 16, 2025
@ruifontes

Copy link
Copy Markdown
Contributor

Yes, using the menus it do not open and NVDA crashs when closing or restarting.
Using the keystroke it opens...

@CyrilleB79

Copy link
Copy Markdown
Contributor

When I use NVDA actively with the keyboard, the screen doesn't get black either. So why should this be optional when using say all?

When NVDA is reading with review cursor say all, the physical cursor isn't moving so there's basically nothing happening from a visible point of view. It makes sense not to prevent the display from turning off in that case.

Does this option apply only to the case where there is no visible move of the cursor, i.e. browse mode cursor on webpages or review cursor? Or does it also apply when there are visible cursor moves, e.g. system caret moved during say all in Notepad, Word, Outlook, etc.?

seanbudd pushed a commit that referenced this pull request Feb 25, 2025
Fixes #17705 
Fixup of #17651

Summary of the issue:
Pr #17651 introduced a feature flag in the general section of the config, but this is not supported yet.

Description of user facing changes
General settings panel can be reopened after saving.

Description of development approach
Rename the flag and make it a boolean.
@LeonarddeR LeonarddeR deleted the avoidSLeep branch August 23, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System still sleeps during say all

9 participants