Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -alt-text option to set STRING (for text/html to work in Chrome) #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

phillipberndt
Copy link

I would like to propose a new option, -alt-text t, that sets a STRING target in addition to whatever target atom is set from stdin/a file. So the command line

echo -n Bar | xclip -i -sel clip -alt-text Foo -t text/html

will result in Foo being pasted into terminals, and Bar being posted in web browsers.

The reason I'd like to have such an option is that Chrome does not offer the option to paste HTML into text fields unless the STRING atom target is set and non-empty. To be precise, without -alt-text, I cannot paste HTML into a chat in the Slack website running in Chromium.

This allows to put HTML into the clipboard and still paste it in Chrome:
If the TARGETS list only contains text/html, it won't offer the option
to paste into text fields.
@tonyvfish
Copy link

Is it possible to have multiple mime types using comma separation i.e.
text/html,x-special/gnome-copied-files

@cameron1729
Copy link

cameron1729 commented Apr 5, 2024

This also fixes a problem I was facing with Telegram. Previously I could do echo "file:///tmp/export.mp4" | ./xclip -selection clipboard -t "text/uri-list" and then when I did Ctrl + v in Telegram it would paste the video.

After a recent update it stopped working, but with this patch I can do: echo "file:///tmp/export.mp4" | ./xclip -selection clipboard -alt-text whatever -t "text/uri-list" and pasting in to Telegram works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants