WDDMan

Z CoUnSiL: Videokonferenční prostředí pro vzdálené tlumočení znakového jazyka
Přejít na: navigace, hledání

The WDDMan is a multiplatform Java library for manipulation with graphical user interfaces. The WDDMan library supports the detection of connected displays, acquiring connected displays' resolutions, detection of open application windows and manipulation with them (closing, changing of size, and moving), and interaction with virtual desktops.

The library is designed to run under operating systems based on Windows, Linux, and MacOS cores.

The WDDMan library (including documentation) is published under The BSD 3-Clause License. The source code is available at: the WDDMan Bitbucket page.

Downloads

WDDMan 1.0

WDDMan 1.0 Javadoc

Up-to-date source code

Features

Window manipulation functions:

  • getting available windows or visible windows,
  • acquiring window size and dimension,
  • moving, resizing and closing windows,
  • moving windows between different virtual desktops (currently supported only on OS Linux. Mac OS support is WIP).

Virtual desktop manipulation functions (currently supported only on OS Linux. Mac OS support is WIP):

  • listing available desktops,
  • acquiring desktop name and position,
  • switching between virtual desktops.

Display functions:

  • acquiring the size of the display area,
  • getting displays and their sizes and positions (currently not working on Mac OS).

Using library

Requirements

  • Java 6 or newer,
  • JNA library (both files -- jna.jar and jna-platform.jar) 3.5.2 or newer,
  • When using WDDMan under MacOS, access for assistive devices must be enabled
  • When using WDDMan under OS Linux, it is necessary to have X Window System supporting Xlib running. Furthermore, xprop and xrandr utilities have to be installed.

Usage

Simple example of WDDMan library usage:

import java.util.logging.Level;
import java.util.logging.Logger;
import wddman.Desktop;
import wddman.UnsupportedOperatingSystemException;
import wddman.WDDMan;
import wddman.WDDManException;
import wddman.Window;

public class Example {

    public static void main(String[] args){        
        try {
            WDDMan wddman = new WDDMan();
            
            for(Window window : wddman.getWindows()) {
                System.out.println(window.getTitle());
            }
            
            int screenWidth = wddman.getScreenWidth();
            int screenHeight = wddman.getScreenHeight();
            
            Window window = wddman.getWindowByTitle("Example");
            window.resize(0, 0, screenWidth/2, screenHeight/2);
            
            Window window2 = wddman.getWindowByTitle("Example 2");
            Desktop findDesktopByPosition = wddman.findDesktopByPosition(1);
            wddman.moveWindowToDesktop(window2, findDesktopByPosition);
            
        } catch (UnsupportedOperatingSystemException ex) {
            Logger.getLogger(UkazkovyPrikladBP.class.getName()).log(Level.SEVERE, null, ex);
        } catch (WDDManException ex) {
            Logger.getLogger(UkazkovyPrikladBP.class.getName()).log(Level.SEVERE, null, ex);
        }
    }   
}

For a more complex example of WDDMan usage, see the WDDMan library testing application.

Full documentation of the WDDMan library can be found in the Online Javadoc documentation.

Suppported operating systems

Suppported operating systems are:

  • Windows XP,
  • Windows Vista,
  • Windows 7,
  • Windows 8,
  • Mac OS X,
  • Linux (using X Window System and supporting Xlib).

Tested operating systems

The WDDMan library has been tested on:

  • Windows 7 Home Premium SP 1, JRE version 1.7.0_45-b18
  • Fedora release 18, JRE version fedora-2.3.5.3.fc18-x86_64
  • Mac OS X 10.6.8, JRE version 1.6.0_65-b14-462-10M4609

You can test the WDDMan library by running the WDDMan.jar file (java -jar WDDMan.jar), or with the parameter manipulation for testing the window and desktop manipulation (java -jar WDDMan.jar manipulation).

Changelog

Version 1.0:

  • initial release