VSCode Markdown Paste on Wayland
Markdown Paste?
First, what do I mean? Using the Markdown Paste 🔗 allows for the easy pasting of, among other things, images!
Pasting via Ctrl+Alt+V will add the corresponding markdown…
And it will of course add the file — for which we specify the name…
The issue
As documented in the extension, Linux support is provided via xclip 🔗.
I’m on Wayland, so this doesn’t exactly work. Well, there’s a slight chance xclip will just work,
especially since we’re using the normal clipboard. Part of me regrets not having tried it…
In any case, there is an issue to add Wayland support 🔗, but there’s nothing to it.
By coincidence, while reading the wl-copy manfile a while back,
I found out the wl-clipboard-x11 🔗 project.
It, more or less, translates xcopy invocations to wl-copy and wl-paste.
The only problem is that it that
the -t TARGETS option isn’t supported 🔗,
and this is used by Markdown Paste 🔗.
The workaround
I did as one normally does and forked the repo,
adding my own -t TARGETS implementation 🔗.
A quick make install later, and the extension works like a charm! 🥳
-t|-target)
if [ "$2" == "TARGETS" ]; then
CLIPBOARD_COMMAND="${WL_PASTE}"
set -- "${@}" "--list-types"
: $((COUNT = COUNT -1 ))
shift 1
else
set -- "${@}" "--type"
fi
;;