1

I'm using xfce4-terminal with the setting enabled: "Automatically copy selection to clipboard"

It works fine when select something, the selection is copied to clipboard. But if I close the terminal window, the clipboard becomes empty. It doesn't matter how I close it, by menu or by hotkey.

And the terminal only clears the content copied from itself. I tried copy some text from Chrome Browser, then close the terminal, the clipboard content is still there.

Why is that? How to keep the clipboard content when close the terminal?

Environment: Kali Linux, xfce

Edit:

Just learned from comments, it seems to be the syncing problem between PRIMARY and CLIPBOARD. I tried tools form other site that works for them, but not work for me:

  1. parcellite

    Right click -> Preferences -> Synchronize clipboards

    Doeas not work at all.

  2. autocutsel

    autocutsel -fork -selection CLIPBOARD -debug -verbose
    autocutsel -fork -selection PRIMARY -debug -verbose
    

    The debug output is correct when selecting text in terminal, but not synced to CLIPBOARD, don't know where it synced to.

  3. xfce4-clipman:

    Right click -> Properties -> Sync mouse selections

    It works for syncing, the problem is that it syncs mouse selection from everywhere, not only from terminal, even with the option "Ignore mouse selections" checked.

AdminBee
  • 22,803
aj3423
  • 215
  • 3
    Probably this: "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." – Kamil Maciorowski Dec 04 '21 at 14:46
  • 2
  • @StephenKitt, that explains how the "cut-buffers" or "PRIMARY" works: by interacting with XServer, but I still can't find a solution. – aj3423 Dec 04 '21 at 17:28
  • 1
    @aj3423 you seem to have run off in some other direction - syncing PRIMARY and CLIPBOARD have nothing to do with the problem here. The problem is that "copying" something is only an indication to the X system that something is available to paste. No data is saved or transferred anywhere until a paste occurs. If you close the source application before the paste happens, well, then, there's nothing to paste from. – muru Dec 06 '21 at 11:02
  • @muru, if I copy text from Chrome, then close Chrome, the text still available for pasting, seems the text is actually saved somewhere. But in terminal, it's just an indication as you said. I'm trying to find a way to sync this indication to an actual copying. – aj3423 Dec 06 '21 at 15:35
  • 1
    @aj3423 are you sure you don’t have another Chrome window open somewhere? On my system, content copied in Chrome isn’t available after Chrome exits. – Stephen Kitt Dec 06 '21 at 15:40
  • @StephenKitt yes I can confirm no Chrome process left and the paste still works, not only Chrome, other apps like Telegram, Drawing, all work like that, except the terminal. I guess only the terminal uses PRIMARY and others use CLIPBOARD or cut-buffers. – aj3423 Dec 06 '21 at 17:09
  • @aj3423 Which clipboard manager are you using? The behaviour you say yuou see (no left process, but paste still works) indicates one is running. You mention three in your post. – muru Dec 07 '21 at 03:26
  • @muru I'm not using any clipboard manager, I uninstalled xfce4-clipman which is installed by default in Kali Linux because I don't need the features like clip history. But I tried it, result in the Edit.3 of the op. – aj3423 Dec 07 '21 at 05:58
  • @aj3423 please put aside the PRIMARY/CLIPBOARD syncing stuff. That is irrelevant here. Did you have clipman installed when you noticed that you could paste after closing Chrome? Or parcellite? – muru Dec 07 '21 at 06:13
  • @muru No, the clipman isn't installed, it works without any clipboard manager. But seems application specified, these apps works: Chrome / FireFox / Telegram / Drawing, and these not work: Terminal / VSCode / Wireshark. By 'works' I mean even app closed, copied content still available, with no running clipboard manager, by 'not work' I mean I can paste when the app is running, but I can't paste after app closed. – aj3423 Dec 07 '21 at 06:52

0 Answers0