VIRTUALDESKTOP retu...
 
Notifications
Clear all

We had a major storm through here recently and we suffered damage to the house roof and ceilings. I just received the quote to repair. I’m hoping that a small fraction of the 80,000 odd people that download SDIO and/or Desktop Info every month won’t mind chipping in a few dollars to help out. Click on the big blue button at the bottom of the page to help us keep a roof over our heads, literally!

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.

VIRTUALDESKTOP returning no result

4 Posts
2 Users
0 Reactions
323 Views
(@detlefs)
Active Member Registered
Joined: 5 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


   
Quote
Glenn
(@glenn)
Member Admin
Joined: 7 years ago
Posts: 1501
 

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....


   
ReplyQuote
(@detlefs)
Active Member Registered
Joined: 5 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 🙂


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 7 years ago
Posts: 1501
 

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.


   
ReplyQuote
Glenn's Page