VIRTUALDESKTOP retu...
 
Notifications
Clear all

We appreciate the contributions many of you have been able to make towards repairing the storm damage and keeping a roof over our heads. With your help weโ€™ve been able to complete much of the critical work. There is still work to be done to secure the house and your continued support will be a huge help.

Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.

[Closed] VIRTUALDESKTOP returning no result

4 Posts
2 Users
0 Reactions
1,430 Views
(@detlefs)
Active Member Registered
Joined: 6 years ago
Posts: 6
Topic starter  

Hi,

I'm trying to use VIRTUALDESKTOP= to display the name of current desktop. Though, it only returns <n/a>
VIRTUALDESKTOPS= correctly returns the list of desktops I have

Could it be a bug?

I'm using version 3.4.0 (build 4150)

This is my config (snippet):

VIRTUALDESKTOP=interval:1,style:b,color:%myforeground1%,text:Akt. Desktop,display:%1 %2
VIRTUALDESKTOPS=interval:1,style:b,color:%myforeground1%,text:Desktops,display%1

The result is attached as screenshot. As can be seen, the first line is returning <n/a>, but the second line is treurning three names


   
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

the current virtual desktop is retrieved from "HKCUSOFTWAREMicrosoftWindowsCurrentVersionExplorerSessionInfo???VirtualDesktops" and cross referenced with "HKCUSOFTWAREMicrosoftWindowsCurrentVersionExplorerVirtualDesktops"

I notice sometimes the session info key is not updated in a timely fashion and hence we have a list of virtual desktops but no current desktop. This is not a DTI bug but a delay in Windows updating the registry key.

I noticed on this occasion I had to do something in the second virtual desktop before Windows would update the key. I don't know if this is normal, a coincidence or what....


   
(@detlefs)
Active Member Registered
Joined: 6 years ago
Posts: 6
Topic starter  

Thanks for your explanations. It seems that on my system (Windows 11) the HKCUSOFTWAREMicrosoftWindowsCurrentVersionExplorerSessionInfo???VirtualDesktops gets never filled with anything. I was trying several times, but no value ever showed up there.

Google pointed me finally to a PowerShell module, that can do the trick: Gallery. This module has a command Get-DesktopName that returns the name of the current desktop. Can easily be used with CMD.

The module is also on GitHub. Maybe a look at the code reveals how the dev retrieves the desired information (I'm not good at reading code)

Anyway, for the time being I have a working solution ๐Ÿ™‚


   
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1903
 

Looks like Windows 11 changed it subtly. Notice in HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerVirtualDesktops there is a value called "CurrentVirtualDesktop". This guid exists in the value "VirtualDesktopIDs" list. The position in this list indicates the number of the virtual desktop and you can look up that guid in the child key, "Desktops", to find the name if it's been renamed from the default.

I'll update the code to make sure it works on both Windows 10 and Windows 11.


   
Glenn's Page