In Linux, the last selected text is copied automatically to the clipboard, so you can paste it by pressing the mouse-wheel. This works in every program, including text on web-pages in the browser. Just in Jupyter notebooks this does not work (tested with different Browsers on different systems). With Strg+C the copy works. Also pasting into a Jupiter notebook works (with Strg+V and also with the mouse-wheel).
Is there a way to repair/turn-on the automatic copy to the clipboard? Has anyone an idea how does this turn-off of that basic linux-functionality even works?
I have some idea...
The first thing to understand is that there are two spaces to paste from or into.
$ man xclip | sed '/-selection/,/^$/{ s/......//;p }' -n
-selection
specify which X selection to use, options are "primary" to use
XA_PRIMARY (default), "secondary" for XA_SECONDARY or "clipboard"
for XA_CLIPBOARD
When something is marked with the mouse, it goes into the primary buffer. When something is copied with Ctrl+c and inserted with Ctrl+v, then clipboard buffer is used.
However, this is is up to your desktop environment to manage. Although this behavior may seem somewhat arbitrary, I have found that the Ctrl+c/v (keyboard) vs. (mouse) mark-select-middle-click-paste dichotomy generally holds up in the various window managers I have used in the past.
Some applications will use both. This is potentially confusing. Imagine this scenario:
With pictures:
steps 1 and 2;
After copying the json blob in Goland, I expect that the middle button will paste it into the terminal, but that does not happen. Instead, after clicking the middle button, the previously marked text is inserted: img2txt img2webp imgtoppm
.
step 3 and 4;
However, equipped with the knowledge that it's in the other buffer, I can get it out like this:
step 5;
It's also possible to copy from the clipboard into the primary buffer, after which the middle mouse does what one might expect:
$ xoc | xi
$ type xi ; type xoc
# xi is aliased to `xclip -i'
# xoc is aliased to `xclip -o -selection clipboard'
After re-reading your question, I notice that your terminology is slightly off. What you call "clipboard" is actually the primary buffer. It appears not to work with the Jupiter workbooks because you (some other program that you are using) are selecting the text into the clipboard buffer, but pasting from the primary buffer. The Strg+c and Strg+v works because they always work with the clipboard buffer and not the primary buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With