### Install PyWayland from Source Source: https://pywayland.readthedocs.io/en/latest/install Installs the PyWayland package using standard setup.py mechanisms. Additional arguments can be used to automatically generate Wayland protocols. ```shell $ python setup.py install ``` -------------------------------- ### Run PyWayland Test Suite Source: https://pywayland.readthedocs.io/en/latest/install Executes the PyWayland test suite to verify the installation. Requires the 'pytest' package to be installed. Run this command from the root directory. ```shell $ pytest ``` -------------------------------- ### Install PyWayland with pip Source: https://pywayland.readthedocs.io/en/latest/install Installs the PyWayland library using pip. This is the recommended method for most users after ensuring external dependencies are met. It automatically handles downloading and installing the package and its Python dependencies. ```shell $ pip install pywayland ``` -------------------------------- ### Clone PyWayland Source Repository Source: https://pywayland.readthedocs.io/en/latest/install Clones the PyWayland project from its Git repository. This is the first step for users who wish to install PyWayland from source, allowing access to the latest improvements and fixes. ```shell $ git clone https://github.com/flacjacket/pywayland.git ``` -------------------------------- ### Generate Wayland Protocol Files Source: https://pywayland.readthedocs.io/en/latest/install Generates the necessary Wayland protocol files from XML definitions using the pywayland scanner module. This command is typically run when installing from source, assuming the Wayland protocol file is in a default location or discoverable via pkg-config. ```python import sys # Assuming pywayland is installed or in the Python path # For source installation, this would be run from the project root # Example: python -m pywayland.scanner # To simulate the command line execution for documentation purposes: print("Running: python -m pywayland.scanner") # In a real scenario, this would execute the scanner module # sys.exit(subprocess.call([sys.executable, '-m', 'pywayland.scanner'])) ``` -------------------------------- ### WlSeat API Documentation Source: https://pywayland.readthedocs.io/en/latest/module/protocol/wayland Documentation for the WlSeat class, which represents a group of input devices (keyboard, pointer, touch). It provides methods to get specific input device interfaces and handle capability changes. ```APIDOC class WlSeat: """Group of input devices A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a device is hot plugged. A seat typically has a pointer and maintains a keyboard focus and a pointer focus. """ # Requests get_pointer() -> Proxy[WlPointer] """Return pointer object The ID provided will be initialized to the WlPointer interface for this seat. This request only takes effect if the seat has the pointer capability, or has had the pointer capability in the past. It is a protocol violation to issue this request on a seat that has never had the pointer capability. The missing_capability error will be sent in this case. Returns: WlPointer – seat pointer """ get_keyboard() -> Proxy[WlKeyboard] """Return keyboard object The ID provided will be initialized to the WlKeyboard interface for this seat. This request only takes effect if the seat has the keyboard capability, or has had the keyboard capability in the past. It is a protocol violation to issue this request on a seat that has never had the keyboard capability. The missing_capability error will be sent in this case. Returns: WlKeyboard – seat keyboard """ get_touch() -> Proxy[WlTouch] """Return touch object The ID provided will be initialized to the WlTouch interface for this seat. This request only takes effect if the seat has the touch capability, or has had the touch capability in the past. It is a protocol violation to issue this request on a seat that has never had the touch capability. The missing_capability error will be sent in this case. Returns: WlTouch – seat touch interface """ release() -> None """Release the seat object Using this request a client can tell the server that it is not going to use the seat object anymore. """ # Events capabilities(capabilities: int) -> None """Seat capabilities changed This is emitted whenever a seat gains or loses the pointer, keyboard or touch capabilities. The argument is a capability enum containing the complete set of capabilities this seat has. When the pointer capability is added, a client may create a WlPointer object using the WlSeat.get_pointer() request. This object will receive pointer events until the capability is removed in the future. When the pointer capability is removed, a client should destroy the WlPointer objects associated with the seat where the capability was removed, using the WlPointer.release() request. No further pointer events will be received on these objects. In some compositors, if a seat regains the pointer capability and a client has a previously obtained WlPointer object of version 4 or """ ``` -------------------------------- ### pywayland ZxdgToplevelV6 Requests Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell_unstable_v6 Documentation for ZxdgToplevelV6 requests in pywayland, covering interactive window manipulation. Includes methods for starting a move, initiating a resize operation, and setting the maximum window dimensions. ```APIDOC ZxdgToplevelV6: move(seat: 'WlSeat', serial: 'int') -> 'None' Request – opcode 5 Start an interactive, user-driven move of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive move (touch, pointer, etc). The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized), or if the passed serial is no longer valid. Parameters: seat: The WlSeat of the user event. serial: The serial of the user event. resize(seat: 'WlSeat', serial: 'int', edges: 'int') -> 'None' Request – opcode 6 Start a user-driven, interactive resize of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive resize (touch, pointer, etc). The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). The edges parameter specifies how the surface should be resized, and is one of the values of the resize_edge enum. The compositor may use this information to update the surface position for example when dragging the top left corner. Parameters: seat: The WlSeat of the user event. serial: The serial of the user event. edges: Which edge or corner is being dragged. set_max_size(width: 'int', height: 'int') -> 'None' Request – opcode 7 Set a maximum size for the window. The client can specify a maximum size so that the compositor does not exceed these dimensions when resizing the window. Parameters: width: The maximum width of the window. height: The maximum height of the window. ``` -------------------------------- ### Generate CFFI Module for In-place PyWayland Source: https://pywayland.readthedocs.io/en/latest/install Generates the CFFI module required for running PyWayland from source in-place. This step is necessary when libwayland header files are not correctly installed. ```shell $ python pywaland/ffi_build.py ``` -------------------------------- ### ZwpFullscreenShellV1 API Documentation Source: https://pywayland.readthedocs.io/en/latest/module/protocol/fullscreen_shell_unstable_v1 Documentation for the ZwpFullscreenShellV1 Wayland protocol interface, detailing its purpose, methods, parameters, and return values for managing fullscreen surfaces. ```APIDOC class pywayland.protocol.fullscreen_shell_unstable_v1.ZwpFullscreenShellV1: """Displays a single surface per output This interface provides a mechanism for a single client to display simple full-screen surfaces. While there technically may be multiple clients bound to this interface, only one of those clients should be shown at a time. To present a surface, the client uses either the present_surface or present_surface_for_mode requests. Presenting a surface takes effect on the next WlSurface.commit(). See the individual requests for details about scaling and mode switches. The client can have at most one surface per output at any time. Requesting a surface to be presented on an output that already has a surface replaces the previously presented surface. Presenting a null surface removes its content and effectively disables the output. Exactly what happens when an output is “disabled” is compositor-specific. The same surface may be presented on multiple outputs simultaneously. Once a surface is presented on an output, it stays on that output until either the client removes it or the compositor destroys the output. This way, the client can update the output’s contents by simply attaching a new buffer. Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes are done by bumping the version number in the protocol and interface names and resetting the interface version. Once the protocol is to be declared stable, the ‘z’ prefix and the version number in the protocol and interface names are removed and the interface version number is reset. """ release() -> 'None': """Request – opcode 0 (attached to Resource instance) Release the wl_fullscreen_shell interface Release the binding from the wl_fullscreen_shell interface. This destroys the server-side object and frees this binding. If the client binds to wl_fullscreen_shell multiple times, it may wish to free some of those bindings. """ present_surface(surface: 'WlSurface | None', method: 'int', output: 'WlOutput | None') -> 'None': """Request – opcode 1 (attached to Resource instance) Present surface for display Present a surface on the given output. If the output is null, the compositor will present the surface on whatever display (or displays) it thinks best. In particular, this may replace any or all surfaces currently presented so it should not be used in combination with placing surfaces on specific outputs. The method parameter is a hint to the compositor for how the surface is to be presented. In particular, it tells the compositor how to handle a size mismatch between the presented surface and the output. The compositor is free to ignore this parameter. The “zoom”, “zoom_crop”, and “stretch” methods imply a scaling operation on the surface. This will override any kind of output scaling, so the buffer_scale property of the surface is effectively ignored. This request gives the surface the role of a fullscreen shell surface. If the surface already has another role, it raises a role protocol error. Parameters: surface (WlSurface or None): The surface to present. method (ArgumentType.Uint): A hint for how the surface should be presented (e.g., scaling). output (WlOutput or None): The output to present the surface on. If None, the compositor chooses. """ present_surface_for_mode(surface: 'WlSurface', output: 'WlOutput', framerate: 'int') -> 'Proxy[ZwpFullscreenShellModeFeedbackV1]': """Request – opcode 2 (attached to Resource instance) Present surface for display at a particular mode Presents a surface on the given output for a particular mode. If the current size of the output differs from that of the surface, the compositor will attempt to scale the surface to fit the mode. Parameters: surface (WlSurface): The surface to present. output (WlOutput): The output to present the surface on. framerate (int): The desired framerate for the presentation. Returns: Proxy[ZwpFullscreenShellModeFeedbackV1]: A proxy object for mode feedback. """ ``` -------------------------------- ### WlShellSurface API Source: https://pywayland.readthedocs.io/en/latest/module/protocol/wayland Documentation for the WlShellSurface Wayland protocol interface, covering requests for managing toplevel, fullscreen, popup windows, and associated metadata like title and class. ```APIDOC WlShellSurface: Description: An interface that may be implemented by a WlSurface, for implementations that provide a desktop-style user interface. It provides requests to treat surfaces like toplevel, fullscreen or popup windows, move, resize or maximize them, associate metadata like title and class, etc. Requests: pong(serial: int) -> None Description: Respond to a ping event. A client must respond to a ping event with a pong request or the client may be deemed unresponsive. Parameters: serial (ArgumentType.Uint): serial number of the ping event move(seat: WlSeat, serial: int) -> None Description: Start an interactive move. Start a pointer-driven move of the surface. This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized). Parameters: seat (WlSeat): seat whose pointer is used serial (ArgumentType.Uint): serial number of the implicit grab on the pointer resize(seat: WlSeat, serial: int, edges: int) -> None Description: Start an interactive resize. Start a pointer-driven resizing of the surface. This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). Parameters: seat (WlSeat): seat whose pointer is used serial (ArgumentType.Uint): serial number of the implicit grab on the pointer edges (ArgumentType.Uint): which edge or corner is being dragged set_toplevel() -> None Description: Make the surface a toplevel surface. Map the surface as a toplevel surface. A toplevel surface is not fullscreen, maximized or transient. set_transient(parent: WlSurface, x: int, y: int, flags: int) -> None Description: Make the surface a transient surface. Map the surface relative to an existing surface. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. The flags argument controls details of the transient behaviour. Parameters: parent (WlSurface): parent surface x (ArgumentType.Int): surface-local x coordinate y (ArgumentType.Int): surface-local y coordinate flags (ArgumentType.Uint): transient surface behavior set_fullscreen(method: int, framerate: int, output: WlOutput | None) -> None Description: Make the surface a fullscreen surface. Map the surface as a fullscreen surface. If an output parameter is given then the surface will be made fullscreen on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output. ``` -------------------------------- ### XdgWmBase API Documentation Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell Provides documentation for the XdgWmBase interface, which is used to create desktop-style surfaces in Wayland environments. It outlines methods for managing window behavior like dragging, resizing, and creating transient windows. ```APIDOC class XdgWmBase: """Create desktop-style surfaces The XdgWmBase interface is exposed as a global object enabling clients to turn their wl_surfaces into windows in a desktop environment. It defines the basic functionality needed for clients and the compositor to create windows that can be dragged, resized, maximized, etc, as well as creating transient windows such as popup menus. """ destroy() -> 'None' """Request – opcode 0 (attached to Resource instance) Destroy XdgWmBase Destroy this XdgWmBase object. Destroying a bound XdgWmBase object while there are surfaces still alive created by this XdgWmBase object instance is illegal and will result in a protocol error. """ create_positioner() -> 'Proxy[XdgPositioner]' """Request – opcode 1 (attached to Resource instance) Create a positioner object Create a positioner object. A positioner object is used to position surfaces relative to some parent surface. See the interface description and XdgSurface.get_popup() for details. Returns: XdgPositioner """ get_xdg_surface(surface: 'WlSurface') -> 'Proxy[XdgSurface]' """Request – opcode 2 (attached to Resource instance) Create a shell surface from a surface This creates an XdgSurface for the given surface. While XdgSurface itself is not a role, the corresponding surface may only be assigned a role extending XdgSurface, such as XdgToplevel or XdgPopup. It is illegal to create an XdgSurface for a WlSurface which already has an assigned role and this will result in a protocol error. This creates an XdgSurface for the given surface. An XdgSurface is used as basis to define a role to a given surface, such as XdgToplevel or XdgPopup. It also manages functionality shared between XdgSurface based surface roles. See the documentation of XdgSurface for more details about what an XdgSurface is and how it is used. Parameters: surface (WlSurface): The surface to create an XdgSurface for. Returns: XdgSurface """ pong(serial: 'int') -> 'None' """Request – opcode 3 (attached to Resource instance) """ ``` -------------------------------- ### Run PyWayland Tests Locally Source: https://pywayland.readthedocs.io/en/latest/contributing Instructions on how to execute the project's test suite locally. This requires installing pytest and potentially other dependencies. Running tests ensures that code changes adhere to project standards and do not introduce regressions. ```bash py.test ``` -------------------------------- ### WlKeyboard API Documentation Source: https://pywayland.readthedocs.io/en/latest/module/protocol/wayland Detailed documentation for the WlKeyboard Wayland interface, including its methods, events, parameters, and return values. ```APIDOC class pywayland.protocol.wayland.WlKeyboard: Keyboard input device The WlKeyboard interface represents one or more keyboards associated with a seat. Methods: release() -> None Request – opcode 0 Description: Release the keyboard object. Events: keymap(format: int, fd: int, size: int) -> None Event – opcode 0 Description: Keyboard mapping. Purpose: This event provides a file descriptor to the client which can be memory-mapped in read-only mode to provide a keyboard mapping description. Parameters: format (ArgumentType.Uint): keymap format fd (ArgumentType.FileDescriptor): keymap file descriptor size (ArgumentType.Uint): keymap size, in bytes Notes: From version 7 onwards, the fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may fail. enter(serial: int, surface: WlSurface, keys: list) -> None Event – opcode 1 Description: Enter event Purpose: Notification that this seat’s keyboard focus is on a certain surface. Notes: The compositor must send the WlKeyboard.modifiers() event after this event. Parameters: serial (ArgumentType.Uint): serial number of the enter event surface (WlSurface): surface gaining keyboard focus keys (ArgumentType.Array): the currently pressed keys leave(serial: int, surface: WlSurface) -> None Event – opcode 2 Description: Leave event Purpose: Notification that this seat’s keyboard focus is no longer on a certain surface. Notes: The leave notification is sent before the enter notification for the new focus. After this event client must assume that all keys, including modifiers, are lifted and also it must stop key repeating if there’s some going on. Parameters: serial (ArgumentType.Uint): serial number of the leave event surface (WlSurface): surface that lost keyboard focus key(serial: int, time: int, key: int, state: int) -> None Event – opcode 3 Description: Key event Purpose: A key was pressed or released. The time argument is a timestamp with millisecond granularity, with an undefined base. Notes: The key is a platform-specific key code that can be interpreted by feeding it to the keyboard mapping (see the keymap event). If this event produces a change in modifiers, then the resulting WlKeyboard.modifiers() event must be sent after this event. Parameters: serial (ArgumentType.Uint): serial number of the key event time (ArgumentType.Uint): timestamp with millisecond granularity key (ArgumentType.Uint): key that produced the event state (ArgumentType.Uint): physical state of the key modifiers(serial: int, mods_depressed: int, mods_latched: int, mods_locked: int, group: int) -> None Event – opcode 4 Description: Modifier and group state Purpose: Notifies clients that the modifier and/or group state has changed, and it should update its local state. Parameters: serial (ArgumentType.Uint): serial number of the modifiers event mods_depressed (ArgumentType.Uint): depressed modifiers mods_latched (ArgumentType.Uint): latched modifiers mods_locked (ArgumentType.Uint): locked modifiers group (ArgumentType.Uint): keyboard layout ``` -------------------------------- ### XdgToplevel Methods Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell Documentation for core XdgToplevel requests used for interactive window management in Wayland. These methods allow clients to trigger actions like showing a window menu, initiating a move, or starting a resize operation, typically in response to user input. ```APIDOC XdgToplevel Methods: show_window_menu(seat: 'WlSeat', serial: 'int', x: 'int', y: 'int') -> 'None' - Request: opcode 4 - Description: Shows the window menu at the specified position relative to the local surface coordinates. This is intended for client-side decorations and should be used in response to user actions like button presses. - Parameters: - seat: The WlSeat of the user event. - serial: The serial of the user event. - x: The x position to pop up the window menu at. - y: The y position to pop up the window menu at. - Returns: None. move(seat: 'WlSeat', serial: 'int') -> 'None' - Request: opcode 5 - Description: Starts an interactive, user-driven move of the surface. The server may ignore this request based on surface state or serial validity. The client will lose focus of the device used for the move. - Parameters: - seat: The WlSeat of the user event. - serial: The serial of the user event. - Returns: None. resize(seat: 'WlSeat', serial: 'int', edges: 'int') -> 'None' - Request: opcode 6 - Description: Starts a user-driven, interactive resize of the surface. The server may ignore this request based on surface state. The client will receive configure events and must acknowledge them. The client will lose focus of the device used for the resize. - Parameters: - seat: The WlSeat of the user event. - serial: The serial of the user event. - edges: Bitmask indicating the edges to resize. - Returns: None. ``` -------------------------------- ### Wayland XdgSurface: resize Request Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell_unstable_v5 Starts an interactive resize operation for the surface, driven by the user. This request requires a serial from a user event and specifies the resize edges. The server may reject the request, and the client must handle configure events indicating resize state and acknowledge them. Device focus may be lost during the resize. ```APIDOC resize(seat: 'WlSeat', serial: 'int', edges: 'int') -> 'None' Request – opcode 6 Start an interactive resize. Start a user-driven, interactive resize of the surface. This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive resize (touch, pointer, etc). The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized). If triggered, the client will receive configure events with the “resize” state enum value and the expected sizes. See the “resize” enum value for more details about what is required. The client must also acknowledge configure events using “ack_configure”. After the resize is completed, the client will receive another “configure” event without the resize state. If triggered, the surface also will lose the focus of the device (WlPointer, WlTouch, etc) used for the resize. It is up to the compositor to visually indicate that the resize is taking place, such as updating a pointer cursor, during the resize. There is no guarantee that the device focus will return when the resize is completed. The edges parameter specifies how the surface should be resized, and is one of the values of the resize_edge enum. The compositor may use this information to update the surface position for example when dragging. Parameters: seat: The WlSeat of the user event. serial: The serial of the user event. edges: Specifies how the surface should be resized, one of the values of the resize_edge enum. ``` -------------------------------- ### ZwpTabletV2 API Documentation Source: https://pywayland.readthedocs.io/en/latest/module/protocol/tablet_unstable_v2 Comprehensive documentation for the ZwpTabletV2 Wayland protocol interface, covering its methods, events, and parameters for managing graphics tablet devices. ```APIDOC class ZwpTabletV2: """Graphics tablet device The wp_tablet interface represents one graphics tablet device. The tablet interface itself does not generate events; all events are generated by wp_tablet_tool objects when in proximity above a tablet. A tablet has a number of static characteristics, e.g. device name and pid/vid. These capabilities are sent in an event sequence after the wp_tablet_seat.tablet_added event. This initial event sequence is terminated by a wp_tablet.done event. """ # Request destroy(): """Destroy the tablet object This destroys the client’s resource for this tablet object.""" # opcode 0 (attached to Resource instance) pass # Events name(name: str): """Tablet device name This event is sent in the initial burst of events before the wp_tablet.done event. Parameters: name (ArgumentType.String): the device name """ # opcode 0 (attached to Proxy instance) pass id(vid: int, pid: int): """Tablet device usb vendor/product id This event is sent in the initial burst of events before the wp_tablet.done event. Parameters: vid (ArgumentType.Uint): USB vendor id pid (ArgumentType.Uint): USB product id """ # opcode 1 (attached to Proxy instance) pass path(path: str): """Path to the device A system-specific device path that indicates which device is behind this wp_tablet. This information may be used to gather additional information about the device, e.g. through libwacom. A device may have more than one device path. If so, multiple wp_tablet.path events are sent. A device may be emulated and not have a device path, and in that case this event will not be sent. The format of the path is unspecified, it may be a device node, a sysfs path, or some other identifier. It is up to the client to identify the string provided. This event is sent in the initial burst of events before the wp_tablet.done event. Parameters: path (ArgumentType.String): path to local device """ # opcode 2 (attached to Proxy instance) pass done(): """Tablet description events sequence complete This event is sent immediately to signal the end of the initial burst of descriptive events. A client may consider the static description of the tablet to be complete and finalize initialization of the tablet. """ # opcode 3 (attached to Proxy instance) pass removed(): """Tablet removed event Sent when the tablet has been removed from the system. When a tablet is removed, some tools may be removed. When this event is received, the client must wp_tablet.destroy the object. """ # opcode 4 (attached to Proxy instance) pass ``` -------------------------------- ### XdgSurfaceV6 Methods Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell_unstable_v6 Documentation for key methods of the ZxdgSurfaceV6 interface in pywayland's XDG Shell unstable v6 protocol. Covers creating popups, setting window geometry, and acknowledging configurations. ```APIDOC ZxdgSurfaceV6: get_popup(parent: 'ZxdgSurfaceV6', positioner: 'ZxdgPositionerV6') -> 'Proxy[ZxdgPopupV6]' Request – opcode 2 Assigns the XdgPopup surface role. Creates an XdgPopup object for the given XdgSurface and gives the associated WlSurface the XdgPopup role. Parameters: parent: The parent XdgSurfaceV6. positioner: The XdgPositionerV6 defining the popup's position and size. Returns: A Proxy object for the created ZxdgPopupV6. set_window_geometry(x: 'int', y: 'int', width: 'int', height: 'int') -> 'None' Request – opcode 3 Sets the new window geometry for the surface. The window geometry defines the visible bounds from the user's perspective, ignoring client-side decorations. This is double buffered and applied on WlSurface.commit(). Once set, it persists until changed again. If never set, it defaults to the full bounds of the surface. Arguments are in the surface-local coordinate space. Width and height must be greater than zero; invalid sizes raise an error. Parameters: x: The x-coordinate of the top-left corner of the window geometry. y: The y-coordinate of the top-left corner of the window geometry. width: The width of the window geometry. height: The height of the window geometry. ack_configure(serial: 'int') -> 'None' Request – opcode (specific opcode not detailed in provided text) Acknowledges a configuration event. This is used to confirm that a client has processed a configuration update. Parameters: serial: The serial number of the configuration event to acknowledge. ``` -------------------------------- ### XdgActivationV1 Interface Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_activation_v1 Documentation for the XdgActivationV1 interface, which allows applications to request surface activation from the compositor. It includes methods for managing the interface lifecycle, obtaining activation tokens, and signaling surface activation. ```APIDOC XdgActivationV1: Interface for activating surfaces A global interface used for informing the compositor about applications being activated or started, or for applications to request to be activated. Methods: destroy() -> None Request – opcode 0 Destroy the xdg_activation object. Notify the compositor that the xdg_activation object will no longer be used. The child objects created via this interface are unaffected and should be destroyed separately. get_activation_token() -> Proxy[XdgActivationTokenV1] Request – opcode 1 Requests a token. Creates an XdgActivationTokenV1 object that will provide the initiating client with a unique token for this activation. This token should be offered to the clients to be activated. Returns: XdgActivationTokenV1 activate(token: str, surface: WlSurface) -> None Request – opcode 2 Notify new interaction being available. Requests surface activation. It’s up to the compositor to display this information as desired, for example by placing the surface above the rest. The compositor may know who requested this by checking the activation token and might decide not to follow through with the activation if it’s considered unwanted. Compositors can ignore unknown activation tokens when an invalid token is passed. Parameters: token (str) – the activation token of the initiating client surface (WlSurface) – the WlSurface to activate ``` -------------------------------- ### XdgPopup Events and Configuration Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell Documentation for XdgPopup events and configuration parameters. Covers popup dismissal and repositioning sequences, including parameters for positioning. ```APIDOC XdgPopup: Configuration Parameters: x (ArgumentType.Int): x position relative to parent surface window geometry. y (ArgumentType.Int): y position relative to parent surface window geometry. width (ArgumentType.Int): window geometry width. height (ArgumentType.Int): window geometry height. Events: popup_done() -> None Description: Popup interaction is done. Sent when a popup is dismissed by the compositor. The client should destroy the XdgPopup object at this point. Parameters: None. Returns: None. repositioned(token: int) -> None Description: Signal the completion of a repositioned request. Sent as part of a popup configuration sequence, together with XdgPopup.configure() and XdgSurface.configure() to notify the completion of a reposition request. The token argument is the token passed in the XdgPopup.reposition() request. Immediately after this event is emitted, XdgPopup.configure() and XdgSurface.configure() will be sent with the updated size and position, as well as a new configure serial. The client should optionally update the content of the popup, but must acknowledge the new popup configuration for the new position to take effect. Parameters: token (ArgumentType.Uint): reposition request token. Returns: None. Related Methods: XdgPopup.configure(): Sent to the client with the current state of the surface. XdgSurface.configure(): Sent to the client with the current state of the surface. XdgSurface.ack_configure(): Acknowledge a surface configuration. XdgPositioner: Used to define the position, size, and other properties of a popup. ``` -------------------------------- ### Using the PyWayland Scanner Module Source: https://pywayland.readthedocs.io/en/latest/module/scanner/scanner Demonstrates the basic procedure to invoke the PyWayland scanner. It involves creating a Protocol object, scanning an input XML file, and outputting the generated protocol files to a specified directory. ```python Protocol.parse_file(path_to_xml_file) Protocol.output(path_to_output_dir, {}) ``` -------------------------------- ### XdgSurface Methods and Events Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell_unstable_v5 Documentation for XdgSurface requests and events in the pywayland library, including window state management (fullscreen, maximized, minimized) and configuration events. ```APIDOC XdgSurface: Description: Interface for surfaces that are managed by the XDG shell. Requests: unset_maximized() -> None Description: Unmaximize the window. After requesting that the surface should be unmaximized, the compositor will respond by emitting a configure event without the “maximized” state. If available, the compositor will include the window geometry dimensions the window had prior to being maximized in the configure request. The client must then update its content, drawing it in a regular state. The client must also acknowledge the configure when committing the new content. It is up to the compositor to position the surface after it was unmaximized; usually the position the surface had before maximizing, if applicable. If the surface was already not maximized, the compositor will still emit a configure event without the “maximized” state. Parameters: None Returns: None set_fullscreen(output: WlOutput | None) -> None Description: Set the window as fullscreen on a monitor. Make the surface fullscreen. You can specify an output that you would prefer to be fullscreen. If this value is NULL, it’s up to the compositor to choose which display will be used to map this surface. If the surface doesn’t cover the whole output, the compositor will position the surface in the center of the output and compensate with black borders filling the rest of the output. Parameters: output: The preferred output for fullscreen (WlOutput or None). Returns: None unset_fullscreen() -> None Description: Unset the window as fullscreen. Parameters: None Returns: None set_minimized() -> None Description: Set the window as minimized. Request that the compositor minimize your surface. There is no way to know if the surface is currently minimized, nor is there any way to unset minimization on this surface. For throttling redrawing when minimized, use WlSurface.frame() event. Parameters: None Returns: None Events: configure(width: int, height: int, states: list, serial: int) -> None Description: Suggest a surface change. The configure event asks the client to resize its surface or to change its state. The width and height arguments specify a hint to the window about how its surface should be resized. If width or height are zero, the client should decide its own window dimension. The states listed in the event specify how the width/height arguments should be interpreted. Clients should arrange their surface for the new size and states, and then send an ack_configure request with the serial sent in this configure event before committing the new surface. If the client receives multiple configure events before it can respond to one, it is free to discard all but the last event it received. Parameters: width: Hint for the new window width. height: Hint for the new window height. states: List of states applied to the surface (e.g., maximized, tiled). serial: The serial number of the configure event. Returns: None close() -> None Description: Surface wants to be closed. Parameters: None Returns: None ``` -------------------------------- ### XdgPopup Class and Methods Source: https://pywayland.readthedocs.io/en/latest/module/protocol/xdg_shell_unstable_v5 Documentation for the XdgPopup class, including its purpose, lifecycle, parent requirements, nesting rules, and its associated request and event methods. ```APIDOC XdgPopup: Description: Short-lived, popup surfaces for menus. A popup surface is a short-lived, temporary surface that can be used to implement menus. It takes an explicit grab on the surface that will be dismissed when the user dismisses the popup. This can be done by the user clicking outside the surface, using the keyboard, or even locking the screen through closing the lid or a timeout. When the popup is dismissed, a popup_done event will be sent out, and at the same time the surface will be unmapped. The XdgPopup object is now inert and cannot be reactivated, so clients should destroy it. Explicitly destroying the XdgPopup object will also dismiss the popup and unmap the surface. Clients will receive events for all their surfaces during this grab. This is done so that users can navigate through submenus and other “nested” popup windows without having to dismiss the topmost popup. Clients that want to dismiss the popup when another surface of their own is clicked should dismiss the popup using the destroy request. Parent Requirements: The parent surface must have either an XdgSurface or XdgPopup role. Nesting: Specifying an XdgPopup for the parent means that the popups are nested, with this popup now being the topmost popup. Nested popups must be destroyed in the reverse order they were created in, e.g. the only popup you are allowed to destroy at all times is the topmost one. If there is an existing popup when creating a new popup, the parent must be the current topmost popup. A parent surface must be mapped before the new popup is mapped. When compositors choose to dismiss a popup, they will likely dismiss every nested popup as well. When a compositor dismisses popups, it will follow the same dismissing order as required from the client. Positioning: The x and y arguments passed when creating the popup object specify where the top left of the popup should be placed, relative to the local surface coordinates of the parent surface. Mapping: The client must call WlSurface.commit() on the corresponding WlSurface for the XdgPopup state to take effect. For a surface to be mapped by the compositor the client must have committed both the XdgPopup state and a buffer. Methods: destroy(): Type: Request Opcode: 0 Description: Remove XdgPopup interface. This destroys the popup. Explicitly destroying the XdgPopup object will also dismiss the popup, and unmap the surface. If this XdgPopup is not the “topmost” popup, a protocol error will be sent. Returns: None popup_done(): Type: Event Opcode: 0 Description: Popup interaction is done. The popup_done event is sent out when a popup is dismissed by the compositor. The client should destroy the XdgPopup object at this point. Returns: None ``` -------------------------------- ### WlRegistry API Documentation Source: https://pywayland.readthedocs.io/en/latest/module/protocol/wayland Comprehensive documentation for the WlRegistry class, including its purpose, methods, and events. It details how clients interact with the global registry to discover and bind to server objects. ```APIDOC WlRegistry: Global registry object. The server has a number of global objects that are available to all clients. These objects typically represent an actual object in the server (for example, an input device) or they are singleton objects that provide extension functionality. When a client creates a registry object, the registry object will emit a global event for each global currently in the registry. Globals come and go as a result of device or monitor hotplugs, reconfiguration or other events, and the registry will send out global and global_remove events to keep the client up to date with the changes. To mark the end of the initial burst of events, the client can use the WlDisplay.sync() request immediately after calling WlDisplay.get_registry(). A client can bind to a global object by using the bind request. This creates a client-side handle that lets the object emit events to the client and lets the client invoke requests on the object. bind(name: 'int', interface: 'type[T]', version: 'int') → 'Proxy[T]' Request – opcode 0 (attached to `Resource` instance) Bind an object to the display Binds a new, client-created object to the server using the specified name as the identifier. Parameters: - name (ArgumentType.Uint): unique numeric name of the object - interface (string): Interface name - version (int): Interface version Returns: `pywayland.client.proxy.Proxy` of specified Interface – bounded object global_(name: 'int', interface: 'str', version: 'int') → 'None' Event – opcode 0 (attached to `Proxy` instance) Announce global object Notify the client of global objects. The event notifies the client that a global object with the given name is now available, and it implements the given version of the given interface. Parameters: - name (ArgumentType.Uint): numeric name of the global object - interface (ArgumentType.String): interface implemented by the object - version (ArgumentType.Uint): interface version global_remove(name: 'int') → 'None' Event – opcode 1 (attached to `Proxy` instance) Announce removal of global object Notify the client of removed global objects. This event notifies the client that the global identified by name is no longer available. If the client bound to the global using the bind request, the client should now destroy that object. The object remains valid and requests to the object will be ignored until the client destroys it, to avoid races between the global going away and a client sending a request to it. Parameters: - name (ArgumentType.Uint): numeric name of the global object ```