7

I'm running OpenSUSE 13.2 and I'm using Keepass2. The app is runnig via mono. I want to copy my password from keepass to the terminal, however this isn't working using CTRL + SHIFT + V. This is a common problem but I can't find a proper solution.

Note that I won't run Keepassx as Keepas (.net) has many more features (e.g. KeepassHTTP).

Thanks in advance!

LEDfan
  • 171
  • 3
  • 8

1 Answers1

8

I found the solution!

I can confirm this works on OpenSUSE and Arch Linux. I hope this works on other distro's too. I tried everything in this question How can I merge the gnome clipboard and the X selection? but nothing helped. I found this bug at launchpad which worked: https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/1010289 .

Solution: Install both xdotool and xsel, and restart gnome-terminal and keepass2.

I tested this on gnome-terminal, terminator and konsole.

EDIT: this solution works, however not for some Java based applications. (PHPStorm and other Jetbrains software) I solved this: - install parcellite - start it - right click on the tray icon and choose preferences - make sure Use Copy (Ctrl+C), Use Primary and Synchronise clipboards are enabled.

enter image description here

EDIT2: There is a better solution for the Java problem (thanks @colan), a patch has been merged into xsel but this hasn't been released (see: https://github.com/kfish/xsel/pull/6), but compiling from source is very easy:

  1. first remove xsel using your package manager
  2. clone the repo: git clone https://github.com/kfish/xsel
  3. cd xsel
  4. touch README (looks like the autogen script needs a README file, but can't found it)
  5. ./autogen.sh
  6. make
  7. sudo make install

You can manually test it: echo "test" | xsel -i -b.

This will install xsel into /usr/loca/bin/. Note that version 1.2.0 of xsel is not the correct version, this was released 9 years ago and doesn't include the patch! On arch linux you can use xsel-git from the AUR https://aur.archlinux.org/packages/xsel-git/.

LEDfan
  • 171
  • 3
  • 8
  • xdotool was installed, but xsel did the trick for me, too! I can confirm that i had the same problem and that this solution solved it on Debian Testing. – amenthes Sep 25 '15 at 12:01
  • 1
    The Java issue is described at https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/1379877 . – colan Mar 08 '17 at 16:21
  • 2
    @colan wow that's awesome. Compiling xsel from source resolves the issue! – LEDfan Mar 09 '17 at 06:48
  • I did all your steps to compile xsel from source and I get this `echo "test" | xsel -i -b. bash: /usr/bin/xsel: No such file or directory `. I manually copied it from `/usr/local/bin`, but my version is still `xsel version 1.2.0 by Conrad Parker ` – Freedo Jan 13 '18 at 07:44