Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

copy-uri

An xdg URI handler for the non-standard copy: scheme. Opening copy:<percent-encoded text> decodes the text and puts it on the clipboard.

Terminals that turn OSC 8 hyperlinks into clickable links route unknown schemes through xdg-open. Registering copy-uri as the handler for copy: turns a copy: link in a terminal into a one-click copy of whatever text it encodes.

Requirements

  • Linux desktop with xdg-utils (xdg-open, xdg-mime, update-desktop-database)
  • One of wl-clipboard (wl-copy), xclip, or xsel
  • perl, for percent-decoding

Install

git clone https://github.com/jacobcheatley/copy-uri
cd copy-uri
./install.sh

This installs copy-uri to ~/.local/bin and registers it as the default handler for the copy: scheme.

Test

xdg-open 'copy:hello%20world'

The clipboard should now contain hello world.

Uninstall

Remove ~/.local/bin/copy-uri and ~/.local/share/applications/copy-uri.desktop. There is no need to reset xdg-mime's default handler back to anything; deleting the desktop entry is enough.

Use with standup-cli

standup-cli emits copy: links under reminder notes, so clicking one on a resumed task copies its resume command to the clipboard. This only works in a terminal that opens OSC 8 hyperlinks through xdg-open.

License

MIT, see LICENSE.

About

xdg handler for copy: URIs: click a terminal link, get the text on your clipboard

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages