The Gnome desktop has 2 clipboards, X.org (saves every selection) and inherited (CTRL + C). I am writing a simple python script to clear both clipboards, reliably, as this can be done after copying the password.
The code I saw here is as follows:
os.system("xclip -i /dev/null")
os.system("touch blank")
os.system("xclip -selection clipboard blank")
Unfortunately, this code for some reason creates a file with a name blank
, so we need to delete it:
os.remove("blank")
However, the main problem is that by invoking both of these scenarios, it leaves the process xclip
open, even after closing the terminal.
So, we have two problems with this option:
1) It creates an empty file, which seems to me an incorrect method
2) It leaves the process open, which could be a security hole.
:
os.system("echo "" | xclip -selection clipboard")
\n
newline , .
, ?