Go to index / Go to protocols

wlr_data_control_unstable_v1 ↗

control data devices

This protocol allows a privileged client to control data devices. In particular, the client will be able to manage the current selection and take the role of a clipboard manager.

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.

Note! This protocol is deprecated and not intended for production use. For clipboard management, use the ext-data-control-v1 protocol.

wlr_data_control_unstable_v1
zwlr_data_control_manager_v1

Version 2
Compositor Support
Version 2
cosmic 1.0.0
hyprland 0.52.1
jay 1.14.0
labwc 0.20.2
niri 26.04
phoc 0.55
river 0.3.13
sway 1.11
treeland 0.8.0
wayfire 0.9.0

manager to control data devices

This interface is a manager that allows creating per-seat data device controls.

zwlr_data_control_manager_v1
request create_data_source(
    id: new_id<zwlr_data_control_source_v1>,
)
  • id — data source to create

create a new data source

Create a new data source.

zwlr_data_control_manager_v1
request get_data_device(
    id: new_id<zwlr_data_control_device_v1>,
    seat: object<wl_seat>,
)

    get a data device for a seat

    Create a data device that can be used to manage a seat's selection.

    zwlr_data_control_manager_v1
    request destroy()
    Destructor

      destroy the manager

      All objects created by the manager will still remain valid, until their appropriate destroy request has been called.

      wlr_data_control_unstable_v1
      zwlr_data_control_device_v1

      Version 2

      manage a data device for a seat

      This interface allows a client to manage a seat's selection.

      When the seat is destroyed, this object becomes inert.

      zwlr_data_control_device_v1
      request set_selection(
          source: nullable object<zwlr_data_control_source_v1>,
      )

        copy data to the selection

        This request asks the compositor to set the selection to the data from the source on behalf of the client.

        The given source may not be used in any further set_selection or set_primary_selection requests. Attempting to use a previously used source is a protocol error.

        To unset the selection, set the source to NULL.

        zwlr_data_control_device_v1
        request destroy()
        Destructor

          destroy this data device

          Destroys the data device object.

          zwlr_data_control_device_v1
          event data_offer(
              id: new_id<zwlr_data_control_offer_v1>,
          )

            introduce a new wlr_data_control_offer

            The data_offer event introduces a new wlr_data_control_offer object, which will subsequently be used in either the wlr_data_control_device.selection event (for the regular clipboard selections) or the wlr_data_control_device.primary_selection event (for the primary clipboard selections). Immediately following the wlr_data_control_device.data_offer event, the new data_offer object will send out wlr_data_control_offer.offer events to describe the MIME types it offers.

            zwlr_data_control_device_v1
            event selection(
                id: nullable object<zwlr_data_control_offer_v1>,
            )

              advertise new selection

              The selection event is sent out to notify the client of a new wlr_data_control_offer for the selection for this device. The wlr_data_control_device.data_offer and the wlr_data_control_offer.offer events are sent out immediately before this event to introduce the data offer object. The selection event is sent to a client when a new selection is set. The wlr_data_control_offer is valid until a new wlr_data_control_offer or NULL is received. The client must destroy the previous selection wlr_data_control_offer, if any, upon receiving this event.

              The first selection event is sent upon binding the wlr_data_control_device object.

              zwlr_data_control_device_v1
              event finished()

                this data control is no longer valid

                This data control object is no longer valid and should be destroyed by the client.

                zwlr_data_control_device_v1
                event primary_selection(
                    id: nullable object<zwlr_data_control_offer_v1>,
                )
                Available since version 2

                  advertise new primary selection

                  The primary_selection event is sent out to notify the client of a new wlr_data_control_offer for the primary selection for this device. The wlr_data_control_device.data_offer and the wlr_data_control_offer.offer events are sent out immediately before this event to introduce the data offer object. The primary_selection event is sent to a client when a new primary selection is set. The wlr_data_control_offer is valid until a new wlr_data_control_offer or NULL is received. The client must destroy the previous primary selection wlr_data_control_offer, if any, upon receiving this event.

                  If the compositor supports primary selection, the first primary_selection event is sent upon binding the wlr_data_control_device object.

                  zwlr_data_control_device_v1
                  request set_primary_selection(
                      source: nullable object<zwlr_data_control_source_v1>,
                  )
                  Available since version 2

                    copy data to the primary selection

                    This request asks the compositor to set the primary selection to the data from the source on behalf of the client.

                    The given source may not be used in any further set_selection or set_primary_selection requests. Attempting to use a previously used source is a protocol error.

                    To unset the primary selection, set the source to NULL.

                    The compositor will ignore this request if it does not support primary selection.

                    zwlr_data_control_device_v1
                    enum error {
                        used_source = 1,
                    }
                    Available since version 2
                    • used_source — source given to set_selection or set_primary_selection was already used before

                    wlr_data_control_unstable_v1
                    zwlr_data_control_source_v1

                    Version 1

                    offer to transfer data

                    The wlr_data_control_source object is the source side of a wlr_data_control_offer. It is created by the source client in a data transfer and provides a way to describe the offered data and a way to respond to requests to transfer the data.

                    zwlr_data_control_source_v1
                    enum error {
                        invalid_offer = 1,
                    }
                    • invalid_offer — offer sent after wlr_data_control_device.set_selection
                    zwlr_data_control_source_v1
                    request offer(
                        mime_type: string,
                    )
                    • mime_type — MIME type offered by the data source

                    add an offered MIME type

                    This request adds a MIME type to the set of MIME types advertised to targets. Can be called several times to offer multiple types.

                    Calling this after wlr_data_control_device.set_selection is a protocol error.

                    zwlr_data_control_source_v1
                    request destroy()
                    Destructor

                      destroy this source

                      Destroys the data source object.

                      zwlr_data_control_source_v1
                      event send(
                          mime_type: string,
                          fd: fd,
                      )
                      • mime_type — MIME type for the data
                      • fd — file descriptor for the data

                      send the data

                      Request for data from the client. Send the data as the specified MIME type over the passed file descriptor, then close it.

                      zwlr_data_control_source_v1
                      event cancelled()

                        selection was cancelled

                        This data source is no longer valid. The data source has been replaced by another data source.

                        The client should clean up and destroy this data source.

                        wlr_data_control_unstable_v1
                        zwlr_data_control_offer_v1

                        Version 1

                        offer to transfer data

                        A wlr_data_control_offer represents a piece of data offered for transfer by another client (the source client). The offer describes the different MIME types that the data can be converted to and provides the mechanism for transferring the data directly from the source client.

                        zwlr_data_control_offer_v1
                        request receive(
                            mime_type: string,
                            fd: fd,
                        )
                        • mime_type — MIME type desired by receiver
                        • fd — file descriptor for data transfer

                        request that the data is transferred

                        To transfer the offered data, the client issues this request and indicates the MIME type it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the MIME type representation requested and then closes the file descriptor.

                        The receiving client reads from the read end of the pipe until EOF and then closes its end, at which point the transfer is complete.

                        This request may happen multiple times for different MIME types.

                        zwlr_data_control_offer_v1
                        request destroy()
                        Destructor

                          destroy this offer

                          Destroys the data offer object.

                          zwlr_data_control_offer_v1
                          event offer(
                              mime_type: string,
                          )
                          • mime_type — offered MIME type

                          advertise offered MIME type

                          Sent immediately after creating the wlr_data_control_offer object. One event per offered MIME type.