tps.screen

Screen related logic.

exception tps.screen.ScreenNotFoundException

xrandr device could not be found.

tps.screen.disable(screen)

Disables the given screen using xrandr.

Parameters:screen (str) – Name of the output to disable
Returns:None
tps.screen.enable(screen, primary=False, position=None)

Enables given screen using xrandr.

Parameters:
  • screen (str) – Name of the output to enable
  • primary (bool) – Set output as primary
  • position (tuple) – Tuple with (0) relative position and (1) other output. This could be ('right-of', 'LVDS1').
Returns:

None

tps.screen.filter_outputs(outputs, regex)
tps.screen.get_available_screens(output)
tps.screen.get_externals(internal)

Gets the external screens.

You have to specify the internal screen to exclude that from the listing.

;param str internal: Name of the internal screen :returns: List of external screen names :rtype: str

tps.screen.get_internal(config, cache=True)

Matches the regular expression in the config and retrieves the actual name of the internal screen.

The names of the outputs that XRandR reports may be LVDS1 or LVDS-1. The former happens with the Intel driver, the latter with the generic kernel modesetting driver. We do not know what the system will provide, therefore it was decided in GH-125 to use a regular expression in the configuration file. This also gives out-of-the-box support for Yoga users where the internal screen is called eDP1 or eDP-1.

Parameters:
  • config – Configuration parser instance
  • cache (bool) – Compute the value again even if it is cached
tps.screen.get_resolution_and_shift(output)

Retrieves the total resolution of the virtual screen and the position of the given output within that.

The X server seems to generate a huge screen which is then displayed by the physical displays. xrandr gives the size of that (virtual) screen as well as the positions of each display in that.

For example, I currently have the 12.5” 1366×768 ThinkPad X220 display on the right of a 23” 1920×1080 pixel display. xrandr tells me the following:

Screen 0: … current 3286 x 1080 …
LVDS1 … 1366x768+1920+0
DP2 … 1920x1080+0+0

This only shows the interesting parts. The size of the (virtual) screen is 3286×1080 and the position of the internal screen is 1366×768+1920+0. This allows to compute the transformation matrix for this.

tps.screen.get_rotation(screen)

Gets the current rotation of the given screen.

Parameters:screen (str) – Find rotation of given output
Returns:Current direction
Return type:tps.Direction
tps.screen.rotate(screen, direction)

Rotates the screen into the direction.

Parameters:
  • screen (str) – Name of the output to rotate
  • direction (tps.Direction) – New direction
Returns:

None

tps.screen.set_brightness(brightness)

Sets the brightness with xbacklight.

Parameters:brightness (str) – Percent value of brightness, e. g. 60%
Returns:None
tps.screen.set_subpixel_order(direction)

Sets the text subpixel anti-alias order.

Parameters:direction (tps.Direction) – New direction
Returns:None