0

How can I select/copy sections of text (from the browser and also from an open editor) that automatically gets appended to a file?

Piping the contents of the clipboard will slow me down and I may as well paste it as I am doing now. The idea is to do nothing other than the copy operation (Ctrl+c) that would result in the selection being appended to the file of my choosing.

  • You might find this useful: http://stackoverflow.com/questions/749544/pipe-to-from-clipboard – Elder Geek Sep 10 '16 at 19:51
  • I think the nearest solution is what Serg has offered in question number 797132. I just need to find and install his python script –  Sep 11 '16 at 10:42
  • Clearly it's here: https://gist.github.com/SergKolo/ff9defd9cef4e704a64be505f28fa3cd and reproduced at the bottom of his answer – Elder Geek Sep 11 '16 at 13:02
  • yes I found and downloaded Sergkolo's Python script from github. But I am struggling to run it successfully. I get "PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded from gi.repository import Notify"; How can I check if that script is OK? –  Sep 11 '16 at 14:04
  • Perhaps leaving a comment below his answer here will get his attention. http://askubuntu.com/questions/797132/how-to-only-append-to-clipboard-but-not-overwrite-current-data – Elder Geek Sep 16 '16 at 16:42

2 Answers2

0

I suggest that you try the current version of append_clipboard.py from https://gist.github.com/SergKolo/ff9defd9cef4e704a64be505f28fa3cd

The script was modified 6 hours after your comment regarding Notify 0.7 and appears to address your concerns.

Dont forget you need to have xclip installed as referenced in @Serg answer to How to only append to clipboard (but not overwrite current data)?

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • Tried the new version. Still no joy. No error messages this time. But it does not append –  Sep 12 '16 at 15:28
  • So you've appended a number of copy actions to the clipboard. What happens when you try to paste the content of the clipboard? Did you install xclip? – Elder Geek Sep 12 '16 at 15:30
  • Yes the latest version of xclip is installed. First I copy text1. I then highlight text2 and use the shortcut key I have designated to run the python script. I then paste, hoping to see both text1 and text2. But I only get text1. –  Sep 12 '16 at 16:58
  • What happens if you run the script prior to beginning a highlighting session? Perhaps @Serg can shed some light on this for you. – Elder Geek Sep 12 '16 at 17:02
  • I get a little window with four line. Line 1 says Action using:",;line 2: is text1; line 3 is the greyed out word EMPTY, and line 4 is Edit Action. If I click that last line it opens a whole new dialogbox –  Sep 12 '16 at 17:17
0

As Byte Commander explained in another thread, bash commands in custom shortcut key should be in single quotes and preceded by bash-c. Therefore to run the python script using a shortcut key, the command that worked for me was:

bash -c 'python ~/myscripts/test_python.py'

and the command to run a shell script using a shortcut key:

bash -c 'bash ~/myscripts/test.sh'