VirtuaSam v. 1.1

Contents

Intro

VirtuaSam is a Samurize plugin to interface with the virtual desktop manager VirtuaWin.

As such, it can be seen as two things:

VirtuaWin has no graphical interface of its own. It is controlled with the keyboard or through a systray icon, or as in this case, with an external application. This makes it an ideal companion for Samurize, providing virtual desktops integrated in your Samurize config.

VirtuaSam is freeware.

Installation

Unpack the zip-file into your Samurize directory.

You should now be able to use the VirtuaSam plugin in the Samurize config tool. You should also have a sample config called 'VirtuaSam' which demonstrates the various features of the plugin. You can study it for reference, or use it as a basis for your own config.

Remember, you must have VirtuaWin installed and running for this plugin to work.

Instructions

At this point, you should be familiar with making configs in Samurize. If not, check out the Samurize site for docs and tutorials etc.

Creating a virtual desktop controller

Tip

You can have different images for each control by naming them desktop1current.png, desktop1.png, desktop2current.png, desktop2.png etc.

The virtual desktop controller is made by adding an individual plugin meter for each desktop. The meter can be any display type that accepts text as input, but you will probably want to show an image.

Prepare two images, one to show when the desktop is current, and one for when it's not. Which one is shown is determined by making the return value from the plugin part of the name, so the naming is important. You can call the first one desktopcurrent.png and the second one desktop.png (assuming it's png files).

Follow these steps to create a virtual desktop controller in your config:

  1. In Samurize, add a plugin meter and set the 'Draw Type' to 'Image'.
  2. On the 'Source' tab, select 'VirtuaSam.dll' as the plugin.
  3. Select 'isCurrentDesktop' as the function to run.
  4. In the dialog, enter '1' for desktop 1 and press 'OK'.
  5. Accept the default text 'current' by pressing 'OK'.
  6. Accept the default blank text by pressing 'OK'.
  7. On the 'Display' tab, enter <path_to_images>\desktop%v.png, where <path_to_images> is the path where you placed the images.

Now you have a meter showing desktopcurrent.png if desktop 1 is the current one, and desktop.png if it is not. But you're not finished yet. You probably also want to be able to switch to desktop 1 when you click on the meter. This is done by setting up VirtuaSam as input plugin for the meter.

Tip

Adjust the refresh interval for the meter for faster update when you switch desktop (Remember to adjust the display refresh for the project as well). It wont make the switch faster, but you will get faster visual feedback.

  1. On the 'Input' tab, check 'Allow Input Controls' and click 'Add'.
  2. Select 'Plugin Input' and click 'Next'.
  3. Select 'VirtuaSam.dll' and click 'Next'.
  4. Select 'Left Mouse Click' and click 'Finished'.

Now you can switch to desktop 1 by left clicking on the meter.

You might have noticed the input option called 'Drag and Drop'. If you add this option as well, you will be able to drag and drop files on the meter, and have them launched on the corresponding desktop. Just repeat step 8-11, but select 'Drag and Drop' in step 11.

When you're done with the control for desktop 1, copy/paste the meter and adjust the parameters for the 'isCurrentDesktop' function for desktop 2, 3, 4 etc.

Getting a desktop screenshot in your controller

As of version 3.1, VirtuaWin can generate screenshots of your Virtual desktops. This feature can be used in VirtuaSam to get desktop screenshots to represent your virtual desktops.

The VirtuaWin image generation has to be triggered from VirtuaSam, so you need to create another plugin meter to take care of that.

  1. Add a plugin meter.
  2. On the 'Source' tab, select 'VirtuaSam.dll' as the plugin.
  3. Select 'generateDesktopImage' as the function to run.
  4. In the dialog, enter the image height you want, and press 'OK' (The width will depend on the aspect ratio of your screen).
  5. Adjust the refresh interval for the meter to a couple of seconds.

The function will return OK or ERR to make it easier to test your config. You probably don't want to see that when you're done fiddling around, so you can either put the meter behind another meter, or delete the %v from the 'Text' field on the 'Display' tab.

Tip

The screenshots generated by VirtuaWin are not antialiased. To get antialiased images in Samurize, set the image height to e.g. 4 times the desired height, and let Samurize do the antialiasing.

To put the actual screenshots in your config, add a plugin meter for each virtual desktop:

  1. Set the 'Draw Type' to 'Image'.
  2. On the 'Source' tab, select 'VirtuaSam.dll' as the plugin.
  3. Select 'getDesktopImage' as the function to run.
  4. In the dialog, enter the desktop number and press 'OK'.

You can add input events to switch between desktops on the screenshots, but you probably want to be able to see which desktop is the current as well. This can be achieved by adding a meter with isCurrentDesktop, as described above. Place the meter on top of the screenshot, and use semitransparent images, so that you will still be able to see the screenshots of the inactive desktops. Check the sample config for an example.

Reference

Source plugin

The plugin provides four source functions:

isCurrentDesktop

Check if the specified desktop is the current one, and return one of two strings, according to the result. Takes the following parameters:

  • Desktop ID to check (1-9) (Also used as target by the input plugin)
  • String to return if desktop is the current
  • String to return if desktop is NOT the current
getCurrentDesktop
Returns the current desktop number (1-9) as a string.
generateDesktopImage

Tells VirtuaWin to generate a screenshot of the current screen.

Parameter:

  • The height of the generated image. The width will depend on the aspect ratio of your screen.

Returns OK or ERR to indicate the result of the operation.

getDesktopImage

Returns the path of the screenshot generated for the specified desktop.

In fact, it doesn't return the actual path, but tries to reconstruct the path where VirtuaWin saves it's data. It works for me on both Windows XP and Vista, but if it for some reason doesn't work for you, just find the images yourself and use the actual path in your meter.

Parameter:

  • Desktop ID (1-9) (Also used as target by the input plugin)

Input plugin

The plugin also functions as an input plugin. It provides the following actions:

Left Mouse Click, Middle Mouse Click, Right Mouse Click
Switch to the desktop specified in the isCurrentDesktop function of the current meter.
Left Mouse Doubleclick
Switch to and gather all windows on the desktop specified in the isCurrentDesktop function of the current meter.
Drag and Drop
Switch to and launch the dropped files on the desktop specified in the isCurrentDesktop function of the current meter.

Version history

1.1:
  • Support for VirtuaWin desktop screenshots
  • New input action: Doubleclick to gather windows
1.0:
  • Initial release

Contact

Homepage:http://niboan.dk/virtuasam.html
Main site:http://niboan.dk/
email:niels@niboan.dk
Jabber:niels@niboan.dk
ICQ:64338027
MSN:niels@niboan.dk
AIM:niboan