Clipboard-Any

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    Clipboard::Any - Common interface to clipboard manager functions

VERSION
    This document describes version 0.015 of Clipboard::Any (from Perl
    distribution Clipboard-Any), released on 2025-06-16.

DESCRIPTION
    This module provides a common interface to interact with clipboard.

    Some terminology:

    *   clipboard content

        The current clipboard content. Some clipboard manager supports
        storing multiple items (multiple contents). All the items are called
        "clipboard history".

    *   clipboard history

        Some clipboard manager supports storing multiple items (multiple
        contents). All the items are called clipboard history. It is
        presented as an array. The current item/content is at index 0, the
        secondmost current item is at index 1, and so on.

  Supported clipboard managers
   Klipper
    The default clipboard manager on KDE Plasma.

   clipit
   parcellite
   xclip
    This is not a "real" clipboard manager, but just an interface to the X
    selections. With "xclip", the history is viewed as having two items. The
    first/recent is the primary selection and the second one is the
    secondary.

    This module provides common functions related to clipboard manager.

    Supported clipboard manager: KDE Plasma's Klipper ("klipper"),
    "parcellite", "clipit", "xclip". Support for more clipboard managers,
    e.g. on Windows or other Linux desktop environment is welcome.

NOTES
    2021-07-15 - Tested on my system (KDE Plasma 5.12.9 on Linux).

FUNCTIONS
  add_clipboard_content
    Usage:

     add_clipboard_content(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Add a new content to the clipboard.

    For "xclip": when adding content, the primary selection is set. The
    clipboard content is unchanged.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   chomp_newline => *bool*

        Remove trailing newlines before adding item to clipboard.

    *   clipboard_manager => *str*

        Explicitly set clipboard manager to use.

        The default, when left undef, is to detect what clipboard manager is
        running.

    *   content => *str*

        (No description)

    *   tee => *bool*

        If set to true, will output content back to STDOUT.

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  clear_clipboard_content
    Usage:

     clear_clipboard_content(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Delete current clipboard content.

    This function is not exported by default, but exportable.



( run in 0.631 second using v1.01-cache-2.11-cpan-5b529ec07f3 )