Skip to main content
Topic: [SOLVED] Clipboard emptied as soon as the original app is closed (Read 712 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] Clipboard emptied as soon as the original app is closed

I'm a glad user of Artix LXQt and I noticed a weird bug, the clipboard is emptied as soon as I close the window from which I copied or cut from. Does anyone have an idea on how to fix that?

I have a temporary workaround, I use the CopyQ clipboard manager from the Arch repos, it stores my clipboard so that I can retrieve if I mistakenly close the window in between.

Thanks for any tips ;)

Re: Clipboard emptied as soon as the original app is closed

Reply #1
The app is probably using the QT QClipboard class, which is deleted at program end.

Re: Clipboard emptied as soon as the original app is closed

Reply #2
Installing a clipboard manager is the de-facto solution. It is going to do it's job more consistently.

 

Re: Clipboard emptied as soon as the original app is closed

Reply #4
The app is probably using the QT QClipboard class, which is deleted at program end.


Thanks for those answers that ask even more questions, I wouldn't have expected it worked like that behind the scene.

"At the level of the core protocol, the PRIMARY and CLIPBOARD selections do not differ. But the xclipboard client makes them behave differently. In particular, when another client asserts the ownership of the CLIPBOARD selection, this program requests and displays it in a window. Any further request for this selection are handled by xclipboard. This way, the content of the selection survives the client having copied it."

So xclipboard isn't the culprit but this qt class is?

Does anyone know the reasoning behing making the clipboard only survive the program from which it was filled?

What can I do apart from the clipboard manager workaround? It's kind of unconvenient still because I need to select the last element and put it again in my clipboard to get access to it, instead of just doing ctrl+v.

Thanks for any help and sorry if it's newbie level, I never tinkered with such things.


Re: Clipboard emptied as soon as the original app is closed

Reply #6

Does anyone know the reasoning behing making the clipboard only survive the program from which it was filled?



This comes down to the QT development platform.  The  QClipboard (as well as any instantiated object) is part of the application.  And once the application ends, all its objects are disposed of.   If the QClipboard was left available, there is nothing running to manage it (dispose of it) and that would be a memory leak.  QClipboard is not meant to be a system wide, always available to everyone clipboard; thats what the  various clipboard managers that others have mentioned do.  Its more for an individual application to access the clipboard.  


Re: Clipboard emptied as soon as the original app is closed

Reply #7
Quote
and that would be a memory leak.

Makes a lot of sense. Well that was an interesting dive into the how it works. And the clipboard manager gives the functionality I expect anyway, thanks guys