Menu

#38 Nothing copied to clipboard

v1.0 (example)
closed-invalid
None
9
2022-03-10
2019-01-13
Greg Parker
No

Installed kpcli from AUR. Everything is working except copying a password to the clipboard. I installed both the additional Perl libraries for the clipboard. When I use xp is says everything has worked but the password is not on the clipboard.

KeePass CLI (kpcli) v3.2 is ready for operation.
Type 'help' for a description of available commands.
Type 'help ' for details on individual commands.

kpcli:/> vers
VERSIONS

  • kpcli: 3.2
  • Perl: v5.28.1
  • File::KeePass: 2.03
  • Term::ShellUI: 0.92
  • Term::ReadKey: 2.37
  • Term::ReadLine: 1.17
  • Capture::Tiny: 0.48
  • Clipboard: 0.13
  • Term::ReadLine::Gnu: 1.35
  • Math::Random::ISAAC: not installed (optional)
  • Sub::Install: not installed (optional)

ReadLine being used: Term::ReadLine::Gnu
Operating system: linux ("Manjaro Linux")

Discussion

  • Lester Hightower

    • status: open --> closed-invalid
    • assigned_to: Lester Hightower
    • Priority: 5 --> 9
     
  • Lester Hightower

    The perl module Clipboard requires the xclip command. Please verify that you have that installed. I don't use Arch Linux often, but on Debian and Ubuntu it is packaged thusly:

    hightowe@zion:~$ which xclip
    /usr/bin/xclip
    hightowe@zion:~$ dpkg -S /usr/bin/xclip
    xclip: /usr/bin/xclip
    hightowe@zion:~$ apt-cache show xclip
    Package: xclip
    Priority: optional
    Section: universe/x11
    Installed-Size: 71
    Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
    Original-Maintainer: Alessandro Ghedini <ghedo@debian.org>
    Architecture: amd64
    Version: 0.12+svn84-4
    Depends: libc6 (>= 2.14), libx11-6, libxmu6
    Filename: pool/universe/x/xclip/xclip_0.12+svn84-4_amd64.deb
    Size: 16992
    MD5sum: d28fad44fae30de33e4092cc158008bd
    SHA1: 6e67fae9bae3f77809b8f116415805844ef41bc1
    SHA256: 09aded46dca0742e25d0be45247895a82d1ba574fb561e90dc5d0d2afa6c0acb
    Description-en: command line interface to X selections
     xclip is a command line utility that is designed to run on any system with an
     X11 implementation. It provides an interface to X selections ("the clipboard")
     from the command line. It can read data from standard in or a file and place
     it in an X selection for pasting into other X applications. xclip can also
     print an X selection to standard out, which can then be redirected to a file
     or another program.
    Description-md5: 7de32c567d0e0ae3e774a47b7dbea945
    Homepage: http://xclip.sourceforge.net
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Origin: Ubuntu
    

    Hope this helps. Please reply to the ticket to let me know.

     
  • Greg Parker

    Greg Parker - 2019-01-13

    Looks like I have xclip.

    $ which xclip
    /usr/bin/xclip
    [greg@greg-pc ~]$ pacman -Q --info xclip
    Name : xclip
    Version : 0.13-2
    Description : Command line interface to the X11 clipboard
    Architecture : x86_64
    URL : https://github.com/astrand/xclip
    Licenses : GPL
    Groups : None
    Provides : None
    Depends On : libxmu
    Optional Deps : None
    Required By : perl-clipboard
    Optional For : None
    Conflicts With : None
    Replaces : None
    Installed Size : 59.00 KiB
    Packager : Gaetan Bisson bisson@archlinux.org
    Build Date : Wed 03 Oct 2018 08:13:22 PM ADT
    Install Date : Sun 13 Jan 2019 02:37:11 PM AST
    Install Reason : Installed as a dependency for another package
    Install Script : No
    Validated By : Signature

     
    • Lester Hightower

      Does xclip from the command line work for you?

      $ echo "test copy" | xclip -in
      

      ...and then paste to test.

       
  • Greg Parker

    Greg Parker - 2019-01-13

    Not quite like you have it, but this does:

    echo "test copy" | xclip -in -selection clipboard

     
  • Greg Parker

    Greg Parker - 2019-01-14

    Just hacking around. If I change Clipboard->copy to Clipboard::Xclip->copy_to_selection then everything works

    lines 1788-1791

    if (defined($to_copy)) {
    Clipboard::Xclip->copy_to_selection("clipboard", $to_copy);
    print "Copied $cp_map->{$xNcmd} for \"$ent->{title}\" to the clipboard.\n";
    }

     
    • Lester Hightower

      Looking at the Clipboard code here: https://metacpan.org/source/KING/Clipboard-0.13/lib/Clipboard/Xclip.pm

      I see that the default "-selection" option is "primary", taken from this list, this way (item 0):

      sub all_selections { qw(primary buffer clipboard secondary) }
      sub favorite_selection { my $self = shift; ($self->all_selections)[0] }
      

      ...and, with your code change, you overrode that to "clipboard" instead. I am not 100% sure what that is doing in your personal X11 environment, but I suspect this nit to be local to it. You'll need to dig into the various X11 clipboards to try to understand the details. Here is a start:

      $ man xclip | egrep -A2 -- '^ +-select'
             -selection
                    specify which X selection to use, options are "primary"
                    to use XA_PRIMARY (default), "secondary" for XA_SECONDARY
                    or "clipboard" for XA_CLIPBOARD
      

      https://tronche.com/gui/x/icccm/sec-2.html#s-2.6.1

       
  • dhobach

    dhobach - 2022-03-09

    Setting both primary AND clipboard at the same time would be right, see https://specifications.freedesktop.org/clipboards-spec/clipboards-latest.txt :

    • explicit cut/copy commands (i.e. menu items, toolbar buttons)
      should always set CLIPBOARD to the currently-selected data (i.e.
      conceptually copy PRIMARY to CLIPBOARD)

    • explicit cut/copy commands should always set both CLIPBOARD and
      PRIMARY, even when copying doesn't involve a selection (e.g. a
      "copy url" -option which explicitly copies an url without the
      url being selected first)

     

    Last edit: dhobach 2022-03-09
    • Lester Hightower

      Have you looked at the --xclipsel command line option?

      $ kpcli-DEVELOPMENT.pl  --xclipsel=help
      --xclipsel must be one of: all, [primary], buffer, clipboard, secondary
      

      Is that choice what you are referring to?

       
      • dhobach

        dhobach - 2022-03-10

        Thanks, looks like it was implemented in a version newer than mine (3.1).

        I'll upgrade then, much appreciated!

         

Log in to post a comment.

MongoDB Logo MongoDB