rickyrockrat / parcellite

GNU General Public License v3.0
224 stars 29 forks source link

Understanding expected fifo_cmd behavior #31

Closed cmorgenstern closed 5 years ago

cmorgenstern commented 5 years ago

The ability to disable Parcellite collection from the command line was added back in 2013.

My understanding of this feature is that it should work as follows:

  1. Pass echo -n "stop_all" >> fifo_cmd
  2. Clipboard is disabled - items copied do not appear in Parcellite history.
  3. Pass echo -n "run_all" >> fifo_cmd
  4. Clipboard is re-enabled - items copied while the clipboard was disabled still do not show up in Parcellite history

However, when testing with Parcellite 1.2.1, after passing echo -n "run_all" >> fifo_cmd, anything that I copied while the clipboard was disabled shows up in the Parcellite history. Since I am trying to use these commands to disable Parcellite collection while using password-store, this means that copied passwords still eventually end up in the Parcellite history, which is not desired.

Is this expected as part of the added fifo_cmd functionality? If so, would it be possible to add a command that will both disable the clipboard and not restore copied entries once re-enabled?

rickyrockrat commented 5 years ago

What is sad is this feature was requested by a user and do not recall testing it. If you run Parcellite from the command line (goto the menu and quit, then parcellite &). You should see 'Got 'stop_all' cmd.

If you see that, this should work.

rickyrockrat commented 5 years ago

I can now honestly say I have tested this. Turns out I need to kill the newlines. The work around for now is to do echo -n "stop_all" > fifo_cmd. Give 'er a whirl and see if that gets you going. The newline fix is on the master.

cmorgenstern commented 5 years ago

Thanks for looking into this. I grabbed a copy of the master and built it, but Parcellite still seems to be behaving the same way.

System Info 5.0.7-arch1-1-ARCH GNU/Linux Parcellite git-38b799d, GTK 2.24.32

Steps to recreate

  1. Run echo -n "stop_all" > "$HOME"/.local/share/parcellite/fifo_cmd
  2. Copy "some text" - confirm that there is no entry for "some text" in the Parcellite history
  3. Run echo -n "run_all" > "$HOME"/.local/share/parcellite/fifo_cmd
  4. The history entry for "some text" suddenly appears

Is there any way to prevent Parcellite from retrieving entries copied while stop_all is in effect once run_all is passed? Or, additionally, would it be possible to just add a feature to completely clear the history from the command line?

rickyrockrat commented 5 years ago

I can't do anything about what is in the cliboards when run_all is executed. I could, however, add a clear_all command, if that will help.

cmorgenstern commented 5 years ago

A clear_all command would be great. Thank you very much - I would be happy to test and report back on the feature.

rickyrockrat commented 5 years ago

OK. Pull and build. I recommend doing a stop_all followed by a clear_all - this should also clear out both clipboards - do the clear_all just before your run_all, and it should delete the entry you just put there.

cmorgenstern commented 5 years ago

Pulled and built, tested successfully. Running clear_all at any point in time appears to take care of wiping the history regardless of whether stop_all has been implemented. I don't mind the entire history being cleared if it means being able to keep passwords out of the clipboard, though. Thanks once again for adding that functionality in!

There was a proposed patch to password-store a number of years ago that wanted to take advantage of the original stop_all and run_all functionality. Although it was never adopted into the code base, now that Parcellite supports a single command to wipe the history, I may ask the password-store devs to take a look at adding the patch but using the clear_all functionality. In the interim, I will probably package password-store with the Parcellite patch for the Arch Linux AUR.