Ubuntu – How to make work Indicator-Chars app

clipboardindicatorpython

I downloaded Indicator-Char and unzipped the files. I added the characters there I wanted perfectly. When I run the python script it loads the daemon and I can see this characters. But the problem is that when I click on them, the app doesn't copy anything to the clipboard.

The following code belongs to the copy function of the program:

def on_char_click(self, widget, char):
    cb = gtk.Clipboard(selection="PRIMARY")
    cb.set_text(char)

Is a syntax problem? There is a problem on my system?

Best Answer

From http://standards.freedesktop.org/clipboards-spec/clipboards-latest.txt:

  • explicit cut/copy commands should always set both CLIPBOARD and PRIMARY, even when copying doesn't involve a selection (e.g. a "copy url" -option which explicitly copies an url without the url being selected first)

Copy char command could look like this:

cb = gtk.Clipboard(selection="PRIMARY")
cb.set_text(char)
cb = gtk.Clipboard(selection="CLIPBOARD")
cb.set_text(char)

From the same link:

Apps that follow these guidelines give users a simple mental model to understand what's going on. PRIMARY is the current selection. Middle button pastes the current selection. CLIPBOARD is just like on Mac/Windows. You don't have to know about PRIMARY if you're a newbie.

Related Question