Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.