Features of a Tk-based user interface to their system clipboards

Pupose: Describe features that would be useful in a Tk based clipboard application.

LV Currently I have used a non-Tk application called xclipboard, which provides minimalistic clipping features. The main reason I use it is because a) it is the only thing that comes on my system, b) it allows the user to create new pages for text to be glued in.

One of the major misfeatures of the application is that it does not support the feature of deleting selected text.

What features could a Tk based clipboard application provide? At one time, someone on clt had proposed the idea of filters being defined (sort along the idea of Apple's Data Detectors I guess) which based on the kind of data being selected, could take various actions. These would be written in tcl of course.


  1. Import selection into application with minimal effort by the user
  2. Deal with distinguishing when a user wants text imported and when not to do it.
  3. Support import of various kinds of text
  4. Support a varying (hopefully relatively unlimited) size and number of selections.
  5. Support import of objects selected other than text.
  6. Support editing of selected text
  7. Support automatic invocation of specialized filters, with tracing for debugging purposes
  8. Support automatic saving of items imported into the application as well as the ability to load up the clipboard pages.
  9. Perhaps support sharing of such pages - by naming them, and allowing the loading of various named collections of pages
  10. User customization of each page of the clipboard - size, color, font, location on screen, iconification state, etc.
  11. Autosaving of the customization state of each page and using that state
  12. If sharing of pages supported, then some sort of visual indication when a clipboard page changes
  13. Date of page creation and last modification available
  14. Would having the history of a clipboard page be useful?
  15. Full text editing capability in the page - undo/redo, function key bindings, common control keys, customizable bindings

(Bryan Oakley says: I was the one proposing the filters, and yes, they were modeled after Apple's data detectors. I have a clipboard watching application that uses them, though I rarely use it. I think it was posted to comp.lang.tcl a while back. SuperClipboard is also availble for download here: [1 ].)


LES on Oct 12 2003 - Problem: I have a couple of Perl scripts called from a separate quick launch program. I use these scripts as filters. I copy a block of text and launch the script. The script reads the Windows clipboard, parses and changes it and replaces the clipboard with the result of the changes, ready to be pasted over the old stuff. Here is the Perl script:

 use Win32::Clipboard;
 $handle_clipboard = Win32::Clipboard();
 $clipboard_content = $handle_clipboard -> Get();
 $clipboard_content =~ s/replace this/with that/m while ($clipboard_content =~ m/replace this/m);
 $clipboard_content = $handle_clipboard -> Set($clipboard_content);
 exit();

It's very quick and practical. Who needs a GUI for that? But I have found that it is not possible to do the same with Tcl/Tk without at least one text or entry widget so I can actually select the text before copying. The relevant bug-report-slash-feature-request has been submitted at SourceForge.

The problem is also described here: [2 ].

LES on June 11, 2004: the problem I reported above seems to have been fixed: [3 ]. But I don't think it has made it to any binary releases yet. Probably on the next one.


LVwikignoming - 2010-06-28 08:48:29

In the years since I was commenting on this page, we've changed X servers a couple of times. Now that we are using the cygwin xfree server, I had to stop using xclipboard because it interfered with cygwin's facility to coordinate copy and paste between Windows native clients and X clients. This is a facility that Hummingbird also provided with Exceed.

Recently, a developer reported problems consistently copying between Tk x clients and Windows native clients (such as Word, Internet Explorer, notepad, etc.). Two different issues are seen, at least when using Exceed. There's a bug report that has been opened for the issues [4 ]. I have tested the small coherent example using Exceed and cygwin x server and was able to reproduce at least one of the two cases regularly. There appears to be some variation on the problem depending on the specifics of the specific x server, version, etc. I have yet to determine what kind of work around might be needed to get consistent behavior.