Commit 9b37637a authored by Glen Mével's avatar Glen Mével

`clipboards`: view the contents of the X clipboards

parent da056a91
#!/usr/bin/python2
# Display the contents of the X clipboard.
# http://stackoverflow.com/questions/3261379/getting-html-source-or-rich-text-from-the-x-clipboard
import gtk
clipboard = gtk.Clipboard()
targets = clipboard.wait_for_targets()
if not targets:
print "\x1B[1;34mNo target available\x1B[0m"
exit()
print "\x1B[1;34mTargets available:", ", ".join(map(str, targets)), "\x1B[0m"
for target in targets:
print "\x1B[1;33mTarget %s:\x1B[0m" % str(target)
contents = clipboard.wait_for_contents(target)
if contents:
print contents.data
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment