It is currently March 28th, 2024, 8:16 am

VirtualDesktop plugin

Share and get help with Plugins and Addons
RadAd
Posts: 13
Joined: January 29th, 2022, 12:29 am

VirtualDesktop plugin

Post by RadAd »

Hi, I have just started using rainmeter and I wanted a plugin for the windows virtual desktop.

It uses an undocumented API to control and query the windows virtual desktop features. As they are undocumented microsoft does change the API occasionally but they have been pretty stable for a while now.

I have only tested this plugin on my current system using Windows 10 21H2. I haven't tried it on Windows 11 yet.

I have included a demo skin to show its use.

Anyway check it out, let me know what you think, any suggestions or improvements.
Thanks.

Image

History
Last edited by RadAd on February 1st, 2022, 3:09 am, edited 4 times in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: VirtualDesktop plugin

Post by eclectic-tech »

The package is "invalid". :uhuh:

You cannot make any changes to rmskin packages after they are created.
If you need, here are the details on creating a rmskin
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: VirtualDesktop plugin

Post by death.crafter »

RadAd wrote: January 29th, 2022, 12:42 am Hi, I have just started using rainmeter and I wanted a plugin for the windows virtual desktop.

It uses an undocumented API to control and query the windows virtual desktop features. As they are undocumented microsoft does change the API occasionally but they have been pretty stable for a while now.

I have only tested this plugin on my current system using Windows 10 21H2. I haven't tried it on Windows 11 yet.

I have included a demo skin to show its use.

Anyway check it out, let me know what you think, any suggestions or improvements.
Thanks.
Can we get the source code?
RadAd
Posts: 13
Joined: January 29th, 2022, 12:29 am

Re: VirtualDesktop plugin

Post by RadAd »

RadAd wrote: January 29th, 2022, 12:42 am Hi, I have just started using rainmeter and I wanted a plugin for the windows virtual desktop.

It uses an undocumented API to control and query the windows virtual desktop features. As they are undocumented microsoft does change the API occasionally but they have been pretty stable for a while now.

I have only tested this plugin on my current system using Windows 10 21H2. I haven't tried it on Windows 11 yet.

I have included a demo skin to show its use.

Anyway check it out, let me know what you think, any suggestions or improvements.
Thanks.
Attachments
VirtualDesktopDemo_1.0.rmskin
(140.77 KiB) Downloaded 197 times
RadAd
Posts: 13
Joined: January 29th, 2022, 12:29 am

Re: VirtualDesktop plugin

Post by RadAd »

death.crafter wrote: January 29th, 2022, 5:37 am Can we get the source code?
I'll be putting it up on github soon.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: VirtualDesktop plugin

Post by eclectic-tech »

Thanks for creating this plugin, no issues using it with my Win10 Pro setup.

Having the desktop name (string and number) values exposed allows customizing based on the current desktop;
like separate wallpapers for each VD! 8-)

After working with your plugin, I have a few requests, if possible :D :
1. Can you have the number value of the MeasureVirtualDesktop measure return the actual desktop number?
It returns a number 1 less than the current desktop, so a 'Calc' measure on the number value, or a 'RegExp substitute' on the string value, is needed to have the value match the current desktop number.

2. Is it possible to incorporate the 'Overview' and 'All Tasks' display functions as plugin features?
I am using AHK scripts to simulate combination key presses to activate those in my skins, but it would be great to not have to use additional software.

Thanks again! :great:

Here's another demo using your plugin and 2 AHK scripts for 'overview' and 'all tasks'.
It includes Rainmeter wallpapers, created by Sgt E. V. McKay (if I remember right), compressed to minimize package size, as backgrounds for desktops.

vd0.png
VirtualDesktopDemo2_1.1.rmskin
(2.66 MiB) Downloaded 209 times
RadAd
Posts: 13
Joined: January 29th, 2022, 12:29 am

Re: VirtualDesktop plugin

Post by RadAd »

eclectic-tech wrote: January 29th, 2022, 9:48 pm After working with your plugin, I have a few requests, if possible :D :
1. Can you have the number value of the MeasureVirtualDesktop measure return the actual desktop number?
It returns a number 1 less than the current desktop, so a 'Calc' measure on the number value, or a 'RegExp substitute' on the string value, is needed to have the value match the current desktop number.
This is the difference between 0-based and 1-based.
The normal "computer" way is to be 0-based, which is the way it currently works.
The normal "natural" way is to be 1-based.

I would like to hear what other people think about this. It should really be consistent with other things in rainmeter so as not to confuse users.
eclectic-tech wrote: January 29th, 2022, 9:48 pm 2. Is it possible to incorporate the 'Overview' and 'All Tasks' display functions as plugin features?
I am using AHK scripts to simulate combination key presses to activate those in my skins, but it would be great to not have to use additional software.
There is nothing in the API for that functionality. The only way I know how to do it is with some kind of send keys like you are using. There seems to be other rainmeter plugins that can do it if you want to avoid using AHK.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: VirtualDesktop plugin

Post by SilverAzide »

RadAd wrote: January 30th, 2022, 11:39 pm This is the difference between 0-based and 1-based.
The normal "computer" way is to be 0-based, which is the way it currently works.
The normal "natural" way is to be 1-based.

I would like to hear what other people think about this. It should really be consistent with other things in rainmeter so as not to confuse users.
The "Rainmeter way" is generally 1-based. Even true/false is often 1/-1 instead of 1/0.

There is a good reason for this. Rainmeter measures are not always synchronous, in that a meter can attempt to read a value from a measure that has not completed initialization yet, because it is running on a different thread. Two good examples are WebParser and UsageMonitor measures. When a measure is uninitialized or disabled, it will return 0. In that scenario, your skin would not be able to tell the difference between zero (the actual value), zero (the measure is not initialized yet), and zero (disabled). Therefore it is often better (if possible or logical) for a measure to return non-zero values.
RadAd
Posts: 13
Joined: January 29th, 2022, 12:29 am

Re: VirtualDesktop plugin

Post by RadAd »

Updated to version 1.1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: VirtualDesktop plugin

Post by eclectic-tech »

Thanks for the update. No more 'Zero' desktops! ;-)
vd1.gif
Post Reply