erebe / greenclip

Simple clipboard manager to be integrated with rofi - Static binary available

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-line text in staticHistory

b0x4it opened this issue · comments

Is it possible to have multi-line text in staticHistory?

Hello,

With a bit of trickery yes

printf 'a\xA0b\xA0c' > static_history
iconv -f latin1 -t utf-8 static_history > static_history.tmp
iconv -f latin1 -t utf-8 static_history.tmp > static_history
mv static_history ~/.cache/greenclip.staticHistory

\xA0 is a void character used internally by greenclip to replace \n. We inject it with printf instead of \n and convert the file until it is a valid utf-8 file.
After that the \xA0 will be present as a valid utf-8 and will be replaced by \n by greenclip

You will see a b c when you print the history but it will be with line separator with selected/pasted.

Not very user friendly but it works...

Great, thank you!

done in version 4.0
static history is now in the config file

static_history = [
 '''¯\_(ツ)_/¯''',
]