clipboard plasma wayland / wl-copy - filter out a hex 0c -
I am trying to figure out whats going on here: opensusetumbleweed plasma wayland i have a text file, i like to have it inside my clipboard of kde/plasma. the line to copy it to the clipboards are: cat geht.txt | wl-copy cat geht.txt | wl-copy -p if the clipboard is empty (the small symbol on the right lower right of the screen) the symbol will appear and the text will be inside the clipboard. BUT if inside the file is a "hex 0C" (at the end or somewhere inside the text) it will not show up in the clipboard of plasma. (i am still able to read it with wl-paste) this hex number will be automatically generated at the end of the file when i make a .pdf file with libreoffice and pipe it to pdftotext here my small script for copying pdf-texts to the clipboard (the main advantage of this method is, the it looks like it should, not as if i copy it directly with mouse selection) ====pdf2clip============== #!/bin/bash if [[ $XDG_SESSION_TYPE = 'x11' ]] # bei x11: then pdftotext -layout "$1" - | xclip pdftotext -layout "$1" - | xclip -selection clipboard # bei wayland: else pdftotext -layout "$1" - | wl-copy pdftotext -layout "$1" - | wl-copy -p fi ============================= question 1: so i guess its a bug or a feature from wayland? question 2: did anybody who is familar with ark or sed or someting else know a filter i could put into the pipe to delete the "hex 0c" ? thanks in advance simoN -- www.becherer.de
Ok, i managed to filter out this char with sed and have now my workaround: pdftotext -layout singelline-from-libreoffice.pdf - | sed -e 's/\x0c//g' | wl-copy -p still there could be a better solution to filter out all "not printable" chars. so at the moment its working for me, still thinking there is a bug somwhere... simoN Am 22.10.24 um 16:44 schrieb Simon Becherer:
I am trying to figure out whats going on here:
opensusetumbleweed plasma wayland
i have a text file, i like to have it inside my clipboard of kde/plasma.
the line to copy it to the clipboards are:
cat geht.txt | wl-copy cat geht.txt | wl-copy -p
if the clipboard is empty (the small symbol on the right lower right of the screen) the symbol will appear and the text will be inside the clipboard.
BUT if inside the file is a "hex 0C" (at the end or somewhere inside the text) it will not show up in the clipboard of plasma. (i am still able to read it with wl-paste)
this hex number will be automatically generated at the end of the file when i make a .pdf file with libreoffice and pipe it to pdftotext
here my small script for copying pdf-texts to the clipboard (the main advantage of this method is, the it looks like it should, not as if i copy it directly with mouse selection)
====pdf2clip============== #!/bin/bash
if [[ $XDG_SESSION_TYPE = 'x11' ]]
# bei x11: then pdftotext -layout "$1" - | xclip pdftotext -layout "$1" - | xclip -selection clipboard
# bei wayland: else pdftotext -layout "$1" - | wl-copy pdftotext -layout "$1" - | wl-copy -p fi =============================
question 1: so i guess its a bug or a feature from wayland?
question 2: did anybody who is familar with ark or sed or someting else know a filter i could put into the pipe to delete the "hex 0c" ?
thanks in advance
simoN
-- www.becherer.de
Hi, 0x0C is the control character for page break, better known as form feed. https://en.m.wikipedia.org/wiki/Page_break#Form_feed Maybe there's a setting in your program to skip generating form feed, so you don't have to filter it?
Am 23.10.24 um 18:47 schrieb Andreas Joppich:
Hi, 0x0C is the control character for page break, better known as form feed. https://en.m.wikipedia.org/wiki/Page_break#Form_feed
Maybe there's a setting in your program to skip generating form feed, so you don't have to filter it?
Thanks for info, you are correct, the "pdftotext" from poppler tools has a: -nopgbrk option :-)) so this is another workaround. will try. but still the behavior from: textwith-0c -> xclip -> x-clipboard (works with 0c) to textwith-0c -> wlcopy -> wayland-clipboard (did not show contens when 0c is used) if the programm xclip removes simply the 0c or if the clipboard itselve has a problem of wayland i do not know, nor know how to figure out. i have filed a bug to wl-clipboard: https://github.com/bugaevc/wl-clipboard/issues/237 and to opensuse: https://bugzilla.opensuse.org/show_bug.cgi?id=1232228 simoN -- www.becherer.de
participants (2)
-
Andreas Joppich
-
Simon Becherer