reprostim.qr.disp_mon¶
Display monitoring service and cross-platform API used to list available GUI displays and monitor information, status and functionality to automatically attach external command for certain screen.
Functions
Callback function sample prototype to handle display change events. |
|
|
Lists available displays information and outputs it in the specified format. |
|
Monitors display changes and triggers actions when changes are detected. |
|
Enumerates available display devices based on the specified provider. |
|
Finds a matching display information object from the provided list. |
Classes
|
Class representing display change event. |
|
Enum representing display change event types. |
|
Class representing display info. |
|
Enum representing OS platform constants. |
|
Enum to represent the display monitoring provider/engine depending on used OS environment. |
- class reprostim.qr.disp_mon.DisplayChangeEvent(type: DisplayChangeType | None = None, display: DisplayInfo | None = None, old_display: DisplayInfo | None = None, ts: str = '2026-05-23T21:24:16.376622')[source]¶
Class representing display change event.
- display: DisplayInfo = None¶
Current display information
- old_display: DisplayInfo = None¶
Previous display information if any
- ts: str = '2026-05-23T21:24:16.376622'¶
Timestamp of the event in ISO format
- type: DisplayChangeType = None¶
The type of display change event
- class reprostim.qr.disp_mon.DisplayChangeType(value)[source]¶
Enum representing display change event types.
- CONNECT = 'connect'¶
Display connect event
- DISCONNECT = 'disconnect'¶
Display disconnect event
- MODE = 'mode'¶
Display mode event (resolution or framerate changed)
- class reprostim.qr.disp_mon.DisplayInfo(id: str | None = None, name: str | None = None, width: int = 0, height: int = 0, refresh_rate: float = 0.0, bits_per_pixel: int = 0, is_connected: bool = False, is_active: bool = False, is_main: bool = False, is_sleeping: bool = False, provider: DmProvider | None = None, ts: str = '2026-05-23T21:24:16.375816')[source]¶
Class representing display info.
- bits_per_pixel: int = 0¶
Display color depth in bits per pixel
- height: int = 0¶
Display height in pixels
- id: str = None¶
Display uniue ID
- is_active: bool = False¶
Indicates if the display is active
- is_connected: bool = False¶
Indicates if the display is connected
- is_main: bool = False¶
Indicates if the display is the main one
- is_sleeping: bool = False¶
Indicates if the display is in sleep mode
- name: str = None¶
Display name
- provider: DmProvider = None¶
Used display provider
- refresh_rate: float = 0.0¶
Display refresh rate in Hz
- ts: str = '2026-05-23T21:24:16.375816'¶
Timestamp of the info in ISO format
- width: int = 0¶
Display width in pixels
- class reprostim.qr.disp_mon.DmPlatform(value)[source]¶
Enum representing OS platform constants.
- LINUX = 'linux'¶
Linux platform
- WINDOWS = 'win64'¶
Windows platform
- XOS = 'xos'¶
MacOS platform
- class reprostim.qr.disp_mon.DmProvider(value)[source]¶
Enum to represent the display monitoring provider/engine depending on used OS environment.
- ALL = 'all'¶
Use all available providers
- PLATFORM = 'platform'¶
Use the best OS specific providers
- PYGAME = 'pygame'¶
Cross-platform pygame-based provider
- PYGLET = 'pyglet'¶
Cross-platform pyglet-based provider
- PYUDEV = 'pyudev'¶
Used in Linux, pyudev-based provider
- QUARTZ = 'quartz'¶
Used in MacOS, Quartz-based provider
- RANDR = 'randr'¶
Used in Linux, randr/xlib-based provider
- reprostim.qr.disp_mon.display_change_callback(evt: DisplayChangeEvent)[source]¶
Callback function sample prototype to handle display change events.
- Parameters:
evt (DisplayChangeEvent) – The object containing information about the display change event.
- reprostim.qr.disp_mon.do_list_displays(provider: ~reprostim.qr.disp_mon.DmProvider = DmProvider.PLATFORM, fmt: str = 'jsonl', out_func=<built-in function print>)[source]¶
Lists available displays information and outputs it in the specified format.
- Parameters:
provider (DmProvider) – The display manager provider to use.
fmt (str) – The output format,
jsonl|text.out_func (Callable[[str], None]) – The function used to output the display list (default: print).
- reprostim.qr.disp_mon.do_monitor_displays(provider: ~reprostim.qr.disp_mon.DmProvider = DmProvider.PLATFORM, poll_interval: int = 60, max_wait: int = 3, name: str = '*', d_id: str = '*', on_change: str | None = None, ext_proc_command: str | None = None, out_func=<built-in function print>)[source]¶
Monitors display changes and triggers actions when changes are detected.
This function continuously monitors display changes and may run in sync mode unless wait timeout reached or function is interrupted externally.
- Parameters:
provider (DmProvider) – The display manager provider to use. Defaults to
DmProvider.PLATFORM.poll_interval (int) – The time interval (in seconds) between polling for display changes. Default is 60 seconds.
max_wait (int) – The maximum time (in seconds) to wait till function exit. When set to -1, the function will run indefinitely. Default is 3 seconds.
name (str) – A filter for matching display names in Unix shell-style wildcards format. Use
*to match all displays. Default is*.d_id (str) – A filter for matching display IDs in Unix shell-style wildcards format. Use
*to match all displays. Default is*.on_change (str, optional) – A string indicating a shell script or command to execute when a display change is detected. Event information in JSON format is passed as an first argument to the command. Default is None.
ext_proc_command (str, optional) – An external process command to execute when a display change is detected. All subprocesses created by this command will be automatically terminated when the display is disconnected. Default is None.
out_func (Callable[[str], None]) – The function used to output messages. Defaults to
print.
- reprostim.qr.disp_mon.enum_displays(provider: DmProvider = DmProvider.PLATFORM) Generator[DisplayInfo, None, None][source]¶
Enumerates available display devices based on the specified provider.
- Parameters:
provider (DmProvider) – The display manager provider to use. Defaults to
DmProvider.PLATFORM.- Returns:
A generator yielding
DisplayInfoobjects for each detected display.- Return type:
Generator[DisplayInfo, None, None]
- Raises:
NotImplementedError – If the platform or provider is not supported.
- reprostim.qr.disp_mon.find_di(lst: Iterable[DisplayInfo], di: DisplayInfo) DisplayInfo[source]¶
Finds a matching display information object from the provided list.
- Note: The returned result may not be the same object as the one provided
via
diparam.
- Parameters:
lst (Iterable[DisplayInfo]) – The list of display information objects to search in.
di (DisplayInfo) – The display information object to match.
- Returns:
The matching display information object, or None if no match is found.
- Return type: