fmoralesc / pastie

a simple *nix clipboard manager with application-indicator support
45 stars 7 forks source link

please add middle click copy from X #9

Closed legluondunet closed 13 years ago

legluondunet commented 14 years ago

Hello,

after testing your app I find it doesn't use the middle click copy from X, could you add this feature please. In parcellite you could enable/disablead this functionnality in the configuration.

Regards.

LGDN.

fmoralesc commented 14 years ago

I'll think about how this can be done. BTW, Why do you think this is necessary? (I ask only because I never used it when I was a parcellite user, so I don't know what it's good for) Do you think the selection contents should be kept on sync with the clipboard contents, or separate?

legluondunet commented 14 years ago

In fact, I think it's fast to select a line then middle click of the mouse to copy text and I could paste it with another middle click whereever I want.It's specific to Linux. I think the selection content should be kept in the history.

fmoralesc commented 14 years ago

OK. Do you think the "Control-C"-style clipboard contents should be accessible for the middle button click paste too? (I mean: you copy something with Control-C and then use the middle button to paste it somewhere; and if the selection gets overwritten, it should still appear in the history menu).

legluondunet commented 14 years ago

yes, good like this.

fmoralesc commented 13 years ago

As an update, I'm working on this. It has taken me this long because I had to restructure the code due to the memory leak bug first.

fmoralesc commented 13 years ago

I've implemented this in the "primary" branch (/http://github.com/fmoralesc/pastie/tree/primary). You can enable the primary selection via the preferences dialog. Please test and comment.

legluondunet commented 13 years ago

Could you tell me how to test primary branch? I test pastie from PPA or GIT? What is the command line to download it from git?

Thanks.

fmoralesc commented 13 years ago

You con download a tarball from http://github.com/fmoralesc/pastie/tarball/primary

You should then run pastie from the folder you extracted the tarball into (you might need to give execution permission to the "pastie" file).

fmoralesc commented 13 years ago

Using git: git clone git@github.com:fmoralesc/pastie.git cd pastie git checkout -b primary origin/primary And then run pastie from there.

fmoralesc commented 13 years ago

So... any comments on this? How has testing gone?

legluondunet commented 13 years ago

I use it for one week and something is very annoying: the x copy are multiple and finally historic becomes useless... Look at this screenshot, more than words: http://img834.imageshack.us/img834/5366/copieecran0508201008180.jpg

fmoralesc commented 13 years ago

I see. What program are you copying text from? How fast are you selecting the text? Pastie has two ways of getting the selection text. One is via the internal events system, and in that case the problem you're having shouldn't occur. On some programs (gvim), pastie tries to grab the selection text every second.

legluondunet commented 13 years ago

"What program are you copying text from? " --> whatever the program (firefox, gedit etc...) "How fast are you selecting the text? " --> normally. Just select the text put it in the historic, not only the middle click.

LGDN

fmoralesc commented 13 years ago

I see. Regarding the second, well, that's kinda the idea. The primary clipboard in linux (X) is simply the selected text. Now, programs can signal the selection has been completed, but this isn't handled the same for all applications. Pastie has no other way to detect the selection is complete but to depend on the programs signals (and in the case of vim, check if the clipboard changed every second - it simply doesn't signal the selection change at all after the first time). I have just checked, and it seems firefox works fine, but gedit doesn't. It seems to signal the selection is complete every some x ms.

legluondunet commented 13 years ago

I understand there are two different copy text in X: text selection every ms and middle click on a selected text. This is about this last functionnality it could be interesting to add to pastie, because it is faster to copy/paste text with a mouse middle click. Could you only retain middle click selection in pastie historic?

LGDN.

fmoralesc commented 13 years ago

Hm... As far as I know, middle click is usually set to paste the primary selection in X systems, not to copy. So if you select some text, and then click the middle button in the mouse, the selection will get pasted. If this behavior is different in some app you use, please tell me; it might be that there's some special condition pastie needs to be aware of (the app can be setting the clipboard contents on middle button click without setting the needed timestamp-this is essentialy vim's problem). I can't make pastie override the normal behavior; that's something the source apps must deal with.

legluondunet commented 13 years ago

in gnome terminal, firefox or google chrome and others apps, I could select a text, then mouse middle click on it to copy it. Another mouse middle click will paste the text, whatever the apps.

LGDN

fmoralesc commented 13 years ago

I've reimplemented the primary selection checking. The problems with repeated entries should be fixed now. The new code is integrated into the testing branch. The primary branch is now deleted.

legluondunet commented 13 years ago

Could you tell me how obtain the testing branch? Thanks.

fmoralesc commented 13 years ago

You can obtain a tarball from http://github.com/fmoralesc/pastie/tarball/testing

fmoralesc commented 13 years ago

You might need to set manually the initial settings for GConf, though:

gconftool-2 --type bool --set /apps/pastie/prefs/use_primary true
gconftool-2 --type bool --set /apps/pastie/prefs/synch_primary true
fmoralesc commented 13 years ago

I've released the code in 0.6.7 through the PPA. Will keep this open in case there's problems.

legluondunet commented 13 years ago

I just installed the ppa version, when I click on "use primary selection", I have an error segmentation. I reboot, same thing...

when I launch pastie from a terminal:

$pastie

\ (pastie:4796): WARNING **: Binding 'C' failed!

\ (pastie:4796): WARNING **: Binding 'P' failed!

Erreur de segmentation

If I could help you for debug, let me know how.

LGDN

fmoralesc commented 13 years ago

Hm... this is interesting. It seems the binding schemas are misformatted (my bad). Where it says "Binding 'C' failed!", it should say "Binding 'C' failed!" Can you check if by changing the gconf entries by hand it works? You might need gconf-editor (https://help.ubuntu.com/community/GConfEditor). You must set the values /apps/pastie/prefs/sel_dialog_key and /apps/pastie/prefs/pref_dialog_key to C and P. Then restart pastie. Tell me if that prevents the segmentation fault.

legluondunet commented 13 years ago

This is what I have in gconf-editor:

http://img830.imageshack.us/img830/5893/tmpdpw8l.png

Is it correct ?

fmoralesc commented 13 years ago

Yes, it is. (I was mistaken, anyway, it seems that github removed anything between < and >, so it seemed that the keys weren't set.)

legluondunet commented 13 years ago

the error segmentation only happened when I clik on the "use primary selection" option.

fmoralesc commented 13 years ago

I see. I'll try to reproduce the bug.

legluondunet commented 13 years ago

Hello pastie boy, the primary selection works good and with the new version I have no more crash, you could close this issue. Thank you!

LGDN