Display Object Functions

Function Synopsis

FunctionBrief Description
w() The desktop's width at its current resolution.
h() The desktop's height at its current resolution.
desktop([desk]) The current desktop. If a value for desktop is supplied, then the display changes to that desktop.
desktop_count() The number of desktops currently available

Function:

w()

The width of the desktop in pixels at the current resolution.

Parameters:

(none)

Return Value:

The width of the desktop in pixels at the current resolution.

Example(s):

import xaut
disp = xaut.display()
w = disp.w()
print("The desktop is currently %d pixels wide") % (w)

Function:

h()

The height of the desktop in pixels at the current resolution.

Parameters:

(none)

Return Value:

The height of the desktop in pixels at the current resolution.

Example(s):

import xaut
disp = xaut.display()
h = disp.h()
print("The desktop is currently %d pixels tall") % (h)

Function:

desktop([desk])

Get the current desktop. If a value for desk is supplied, then the display will change to that desktop and then return that value.

Note also that this software forces the desktop number to be 1 based. Which means that the valid desktops range from 1 to desktop_count() inclusive.

Parameters:

ParamReqDescription
desk no The desktop to change to.

Return Value:

The current desktop, which may or may not have changed.

Example(s):

#Get the current desktop without making any changes
import xaut
disp = xaut.display()
desk = disp.desktop()
print("The current desktop is %d") % (desk)
#Change desktops
#You need at least two desktops available
import xaut
import time
disp = xaut.display()
desk = disp.desktop()
neu = 1
print("Old desktop was %d") % (desk)
if(desk == 1):
    neu = desk + 1
desk = disp.desktop(neu)
while(disp.desktop() != neu):
    pass
print("Now we're at %d") % (desk)

Function:

desktop_count()

Returns the number of desktops as currently configured.

Parameters:

(none)

Return Value:

The current number of desktops.

Example(s):

import xaut
disp = xaut.display()
count = disp.desktop_count()
print("You have %d desktops") % (count)