Hi everyone,
I already send a mail here about my copy/paste that doesn't work between Chromium and Pharo3/4. Since I use more and more Pharo and I don't want to move from Chromium, I tried to find a solution to my problem and so I did. Ok, I must admit, it's brutal but I managed to get the content from the clipboard (after copying something from chromium) using 'xclip -o' with PipeableOSProcess help. So I looked at Clipboard>>clipboardText | string decodedString | string := self primitiveClipboardText. (string isEmpty or: [string = contents asString]) ifTrue: [^ contents]. decodedString := string convertFromWithConverter: UTF8TextConverter new. decodedString := decodedString replaceAll: 10 asCharacter with: 13 asCharacter. ^ decodedString = contents asString ifTrue: [contents] ifFalse: [decodedString asText]. and overrided it in UnixClipboard>>clipboardText as follow: UnixClipboard>>clipboardText | string decodedString | string := (PipeableOSProcess command: '/usr/bin/xclip -o') output. decodedString := string convertFromWithConverter: UTF8TextConverter new. decodedString := decodedString replaceAll: 10 asCharacter with: 13 asCharacter. ^ decodedString = contents asString ifTrue: [contents] ifFalse: [decodedString asText]. This trick works pretty well for me even if I'm sure it's not the best way to do it. I saw that it's possible to get the content of x11 clipboard in C using x11 libs but I think it would be a waste of time to implement it and then call C code from Pharo since I think the way I did it is fast enough. So that's why I choose this quick solution. Anyway, I send this mail to inform that I made with this called XClipboard, simply load it with: Gofer new url: 'http://smalltalkhub.com/mc/JulienDelplanque/XClipboard/main'; package: #ConfigurationOfXClipboard; load. ConfigurationOfXClipboard loadDevelopment. if you want to look at it. What do you think about it? Is there a better way to do that easily? Does anyone see a problem with this "quick fix"? As I said for me it works well for the moment but I can't be certain it will in any case. Thanks in advance, Julien |
Hi,
this is brutal indeed; have you tried the previously mentioned workaround with setting the encoding: http://forum.world.st/Pharo-and-X11-primary-selection-aka-middle-mouse-button-paste-tp4800635p4800679.html Interestingly enough I posted an answer to the original (your) thread but somehow it created a new one instead. http://forum.world.st/Re-Copy-past-doesn-t-work-sometimes-in-Chrome-semifixed-td4784604.html I saw that it's possible to get the content of x11 clipboard in C using That's what the VM does inside (there's a link to the VM code in the first link above). Peter |
Ho thanks for pointing me this solution it works well. I will use it
because I don't like the fact I had to touch to the System for my solution. You're saving me from a lot of Chromium->Sublime Text, Sublime Text->Pharo :) Thank you once again! Julien On 24/03/15 21:30, Peter Uhnák wrote: > Hi, > > this is brutal indeed; have you tried the previously mentioned workaround > with setting the encoding: > http://forum.world.st/Pharo-and-X11-primary-selection-aka-middle-mouse-button-paste-tp4800635p4800679.html > > Interestingly enough I posted an answer to the original (your) thread but > somehow it created a new one instead. > http://forum.world.st/Re-Copy-past-doesn-t-work-sometimes-in-Chrome-semifixed-td4784604.html > > I saw that it's possible to get the content of x11 clipboard in C using >> x11 libs > That's what the VM does inside (there's a link to the VM code in the first > link above). > > Peter > |
I know how frustrating this can be (frustrating enough that I found the courage to dive into VM :)).
Also in case you want to use pharo launcher you need to set it there too (since Launcher launches a new process). In PhLImage>>launch: change last line to ^OSProcess command: vmCommand , ' --textenc UTF-8 "' , imagePath, '"'. Peter On Wed, Mar 25, 2015 at 7:16 AM, Julien Delplanque <[hidden email]> wrote: Ho thanks for pointing me this solution it works well. I will use it |
Free forum by Nabble | Edit this page |