* Tuomo Valkonen <[EMAIL PROTECTED]> [060601 13:07]:
> On 2006-05-31, Bart Trojanowski <[EMAIL PROTECTED]> wrote:
> > I would like to act on the current X copy buffer selection text from a
> > keyboard binding.  What's the easiest way to do this from lua?
> 
> ioncore.request_selection.

Thanks.

        Synopsis:
            void ioncore.request_selection(function fn) 

        Description:
            Request (string) selection. The function fn will be called 
        with the selection when and if it is received.

So let me take a stab at it...

        function my_url_handler (ws)
                ioncore.request_selection(
                        function (str)  
                                if (string.find(str, "http://";) ~= nil) then
                                        ioncore.exec_on (ws, "firefox -new-tab 
" 
                                                .. string.shell_safe(str))
                                end
                        end)
        end

        defbindings("WScreen", { 
                kpress("Mod4+U", "my_url_handler(_)"),
        })

Thanks again.

-Bart

-- 
                                WebSig: http://www.jukie.net/~bart/sig/

Attachment: signature.asc
Description: Digital signature

Reply via email to