pub fn is_primary_selection_supported(
) -> Result<bool, PrimarySelectionCheckError>
Expand description

Checks if the compositor supports the primary selection.

§Examples

use wl_clipboard_rs::utils::{is_primary_selection_supported, PrimarySelectionCheckError};

match is_primary_selection_supported() {
    Ok(supported) => {
        // We have our definitive result. False means that either data-control version 1
        // is present (which does not support the primary selection), or that data-control
        // version 2 is present and it did not signal the primary selection support.
    },
    Err(PrimarySelectionCheckError::NoSeats) => {
        // Impossible to give a definitive result. Primary selection may or may not be
        // supported.

        // The required protocol (data-control version 2) is there, but there are no seats.
        // Unfortunately, at least one seat is needed to check for the primary clipboard
        // support.
    },
    Err(PrimarySelectionCheckError::MissingProtocol { .. }) => {
        // The data-control protocol (required for wl-clipboard-rs operation) is not
        // supported by the compositor.
    },
    Err(_) => {
        // Some communication error occurred.
    }
}