Closed Szeraax closed 4 years ago
Went and downloaded the 10.0.19041.0 (Build 19041) Windows 10 SDK and searched through it for some references to desktop or names. Didn't find anything. If anyone ever is curious what I was searching specifically:
Search "372E1D3B-38D3-42E4-A15B-8AB2B178F513" (0 hits in 0 files)
Search "A5CD92FF-29BE-454C-8D04-D82879FB3F1B" (2 hits in 2 files)
Search "B5A399E7-1C87-46B8-88E9-FC5747B171BD" (0 hits in 0 files)
Search "C2F03A33-21F5-47FA-B4BB-156362A2F239" (0 hits in 0 files)
Search "C5E0CDCA-7B6E-41B2-9FC4-D93975CC467B" (0 hits in 0 files)
Search "DesktopManager" (99 hits in 11 files)
Search "GetAdjacentDesktop" (0 hits in 0 files)
Search "GetCompatibilityPolicyType" (0 hits in 0 files)
Search "GetDesktop" (429 hits in 159 files)
Search "GetDesktops" (12 hits in 6 files)
Search "GetVirtualDesktopId" (0 hits in 0 files)
Search "IApplicationView" (2674 hits in 39 files)
Search "IVirtualDesktop" (53 hits in 7 files)
Search "IVirtualDesktopManagerInternal" (0 hits in 0 files)
Most relevant hits were in C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
folder around ShlObj, ShObjIdl_core, etc. files.
Hope that helps someone one day.
Due to sad personal reasons I will not be able to deal with this topic during the next weeks. I will then give another answer.
Sorry to hear that. No rush. I tried to find if such capability exists in the SDK and couldn't find anything, so I turn it over to you :) Thanks for the great tool.
@Szeraax
@MScholtes Great work i use your single code file of virtual desktop api for my private project and you can update your code to get the name of virtual desktop
Add public Guid Guid => ivd.GetId()
:
public class Desktop
{
private IVirtualDesktop ivd;
// New property
public Guid Guid => ivd.GetId();
}
And with the Guid you can look into the registry:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops\Desktops
This registry key hast subkeys in format {[GUID OF ivd]}
and every key has an value called "Name". This is an string
object you will finde the correct name.
@lutz , this is great work! Though, I will note that the Guid will ONLY appear in the registry IF you rename the desktop. If it has its default of <Desktop #>, then there is no entry in the registry.
Yes that is true but the default handling can you implement by yourself.
Yes, absolutely. Just wanted it to be clear that desktops don't necessarily appear in that reg key.
Hello Lutz, this is a great finding. Hello Szeraxx, thank you for pointing out the source of a possible failure.
I still have no test machine to date. Is it possible to set the name for a virtual desktop this way too? Maybe with restarting the Explorer shell (or logging off an on)?
Greetings
Markus
To test, I deleted the name property from a desktop and restarted explorer.exe, the desktop's name in windows was just Desktop 3 as the third desktop. yay! I wonder if there is a smaller change that you can use to set desktop name. Restart explorer.exe doesn't seem TOO bad though.
Aight, I tried my hand at this, but since I don't know C#, I am failing miserably. Someone else may be able to look and quickly see what I'm missing.
https://github.com/MScholtes/VirtualDesktop/pull/18
If I hardcode the registry path to a Guid that exists on my local system, then it does pull the name property like you'd expect, so I at least know that that part works.
I've successfully made this work and submitted a PR to share it for others. Closing request.
Win the latest builds from the Windows Insider slow ring, you can new NAME your virtual desktops. Please add the capability for /GetCurrentDesktop or /GetDesktop to return a name instead of an index or something.
Also, I wonder if you can switch to a desktop by name.