Pasting text after closing window

I want to copy text (for example) from the terminal, close the terminal, and then paste the text into (for example) a text editor.

This doesn’t work. As soon as I close the terminal, I can’t paste it by pressing ctrl + v, or by right clicking + clicking paste. However, it’s still in the thing in the panel (the thing next to volume, bluetooth, network, etc).

  1. Why?
  2. How can I change this?

Strange. Ctrl + Shift +C from Konsole. Konsole closed. Opened Kate. Ctrl + V inserts.

Ok. I tested it, and it does indeed work with Konsole and Kate.

But now it gets strange:

If I use Terminator, and try to paste to Firefox, it doesn’t work. Unless I click into Kate, and then paste into Firefox. In the later case, it works.

So, it goes as follows:

I open Terminator, and copy “foo”. I close it, and paste into Firefox. Nothing happens. I click into an open Kate window, click into Firefox again, and paste. The result is “foo”.

And it gets even stranger:

If I use Terminology, copy something, paste it (no matter where), close Terminology, and paste again, I then paste whatever was in the clipboard before.

So, lets say, I copy “foo”, open Terminology, copy “bar”, paste into Kate, the result is “bar”. I then close Terminology, and paste into Kate again. The result is “foo”. WTF is going on?!

It is kind of weird, but certain “copy” functions don’t actually do anything until you paste. Check out this section from the clipboard entry on ArchWiki:

It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.

KDE apps are notoriously not simple, so it does not surprise me that there is integrated clipboard management behavior when you are using Kate and Konsole.

If you want a more persistent clipboard functionality, you should install a clipboard manager.

1 Like

KDE comes with a clipboard manager, called klipper. There is no need to install anything.

No, there isn’t. All clipboard management on KDE should be done through klipper, assuming klipper is running.

There is no problem copying from Konsole to Firefox, even after Konsole is closed.

  1. Select text in Konsole, press Ctrl+Shift+C.
  2. Close Konsole (press Ctrl+D),
  3. Focus on a Firefox window, find a text input field and press Ctrl+V
  4. Profit.

Given this, my conclusion is that there must be something wrong with Terminator. Use Konsole, it’s a superior terminal emulator, anyway, and I am sure you can customise it to your liking.

The only reason to use any terminal emulator other than Konsole is the case when you’re not using KDE Plasma, since Konsole comes with a ton of dependencies.

I’m sorry if it was mentioned before, but pasting into a web browser could be pensive, but it’s for security reasons. Somebody could hijack your system through the clipboard and it has been done many times before on M$-oh-ess side of things. :wink:

CTRL+C and other familiar clipboard keys actually create control characters on any terminal emulator which is the reason why the SHIFT key has to be involved as well. It’s clumsy for somebody coming over from Windows but it is what it is. If you run, I think XFCE4 Terminal, visit the preferences and the last tab, it will tell you what’s going on: it’s not a good idea to change anything that does CONTROL key and letter. Probably Konsole is that great though…

I don’t recommend “clipboard managers” like Parcellite – I uninstall one of those as soon as I can. I accept only one that could be used inside an application, like one of my favorite programs, which cannot be brought outside that application.

(Despite what I’ve said here don’t install anything. I’m only trying to explain something. Why keystroke combinations could be weird sometimes, with a program like the terminal that is very necessary in Unix and Unix-like operating systems.)

So when you say “No, there isn’t” you mean “Yes, that’s exactly right, it’s called klipper.” :rofl:

If the OP is using KDE then the Klipper clipboard manager should be in use, as @Kresimir has pointed out. To get Terminator to honor the clipboard buffer, right click on the terminal window and select Preferences → Profiles and tick the checkbox that says “copy on selection”.

Absolute twaddle. You’ve said this:

The implication is clear, that due to “complexity” of KDE software there exists some special integrated clipboard manager specific to KDE software. No, that is false. Klipper is an universal clipboard manager, and Konsole and Kate are not special in the way they use Klipper.

No, it is true! It is called Klipper! :rofl:

Really? How do you install it then, if you don’t use KDE? :thinking:

Klipper is part of the plasma-workspace meta package–it’s about as integrated into KDE software as a clipboard manager can possibly be.

I can confirm this behavior when KDE is running in VirtualBox. It happens in my experience when running KDE in VirtualBox with either EndeavourOS or Manjaro as the guest.

Are you running KDE in VirtualBox? If so, try this experiment:

  1. Open Kate and create a new document.
  2. Open Konsole and run neofetch.
  3. Double-click to select any word in the output.
  4. Press Ctrl+Shift+C to copy the selected word to the clipboard.
  5. Notice that you cannot use Alt+F4 to close Konsole. Instead, use your mouse to close Konsole.
  6. Crucial step: Tap the right Ctrl key once. Doing so momentarily returns the focus to the host machine.
  7. In Kate, press Ctrl+V to paste the word you copied from Konsole.

Having returned the focus momentarily to the host machine in Step 6, pasting should work in Step 7 as expected.

By the way, the same problem occurs whether or not you close Konsole in Step 5. For example, you could keep Konsole open and simply click Kate to give it the focus before attempting to paste.

Also, the problem occurs no matter which app you paste into. For example, the problem occurs when you attempt to paste into Firefox, just as it does in Kate.

It doesn’t work like that at all on bare metal.

No, I’m not using Virtualbox. My system is installed on normal hardware.

1 Like

Yes, your issue is not related to what I am experiencing in VirtualBox.

Explanation of the unrelated VirtualBox problem

It turns out that in VirtualBox, pressing Ctrl+Shift+C causes VirtualBox to suspend normal keyboard functionality until it receives a special key it understands. For example, pressing Ctrl+Shift+C followed by F toggles the guest window in and out of full-screen mode, just as if you had pressed (right) Ctrl+F. Consequently, in VirtualBox, pressing Ctrl+Shift+C to copy text in any terminal (Konsole is not unique to this problem) prevents the subsequent press of Ctrl+V to paste what you had copied. Tapping the (right) Ctrl key, as I suggested, terminates this wait-for-input mode and the paste operation succeeds.

So, I am baffled by your problem. @Kresimir is correct that your problem shouldn’t be happening on a bare metal installation, unless there is something we don’t yet understand about your installation or configuration.

Actually, I can replicate this behavior in Terminology.

Before closing Terminology, I paste the last thing I had copied in Terminology. However, after closing Terminology, I paste the last thing I had copied (from the previous application) before Terminology had been opened (even if I had copied several times within Terminology).

Interestingly, copying any number of times in Terminology never updates the clipboard history I see in the system tray. I see only items I had copied in other applications. However, even though I don’t see in the history what I last copied in Terminology, I can still paste into other applications what I last copied in Terminology, until I close Terminology.

On the other hand, if I use Konsole instead of Terminology, the clipboard history is updated each time I copy within Konsole, and I continue to paste whatever I had last copied in Konsole after I close Konsole, and the clipboard history in the system tray remains accurate at all times.

So I would use Konsole because it deals with the clipboard correctly—and because it’s a great terminal application.

Pardon my naiveness but I was responding to this part of the quotation.

Because the web browser has to be kept open, along with the text editor and any terminal emulator, it works. If the user has to fire it up before pasting something, it doesn’t. Or it works but not always.