Skip to content

Desktop

The Desktop module is a Windows 10 only can be used for manipulating virtual desktops and for moving application windows between desktops.

All

Get a list containing the ids of all virtual desktops.

Example

javascript
var desktops = Desktop.all();
for (var i=0; i<desktops.length; i++) {
  Debug.showDialog("Desktop "+desktops[i]);
}

Current

Get the id of the current/active virtual desktop.

Example

javascript
var current = Desktop.current();

Add a new desktop

Will create a new virtual desktop and return its id.

Example

javascript
var d = Desktop.add();

Moving windows between virtual desktops

The moveWindow, moveWindowRight and moveWindowLeft methods can be used to move a window between virtual desktops.

Example

javascript
// Move the window of the current application to an identified desktop (123)
var success = Desktop.moveWindow("123");
// Move window to the desktop to the right of the current desktop
var idOfDesktopMovedTo = Desktop.moveWindowRight();
// ... same for left
idOfDesktopMovedTo = Desktop.moveWindowLeft();

Switching between desktops

Use the switchTo, switchRight and switchLeft methods to switch between virtual desktops.

Example

javascript
// Switch to an identified desktop
var idOfDesktopSwitchedTo = Desktop.switchTo("123");
// Switch to a desktop to the left/right of the current
vidOfDesktopSwitchedTo = Desktop.switchLeft();
idOfDesktopSwitchedTo = Desktop.switchRight();