How to Stop Ubuntu from Automatically Clearing the Clipboard When Closing Apps

In standard desktop environments like Windows and macOS, when you highlight text in a web browser and press Ctrl+C, that text is saved to a persistent system clipboard. You can then close the web browser entirely, open a text editor, and press Ctrl+V to paste the text. However, in Linux environments using the traditional X11 windowing system, the clipboard behaves very differently.

In X11 (which many Ubuntu users still use, especially with older applications), the clipboard data is often tied directly to the application that owns the text. If you copy a massive block of code from Firefox, and then completely close the Firefox window, the copied data instantly vanishes into thin air. When you try to paste it into your terminal, nothing happens.

To fix this frustrating behavior, you must install a “Clipboard Manager,” a lightweight background utility that intercepts copied text and saves it to a persistent daemon, ensuring it survives even if the source application is terminated.

How to Keep the Clipboard Active After Closing Apps

You must install a clipboard manager like Diodon or Parcellite to hold your copied data.

  1. Open your terminal application (Ctrl+Alt+T).
  2. Install the Diodon clipboard manager by running the following command:
sudo apt install diodon
  1. Once installed, press the Super (Windows) key and type Diodon to launch the application.
  2. A small paperclip icon will appear in your top GNOME panel.
  3. Right-click (or click) the paperclip icon and select Preferences.
  4. Ensure the checkboxes for Use primary selection and Use clipboard are both checked.

Diodon will now actively monitor your clipboard. If you copy text from LibreOffice and then forcefully close LibreOffice, Diodon will act as a safety net, holding onto the text so you can still successfully paste it into your email client.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.