Skip to content

Make clipboard utility configurable #3885

@fsackur

Description

@fsackur

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

xclip is hard-coded in https://github.com/PowerShell/PSReadLine/blob/ff4bbd5ee/PSReadLine/Clipboard.cs#L80 and https://github.com/PowerShell/PSReadLine/blob/ff4bbd5ee/PSReadLine/Clipboard.cs#L117 .

Problems:

Can we expose this as a PSReadLineOption?

Relevant: #1993 - PSReadLine has sucked for a long time at copy-paste on Linux 😥

Proposed technical implementation details (optional)

Any thoughts appreciated, but to get the ball rolling, I think we would likely need:

  • CopyTool
  • CopyToolArgs
  • PasteTool
  • PasteToolArgs

I suggest:

  • A single object, to avoid adding 4 parameters:

    internal struct ClipboardTool
    {
        internal string Copy;
        internal string[] CopyArgs;
        internal string Paste;
        internal string[] PasteArgs;
    }
  • Stipulate that CopyTool must accept input from the pipeline

  • On Windows, setting the property throws an exception

  • On Linux / Darwin you can do Set-PSReadlineOption -ClipboardTool @{Copy = 'xsel'; CopyArgs = ('-i', '--clipboard')}

    • Missing paste args, in this case, are init'd to xclip / pbcopy (the current defaults)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions