Clipboard Portal - Copy and Paste #1395
Mikenux
started this conversation in
New Portals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Requirements
System Clipboard
The clipboard must be a visual clipboard that supports:
It should ideally support:
Finally, the clipboard might have the option to delete censored clips once they have been pasted.
Apps
Apps must be able to send content to the clipboard according to the following specification:
Portal
Methods and Options
Ready To Copy
ReadyToCopy. Tells the portal that one or more clips have been selected and are ready to copy. Using this method is mandatory before using the "Copy" method. This method is specifically designed for touch input so that the clipboard is presented with a copy action.
When the "ReadyToCopy" method is used, the portal returns the following result to the app after the user triggers the copy action (see the "Permissions" section for details):
Copy
Copy. This method allows an app to send one or multiple clips to the clipboard. It can only be used after using the "ReadyToCopy" method. The app indicates what it sends using the convention described in the "Apps" subsection of the "Requirements" section. If the copied data is a file, the app must have access to it.
When one or more clips are copied, the following happens:
Pastable Clip Types
PastableClipTypes. Method for defining the types of clips that can be pasted into a specific app space (e.g. window) or field (e.g. text input field). This helps filter clipboard content that can be pasted when presented visually to the user or to tell the app what types of clips the clipboard has.
-clip_types. Types of clips that can be pasted. Values are either "text" for text input, "uri" for a text input field expecting a URI, a list of file types with their subtypes, or "all" for all values mentioned. Leaving this field empty means that the application does not support clip pasting. For files, wildcards are not allowed for types (e.g. image, video), but allowed for subtypes (e.g. jpeg, mp4).
When the "PastableClipTypes" method is used, the portal checks whether a wildcard is used for types. If a wildcard is used for a type, the portal prohibits the app from copying and pasting clips forever and indicates to the user that the app has made an unauthorized request. If not, the portal returns one of the following responses to the app:
The above responses allow an app to communicate to the user whether pasting is available or not, for example by graying out (or not) a paste option (icon, menu item).
Finally, the app can receive the "available" and "unavailable" responses when clipboard clip types change.
Paste
Paste. Method to tell the portal to retrieve a clip from the clipboard and give it to the calling app.
When the app requests to paste a clip, the portal checks if the clip to paste is a clip type defined when using the "PastableClipTypes" method. If this is the case, pasting the clip works according to the permission set (see the "Permissions" section). If not, the portal tells the user that the app attempted to paste and there is no compatible clip.
Restrictions
An app can use the "copy", "paste", and "PastableClipTypes" methods only when it has the focus. This is not possible when it does not have the focus or when it is running in the background (i.e. without a window).
If the paste action is meant to be triggered with the mouse wheel, it is disabled when scrolling with the mouse wheel.
Permissions
When the "Copy" or "Paste" method is called for the first time, regardless of the app, the portal displays a general dialog box that communicates the following to the user:
This dialog also presents permissions for the paste action that the user can choose:
When the copy or paste action is triggered by the app and not by the user with the shortcuts, the portal acts differently:
Notes:
Censored Clips
See "Questions" section.
Questions
Beta Was this translation helpful? Give feedback.
All reactions