-
-
Notifications
You must be signed in to change notification settings - Fork 679
Windows 10: NVDA does not report which desktop I am on when I switch amongst multiple desktops #5641
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
Comments
It's worth noting that sighted users don't really get any indication
either, certainly not of the name of the desktop. My understanding is
taht this annoys a lot of sighted users too. They can see the Taskbar
change and the visible windows if any. So, if they had similar stuff
open on two desktops, it'll be difficult for them to see what desktop
they're on when they switch. Still, the argument that it's easier for a
sighted user to see what's changed at a glance is valid.
Unfortunately, regardless of any principle/philosophical arguments,
there doesn't appear to be any way in Windows to get the name of the
current desktop, at least not that I've been able to find. Until there
is, this is not possible.
|
Hi, See https://github.com/Ciantic/VirtualDesktopAccessor For a library that lets you access which desktop you are on. The trouble is that it asks for 64bit python. |
Is there a way to get the name of the current desktop in Windows 10,1703? With Narrator, if I switch between desktop, Narrator correctly announces the name of the desktop. Example: Desktop 1, Desktop 2, etc. CC @jcsteh |
Interesting. As far as I recall, Narrator didn't previously do this, so this is new if I'm correct. I still can't find any public APIs to get the current desktop name, nor can I see any way to do it with UIA (but that doesn't mean there isn't something I don't know about). They're possibly using the undocumented APIs used by the VirtualDesktopAccessor project linked above. I took a quick look at VirtualDesktopAccessor. It's all COM interfaces, so we could wrap them with Python comtypes with a bit of work. However, it's probably just easier to use the library. I'd prefer not to have a separate dll if possible, though we'd want to prefix the exported names from the dll if we built it into nvdaHelperLocalWin10. Note that the actual functions (even the code) are in dllmain.h. |
You can now get the name of the desktop using IAccessible (or presumably UIA). It's exposed as the name of the desktop window. It also fires a nameChange event when it changes. The tricky part is how to map this in NVDA. We choose to only use a Window NVDAObject for the desktop window, as we don't want to deal with the client IAccessible. To work around that, we can either implement an IAccessible overlay to capture the nameChange event or special case the desktop nameChange event in IAccessibleHandler. No big deal. The problem is that if there is a foreground change (which there often is, but not always), the desktop name gets silenced before it can speak because we cancel speech for foreground events. To make matters more confusing, there won't be a foreground event if switching desktops ends up keeping you in the same app, which can happen if you were focused on the desktop itself (e.g. Windows+m in both desktops). We could re-visit the cancelSpeech in event_foreground, but that's probably risky. Otherwise, I guess we'll have to special case this somehow in eventHandler. My original thought was to have the event that reports the desktop change get executed after the foreground event. It feels pretty weird to fire a desktop change event after foreground, though. Perhaps a better idea is to set things up so that event_foreground always fires for desktop changes and it handles the desktop name change if there was one. |
Reopening, since this was reverted (#9629) before it ever got into the release. |
I suspect the reason #8259 was causing problems for some users is that even though we were disabling the change handling for <= Windows 10 May 2019, the Desktop IAccessible object's name property still would have called accName on the Desktop IAccessible. That means we probably could have called it in some cases, even on Windows 10 builds where this caused freezes. I'm going to submit a revised PR which deals with this. |
Use: * controlTypes.Role.WINDOW * winVersion.getWinVer/WIN10_1903
You can now rename desktops by right clicking on said desktop. Problem: nvda does not read the name of the desktops you are on. I hear "desktop 1, desktop 2, etc.
|
Hi, when I do rename virtual desktops and switch amongst them, I do hear the new virtual desktop name. I’m assuming this issue is present wih Windows App Essentials add-on installed? If yes, I canont reproduce this. Thanks.
|
Ok, so I can hear the names now, however I have to wait as it says the first window in focus before I hear the name of the desktop I’m on. If the desktop is in the title bar can nvda read that rather than “explorer?
|
Hi, Sorry for the late response. About desktop title being part of Explorer title bar: no as desktop switch announcements are handled by something other than File Explorer, specifically CSRSS (client/server runtime subsystem a.k.a. Windows subsystem process). Basically, when virtual desktop switches occur in more recent Windows 10 releases and on Windows 11, CSRSS fires a name change event on a desktop object it houses before others can raise focus events. As virtual desktop title comes from CSRSS, File Explorer title bar method will not work (sorry). Thanks. |
That’s fine. Makes sense. Thanks for the explanation.
|
Hi, 2023 update: I'm picking this up again - based on work from @jcsteh, I'm editing event handler to bring name change handler early in execute event function, as well as simplifying Jamie's work by creating a new function (again from Jamie's work) that will handle virtual desktop switches. the resulting work closely resembles Jamie's pull request (#11031) but way simpler in my opinion as it will not construct a dedicated IAccessible object for handling virtual desktop announcements unless the need arises in the future. I will indeed give credit to Jamie throughout the Git commit stream. Thanks. |
… to handle possible virtual desktop switches. Re nvaccess#5641. Original work by Jamie Teh (Mozilla): define a dedicated function to handle posible (and real) Windows 10/11 virtual desktop switche announcements. This function checks to make sure this is Widows 10 or later, and if yes, announces desktop name as defined in the event handler module, and clears this string once announcements are done. The actual event responsible for placing virtual desktop name in event handler is name change event from CSRSS (client/server runtime subsystem/Windows subsystem) process, specificlaly desktop object. Handling name change event will be done as part of handling gain focus event, specifically when doing pre-gain focus routine.
…e event coming from CSRSS/desktop object and treat as a possible virtual desktop switch. Re nvaccess#5641. Original idea from Jamie Teh (Mozilla): in 'execute event' function, detect namechange coming from CSRSS/desktop object and treat it as a possible virtual desktop name change before handling focus events. If it turns out this is indeed a virtual desktop switch, set virtual desktop name, then queue handle possible virtual desktop switch routine (250 milliseconds) so desktop switches can be announced when opening/closing/switching virtual desktops while focused on the desktop.
…irtual desktop switches after handling new foreground event. Re nvaccess#5641. Credit: Jamie Teh (Mozilla): handle possible virtual desktop switch announcements after handling new foreground announcement in 'do pre gain focus' routine. This allows virtual desktop names to be announced between actual desktop switch and handling gain focus event, more noticeable when creating new virtual desktops.
… to Windows 10 Version 1903 and later. Re nvaccess#5641. A note from Jamie Teh (Mozila): virtual desktop switch announcement works more effectively in Windows 10 Version 1903 (May 2019 Update) and later, therefore restrict virtual desktop announcement to that feature update and later.
…r virtual desktop name field and handle possible desktop switch function. Re nvaccess#5641
…riable to detect Windows 10 1903 and later. Re nvaccess#5641. In addition to placing winVersion module import at the top of the file, use a dedicated flag to indicate support for virtual desktop switch announcements in Windows 10 Version 1903 (May 2019 Update) and later.
…e and announcement check variables private. Re nvaccess#5641. Reviewed by Sean Budd (NV Access): make virtual desktop name and can nanouncement virtual desktop name variables private - at the moment no add-on appears to need this functionality but this can change if requested by add-on authors.
… to handle possible virtual desktop switches. Re nvaccess#5641. Original work by Jamie Teh (Mozilla): define a dedicated function to handle posible (and real) Windows 10/11 virtual desktop switche announcements. This function checks to make sure this is Widows 10 or later, and if yes, announces desktop name as defined in the event handler module, and clears this string once announcements are done. The actual event responsible for placing virtual desktop name in event handler is name change event from CSRSS (client/server runtime subsystem/Windows subsystem) process, specificlaly desktop object. Handling name change event will be done as part of handling gain focus event, specifically when doing pre-gain focus routine.
…e event coming from CSRSS/desktop object and treat as a possible virtual desktop switch. Re nvaccess#5641. Original idea from Jamie Teh (Mozilla): in 'execute event' function, detect namechange coming from CSRSS/desktop object and treat it as a possible virtual desktop name change before handling focus events. If it turns out this is indeed a virtual desktop switch, set virtual desktop name, then queue handle possible virtual desktop switch routine (250 milliseconds) so desktop switches can be announced when opening/closing/switching virtual desktops while focused on the desktop.
…irtual desktop switches after handling new foreground event. Re nvaccess#5641. Credit: Jamie Teh (Mozilla): handle possible virtual desktop switch announcements after handling new foreground announcement in 'do pre gain focus' routine. This allows virtual desktop names to be announced between actual desktop switch and handling gain focus event, more noticeable when creating new virtual desktops.
… to Windows 10 Version 1903 and later. Re nvaccess#5641. A note from Jamie Teh (Mozila): virtual desktop switch announcement works more effectively in Windows 10 Version 1903 (May 2019 Update) and later, therefore restrict virtual desktop announcement to that feature update and later.
…r virtual desktop name field and handle possible desktop switch function. Re nvaccess#5641
…riable to detect Windows 10 1903 and later. Re nvaccess#5641. In addition to placing winVersion module import at the top of the file, use a dedicated flag to indicate support for virtual desktop switch announcements in Windows 10 Version 1903 (May 2019 Update) and later.
…e and announcement check variables private. Re nvaccess#5641. Reviewed by Sean Budd (NV Access): make virtual desktop name and can nanouncement virtual desktop name variables private - at the moment no add-on appears to need this functionality but this can change if requested by add-on authors.
…#14932) Fixes #5641 Summary of the issue: In Windows 10 and later, NVDA does not announce virtual desktop names wen they are opened, switched, and closed. Description of user facing changes NVDA will announce names of virtual desktops when opening, switching, and closing them. Description of development approach Event handler is extended to include a virtual desktop switch handler and an extension to execute event to catch a name change event coming from CSRSS. --- commits: * Event handler: update copyright header. Re #5641 * Event handler/virtual desktops announcement: use a dedicated function to handle possible virtual desktop switches. Re #5641. Original work by Jamie Teh (Mozilla): define a dedicated function to handle posible (and real) Windows 10/11 virtual desktop switche announcements. This function checks to make sure this is Widows 10 or later, and if yes, announces desktop name as defined in the event handler module, and clears this string once announcements are done. The actual event responsible for placing virtual desktop name in event handler is name change event from CSRSS (client/server runtime subsystem/Windows subsystem) process, specificlaly desktop object. Handling name change event will be done as part of handling gain focus event, specifically when doing pre-gain focus routine. * Event handler/virtual desktop switch announcements: detect name change event coming from CSRSS/desktop object and treat as a possible virtual desktop switch. Re #5641. Original idea from Jamie Teh (Mozilla): in 'execute event' function, detect namechange coming from CSRSS/desktop object and treat it as a possible virtual desktop name change before handling focus events. If it turns out this is indeed a virtual desktop switch, set virtual desktop name, then queue handle possible virtual desktop switch routine (250 milliseconds) so desktop switches can be announced when opening/closing/switching virtual desktops while focused on the desktop. * Event handler/virtual desktop switch announcements: handle possible virtual desktop switches after handling new foreground event. Re #5641. Credit: Jamie Teh (Mozilla): handle possible virtual desktop switch announcements after handling new foreground announcement in 'do pre gain focus' routine. This allows virtual desktop names to be announced between actual desktop switch and handling gain focus event, more noticeable when creating new virtual desktops. * Event handler/virtual desktop switch announcement: limit announcement to Windows 10 Version 1903 and later. Re #5641. A note from Jamie Teh (Mozila): virtual desktop switch announcement works more effectively in Windows 10 Version 1903 (May 2019 Update) and later, therefore restrict virtual desktop announcement to that feature update and later. * Event handler/virtual desktop switch announcement and surrounding code: lint * Event handler/virtual desktop switch announcement: use formatted string literals when logging exceptions with execute event routine. * Event handler/virtual desktop switch announcement: add typing info for virtual desktop name field and handle possible desktop switch function. Re #5641 * Event handler/virtual desktop switch announcement: use a dedicated variable to detect Windows 10 1903 and later. Re #5641. In addition to placing winVersion module import at the top of the file, use a dedicated flag to indicate support for virtual desktop switch announcements in Windows 10 Version 1903 (May 2019 Update) and later. * Event handler: move virtual desktop constants to the top of the file. Reported by several testers: in some cases, NVDA fails to start due to type hint scope issue if a constant is placed between functions. Therefore, move virtual desktops handling to top fo the file next to other constants and data structures. * Event handler: lint (Flake8 ET126) * Event handler/virtual desktop announcements: make virtual desktop name and announcement check variables private. Re #5641. Reviewed by Sean Budd (NV Access): make virtual desktop name and can nanouncement virtual desktop name variables private - at the moment no add-on appears to need this functionality but this can change if requested by add-on authors. * update changes --------- Co-authored-by: Sean Budd <sean@nvaccess.org>
Now NVDA reports the desktop name before focused window what is little annoiyng for me. I prefer to hear focused window first. BTW note that on Windows 11 it works as I expectd - first focused window, then focused desktop. Do you think that current state is better? |
Hi, Virtual desktop switch event is raised not by desktop but rather by Windows itself, specifically a part of Windows that controls user interface display and related functions. in fact, as soon as one presses Control+Windows+left/right arrow, virtual desktop name change event is received by NVDA, and then focus and foreground change events occur. This is actually what causes NVDA (and Narrator) to announce virtual desktop names before focused control name, and this happens on both Windows 10 and 11. I think the experience you are referring to came about thanks to Windows App Essentials add-on. Starting from version 23.06, Windows App Essentials add-on closely resembles NVDA 2023.2 - it will announce virtual desktop name before focused control, which follows the event flow described above. So in some ways, what NVDA does could be considered correct behavior (of course some event sequences can cause problems, so developers must think about balancing things). Hope this helps. Thanks. |
For what it's worth, most reports I have heard (including my own), prefer to
hear the desktop first.
But of course with all such things, there are always others who prefer something
else.
|
I like to hear desktop number then name of desktop but tha’t just I. It I guess dependson how windows renders that.
|
I understand the logic behind it, it is probably my personal preference to not hear the desktop number first, because I know how I am organized and I mostly want to hear the focused window first. Currently in latest snapshots I press nvda+t to quickly hear the focused window. I noticed that narrator does this too, the info about win 11 is from another person, I will werifi that. |
NVDA does not report which desktop I am on when I switch among multiple desktops in windows 10 Professional. To duplicate this, do the following. From with windows 10:
Note:
You will not be told that a new desktop has been created. I believe sighted users do not get a notification either but there is reference to the "show desktop" button appearing.
You will not hear any output from NVDA. I would expect NVDA to say something like desktop1, desktop 2 etc.
Note:
You can hit ctrl+windows+left arrow to switch to a previous desktop but NVDA will not speak which desktop I am on.
As regards the use case for such a notification:
I am using windows 10 professional 64bit and NVDA 2015.4.
The text was updated successfully, but these errors were encountered: