You are not logged in.

#26 2010-08-19 02:03:33

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: luakit browser framework (almost with jQuery!)

I don't know if anybody else is having this problem, but I can't seem to control flash objects with my keyboard when I should; e.g. a flash game like http://tetrisfriends.com

Offline

#27 2010-08-19 02:20:40

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

Berticus wrote:

I don't know if anybody else is having this problem, but I can't seem to control flash objects with my keyboard when I should; e.g. a flash game like http://tetrisfriends.com

I think you will find this is because you are not in insert mode. The binding is "i" in the default rc.lua.

When you are not in insert mode all keys are caught by the window and not sent to the webview. It would be nice to be able to detect when you click on flash instances and I think that may be possible by checking for other hit test results in this function:

http://github.com/mason-larobina/luakit … iew.c#L888

But I'm not sure what result you should check for when clicking on flash objects.

Regards,

Mason.

Offline

#28 2010-08-19 02:27:42

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: luakit browser framework (almost with jQuery!)

oh, I was just about to report that I got around the problem going into follow mode, and just clicking on the flash object.

Offline

#29 2010-08-19 20:42:30

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: luakit browser framework (almost with jQuery!)

where's rc.lua supposed to go? I tried to echo $XDG_DATA_DIR, but it doesn't exist. My guess would be ~/.config/luakit?

Offline

#30 2010-08-19 22:57:41

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: luakit browser framework (almost with jQuery!)

you can create the variable in your shell file: export XDG_DATA_DIR="directory", but yeah, it's usually ~/.config/luakit/rc.lua. AFAIK. great project, by the way. :} thanks for this

Offline

#31 2010-08-19 23:59:50

jwbirdsong
Member
From: Western KS USA
Registered: 2006-11-25
Posts: 173

Re: luakit browser framework (almost with jQuery!)

Berticus;
if you used the AUR pkg, the install file/pacman tells you where to copy  rc.lua to/from.


PLEASE read and try to FIX/FILE BUGS instead of assuming other have/will.

Offline

#32 2010-08-21 05:48:33

jwbirdsong
Member
From: Western KS USA
Registered: 2006-11-25
Posts: 173

Re: luakit browser framework (almost with jQuery!)

Added a "Stable" (read non git) pkg AND a pkg from the develop branch.

Stable
develop

Also update MY 1st post to reflect this.


PLEASE read and try to FIX/FILE BUGS instead of assuming other have/will.

Offline

#33 2010-08-23 21:07:07

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Could you implement the possibility to open links via hints in a new tab? I like the way jumanji does it, there you press a capital F for this action.

Offline

#34 2010-08-23 23:46:17

jwbirdsong
Member
From: Western KS USA
Registered: 2006-11-25
Posts: 173

Re: luakit browser framework (almost with jQuery!)


PLEASE read and try to FIX/FILE BUGS instead of assuming other have/will.

Offline

#35 2010-08-24 06:56:03

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Oh thanks, I should have looked there. Pardon me

Offline

#36 2010-08-25 06:11:53

jwbirdsong
Member
From: Western KS USA
Registered: 2006-11-25
Posts: 173

Re: luakit browser framework (almost with jQuery!)

Split (lib-ized?) configs now available in the develop branch.
More info HERE


PLEASE read and try to FIX/FILE BUGS instead of assuming other have/will.

Offline

#37 2010-08-31 04:46:27

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

New luakit release: 2010.08.30

Summary of changes from 2010.08.13 to 2010.08.30:

1. Removed libxdg-basedir dependency, using glibs
`g_get_user_{config,data,cache}_dir()` functions instead.
2. Add `DEVELOPMENT_PATHS` flag to toggle the adding of relative locations to
the lua `package.path`.
3. Set default download dir to $XDG_DOWNLOAD_DIR or $HOME/downloads
4. Change into insert mode when clicking on an input element.
5. Remove callbacks on deprecated webview signals (E.g.
"load-property-update", "load-status", "load-finished" & etc).
6. Use hash table lookup for webview widget properties.
7. Add webview widget `:reload()` method.
8. Renamed `luakit.selection()` to `luakit.get_selection(..)` and added new
`luakit.set_selection(..)`.
9. Add button release signals.
10. Add mouse bindings with `lousy.bind.but({mods}, num, func)`.
11. Add `luakit.get_special_dir(atom)` wrapper around glibs
`g_get_user_special_dir(atom)`.
12. Use gobject "signal::notify" signal for "property::name" signals.
13. Enable middle-click closing of tabs.
14. Add `luakit.spawn(cmd)` and `luakit.spawn_sync(cmd)` functions.
15. Add scroll page function and vi-like page scrolling bindings.
16. Add webkit webview `:get_view_source()` & `:set_view_source(..)` methods.
17. Add formfiller.lua (ported from uzbl grodzik!). This version supports
multiple-profiles and autosubmitting forms.
18. Add per-domain webview properties which are modified in globals.lua.
19. Add `luakit.webkit_{major,minor,micro}_version` properties.
20. Custom luakit useragent.
21. Handle webkit "create-web-view" signal which fixes "Open in new window"
context menu item.
22. Make heavy use of `luaL_argerror` in widget functions.
23. Add zooming functions & binds.
24. Add "O" and "T" binds which do the exact same as "o" & "t" but provide the
current uri as the uri argument.
25. Use portable sigaction instead of signal & add "-std=gnu99" to the
Makefile.
26. Add bookmarks lib which is able to generate html output.
27. Build api docs with the `make apidoc` make target using the `luadoc`
program.
28. Split the large rc.lua into several smaller files: webview.lua,
window.lua, binds.lua, globals.lua, modes.lua, theme.lua & rc.lua.
29. Created luakit vim syntax which highlights javascript between "[=[" &
"]=]" regions, html between "[==[" & "]==]" regions and css between "[===[" &
"]===]" regions.
30. Add window closing function & binds.
31. Add "resource-request-started" callback and lua signal for webview
widgets.
32. Add "populate-popup" signal which can build a context menu from a returned
table.
33. Add & install `extras/luakit.desktop` file and icon `extras/luakit.png`.
34. Add several more common widget box/container methods.
35. Add per-domain cookie acceptance policies.
36. Use help2man to build manpage for luakit.
37. Make `--help` and `--version` work without X.
38. Make all uris which point to relative paths absolute paths (allows loading
of local resources like images).
39. Track current uri manually so that on error "T" & "O" binds allow you to
edit the failed uri.
40. Add ssl trusted widget which reads "(trust)" on valid website certificate,
"(notrust)" on invalid certificate & "(nocheck)" if no ca-file was used to
check the connection.
41. Add simple key name mapping table (mainly for "ISO_Left_Tab" -> "Tab").
42. All mode actions, webview signal handlers, window signal handlers, webview
methods and window methods can be replaced with custom functions without
editing `window.lua`, `webview.lua` or `mode.lua`. Simply make some changes in
a `mine.lua` and add `require "mine"` to your `rc.lua`.
43. Add gtk label `:set_width(chars)` widget method which is used to make all
tablabels the same width.
44. Several bug fixes.

http://luakit.org/news/2

Download link:

http://download.github.com/mason-larobi … 6b3.tar.gz

Offline

#38 2010-08-31 05:40:21

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

Here is a new screenshot showing off the the ssl indicator in the statusbar which displays "(trust)" or "(notrust)" depending on the certificate given by a website or "(nocheck)" if not checking ssl certificate validity.

luakit.ssl.png

Offline

#39 2010-08-31 06:21:28

jwbirdsong
Member
From: Western KS USA
Registered: 2006-11-25
Posts: 173

Re: luakit browser framework (almost with jQuery!)

mason.larobina wrote:

New luakit release: 2010.08.30

<snip> </snip>

http://luakit.org/news/2

Download link:

http://download.github.com/mason-larobi … 6b3.tar.gz

AUR pkg update to latest
http://aur.archlinux.org/packages.php?ID=40085


PLEASE read and try to FIX/FILE BUGS instead of assuming other have/will.

Offline

#40 2010-08-31 08:24:48

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: luakit browser framework (almost with jQuery!)

Can we reload the config w/o restarting luakit?
In firefox I can enter addresses and perform searches both from the location bar; could we get the same funcationality in luakit? eg type `og luakit` to do a google search for luakit or `oluakit.org` to go directly to the website.
I also made an issue about html5 localstorage.

Offline

#41 2010-08-31 10:22:02

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

aeosynth wrote:

Can we reload the config w/o restarting luakit?

This will be possible by the next release.

aeosynth wrote:

In firefox I can enter addresses and perform searches both from the location bar; could we get the same funcationality in luakit?  eg type `og luakit` to do a google search for luakit or `oluakit.org` to go directly to the website.

This modification will allow that, you just need to do the same to the other opening commands.

diff --git a/config/binds.lua b/config/binds.lua
index e6cf32b..5f14241 100644
--- a/config/binds.lua
+++ b/config/binds.lua
@@ -139,7 +139,13 @@ binds.mode_binds = {
 -- entered into the input bar.
 binds.commands = {
  -- cmd({Command, Alias1, ...},         function (w, arg, opts) .. end, opts),
-    cmd({"open",        "o"  },         function (w, a)    w:navigate(a) end),
+    cmd({"open",        "o"  },         function (w, a)
+                                            if string.match(a, "%.") then
+                                                w:navigate(a)
+                                            else
+                                                w:websearch("google " .. a)
+                                            end
+                                        end),
     cmd({"tabopen",     "t"  },         function (w, a)    w:new_tab(a) end),
     cmd({"winopen",     "w"  },         function (w, a)    window.new{a} end),
     cmd({"back"              },         function (w, a)    w:back(tonumber(a) or 1) end),
aeosynth wrote:

I also made an issue about html5 localstorage.

Have you tried turning the html5 properties on?

http://github.com/mason-larobina/luakit … view.c#L92

diff --git a/config/rc.lua b/config/rc.lua
index c916af7..27a71e5 100644
--- a/config/rc.lua
+++ b/config/rc.lua
@@ -26,6 +26,11 @@ require "modes"
 -- ("$XDG_CONFIG_HOME/luakit/webview.lua" or "/etc/xdg/luakit/webview.lua")
 require "webview"
 
+webview.init_funcs.html5_on = function (view)
+    view:set_prop("enable-html5-database", true)
+    view:set_prop("enable-html5-local-storage", true)
+end
+
 -- Load users keybindings
 -- ("$XDG_CONFIG_HOME/luakit/binds.lua" or "/etc/xdg/luakit/binds.lua")
 require "binds"

Last edited by mason.larobina (2010-09-01 18:41:21)

Offline

#42 2010-08-31 20:02:15

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: luakit browser framework (almost with jQuery!)

mason.larobina wrote:
aeosynth wrote:

In firefox I can enter addresses and perform searches both from the location bar; could we get the same funcationality in luakit?  eg type `og luakit` to do a google search for luakit or `oluakit.org` to go directly to the website.

This modification will allow that, you just need to do the same to the other opening commands.

That easy huh?

    cmd({"open",        "o"  },         function (w, a)
                                            keyword, arg = string.match(a, '^([gw]) (.+)')
                                            if keyword == 'g' then
                                                w:websearch("google " .. arg)
                                            elseif keyword == 'w' then
                                                w:websearch("wikipedia " .. arg)
                                            elseif string.match(a, '%.') then
                                                w:navigate(a)
                                            else
                                                w:websearch("google " .. a)
                                            end
                                        end),
mason.larobina wrote:

Have you tried turning the html5 properties on?

I'm using luakit-git, I added those lines to my rc.lua, localstorage still doesn't persist across browser restarts, only page refreshes. The rc.lua function doesn't seem to do anything either way.

Last edited by aeosynth (2010-08-31 20:03:43)

Offline

#43 2010-09-01 16:40:48

quigybo
Member
Registered: 2009-01-15
Posts: 220

Re: luakit browser framework (almost with jQuery!)

If you are looking to use the open command for everything, then something like this may be better suited.

if string.match(a, " ") then
    if (function (s, l)  -- tests if first word is a search engine
            for i in pairs(l) do
                if s == i then return true end
            end
            return false
        end) (string.match(a, "%w+"), search_engines)
    then
        w:websearch(a)
    else
        w:websearch("google " .. a)
    end
elseif string.match(a, "%.") then
    w:navigate(a)
else
    w:websearch("google " .. a)
end

edit: cleaned the code a bit, thanks aeosynth

It first checks if there is a space in the address, if yes it checks the list of search engines you have defined, failing that does a google search. If it is a single term, then it checks for a dot like in Mason's example. BTW "\." was still matching as wildcard for me and not escaping properly, so I used "[.]" instead which seems to work.

It has been a few years since I have worked with lua so please forgive any dodgyness, and feel free to improve it if you want smile.

@aeosynth: instead of defining keywords in your open command, they should be added to the searchengines table in globals.lua:

search_engines = {
...
    g           = "http://google.com/search?sourceid=navclient&gfns=1&q={0}",
    w           = "http://en.wikipedia.org/wiki/Special:Search?search={0}",
...
}

Note that I use google lucky search as default, it is usually pretty reliable - if the first result is a good match it will take you directly to that page, otherwise you will get the search results as usual.

While I am posting here anyway:
    - is there a way to cancel loading a page? I tried C-c and looked through binds.lua but couldn't see anything.
    - can we get text zoom as well as page zoom?

Last edited by quigybo (2010-09-01 18:27:40)

Offline

#44 2010-09-01 17:28:36

Chippeur
Member
Registered: 2010-01-25
Posts: 19

Re: luakit browser framework (almost with jQuery!)

I set a personnal stylesheet in the domain properties, but it's very slow to load, in a previous version it was immediatly loaded.
So I change the domain function in webview.lua to the old one.
I don't know what is the "provisionnal" status, maybe there was a reason to do with this status and not "commited".

    -- Domain properties                                                                                                             
    domain_properties = function (view, w)
        view:add_signal("load-status", function (v, status)
--         if status ~= "provisional" then return end -- SLOW STYLESHEETS LOADING
            if status ~= "committed" then return end -- FAST STYLESHEETS LOADING
            local domain = (v.uri and string.match(v.uri, "^%a+://([^/]*)/?")) or "about:blank"
            if string.match(domain, "^www.") then domain = string.sub(domain, 5) end
            local props = lousy.util.table.join(domain_props.all or {}, domain_props[domain] or {})
            for k, v in pairs(props) do
                info("Domain prop: %s = %s (%s)", k, tostring(v), domain)
                view:set_prop(k, v)
            end
        end)
  end,

Also :
- I don't understand how to add a signal function in mine.lua (I know it's due to a lack of lua knowledge but if accept every clues).
- With the url like this (with target="_blank") 

<a href="http://www.exemple.com/" target="_blank">Exemple</a>

luakit create a new window, is it possible to open the url in a tab ?
- When I close au tab, I have a gtk error

(luakit:3508): Gtk-CRITICAL **: gtk_widget_get_clipboard: assertion `gtk_widget_has_screen (widget)' failed

Last edited by Chippeur (2010-09-01 18:43:50)


Sorry in advance for my poor english...

Offline

#45 2010-09-01 18:02:17

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: luakit browser framework (almost with jQuery!)

Thanks quigybo, I ended up simplifying to just this:

    cmd({"open",        "o"  },         function (w, a)
                                            if string.match(a, ' ') then
                                                w:websearch(a)
                                            elseif string.match(a, '%.') then
                                                w:navigate(a)
                                            else
                                                w:websearch('g ' .. a)
                                            end
                                        end),

Yeah '\.' was still wildcard matching for me too, so I looked at the lua reference and apparently '%' "is the standard way to escape the magic characters."

Offline

#46 2010-09-01 18:21:28

quigybo
Member
Registered: 2009-01-15
Posts: 220

Re: luakit browser framework (almost with jQuery!)

aeosynth wrote:

Thanks quigybo, I ended up simplifying to just this:

    cmd({"open",        "o"  },         function (w, a)
                                            if string.match(a, ' ') then
                                                w:websearch(a)
                                            elseif string.match(a, '%.') then
                                                w:navigate(a)
                                            else
                                                w:websearch('g ' .. a)
                                            end
                                        end),

The only problem with this is that it will fail if you enter the searchterm but don't have that particular searchengine defined, or for example just enter the search term eg. "lua reference manual" (without prepending it with "g "). You just need to be careful I guess, no big deal, each to his own.

aeosynth wrote:

I looked at the lua reference

Read the manual ey?!?! Hehe I may even do that... tongue

Offline

#47 2010-09-01 18:38:50

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

quigybo wrote:

While I am posting here anyway:
    - is there a way to cancel loading a page? I tried C-c and looked through binds.lua but couldn't see anything.
    - can we get text zoom as well as page zoom?

Thanks for the really nice open command quigybo.

And I've just added the long overdue webview widget stop method and bound it to Ctrl+c.[0][1]

As for text zooming check out the "full-content-zoom" webview property here.

Offline

#48 2010-09-01 19:26:53

quigybo
Member
Registered: 2009-01-15
Posts: 220

Re: luakit browser framework (almost with jQuery!)

Dammit, seems it isn't so simple extending this to tabopen as well sad. My plan was to define searchopen as a named function, then use it for both open and tabopen (and winopen), but it isn't that straight forward. From what I can tell two ways of doing it are either to have the w:new_tab method switch the current view to the new tab on creation, or restructure w:websearch to optionally accept a view as its last argument, and then pass that on to w:navigate. What do people think is the best way to go about it? I'm inclined to go with w:new_tab switching the view on tab creation, as I prefer that behaviour. Opinions?

For now I'm doing this, is there a better way?

    cmd({"tabopen",     "t"  },         function (w, a)
                                            w:new_tab()
                                            searchopen(w, a)
                                        end),
--- window.lua.20100831    2010-09-02 04:39:41.000000000 +0930
+++ window.lua    2010-09-02 04:40:32.000000000 +0930
@@ -207,6 +207,7 @@
         local view = webview.new(w, uri)
         w.tabs:append(view)
         w:update_tab_count()
+        w.tabs:switch(w.tabs:count())
         return view
     end,
 

@mason: Thanks, I will check out the new features next time I update.

Offline

#49 2010-09-01 20:18:21

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

Chippeur wrote:

I set a personnal stylesheet in the domain properties, but it's very slow to load, in a previous version it was immediatly loaded.
So I change the domain function in webview.lua to the old one.
I don't know what is the "provisionnal" status, maybe there was a reason to do with this status and not "commited".

snip

Alright thanks, I didn't know style-sheet loading times were being affected by this small change. I've changed it back now.

Chippeur wrote:

- I don't understand how to add a signal function in mine.lua (I know it's due to a lack of lua knowledge but if accept every clues).

`mine.lua` was a place-holder name for a users custom configuration file. All the functions in the window.init_funcs, window.methods, webview.init_funcs and webview.methods can be overridden by name from another file (loaded after the window.lua and webview.lua files).

For example:

-- In $XDG_CONFIG_HOME/luakit/mine.lua

-- Disable returning to the default mode on navigation.
webview.init_funcs.reset_mode_on_nav = nil 

-- Always open new window requests in new tabs
webview.init_funcs.window_decision = function (view, w)
        view:add_signal("new-window-decision", function (v, link, reason)
            info("New window decision: %s (%s)", link, reason)
            w:new_tab(link)
        end)
    end,

Then add `require "mine"` to your rc.lua.

Chippeur wrote:

- With the url like this (with target="_blank") 

<a href="http://www.exemple.com/" target="_blank">Exemple</a>

luakit create a new window, is it possible to open the url in a tab ?

Yes, grep for `window.new({ link })` in config/webview.lua and replace that with `w:new_tab(link)` or copy the example above.

Chippeur wrote:

- When I close au tab, I have a gtk error

(luakit:3508): Gtk-CRITICAL **: gtk_widget_get_clipboard: assertion `gtk_widget_has_screen (widget)' failed

I get the same thing, I haven't looked at the cause yet.

Offline

#50 2010-09-01 20:25:27

mason.larobina
Member
From: Australia
Registered: 2009-07-02
Posts: 194
Website

Re: luakit browser framework (almost with jQuery!)

quigybo wrote:

Dammit, seems it isn't so simple extending this to tabopen as well sad. My plan was to define searchopen as a named function, then use it for both open and tabopen (and winopen), but it isn't that straight forward. From what I can tell two ways of doing it are either to have the w:new_tab method switch the current view to the new tab on creation, or restructure w:websearch to optionally accept a view as its last argument, and then pass that on to w:navigate. What do people think is the best way to go about it? I'm inclined to go with w:new_tab switching the view on tab creation, as I prefer that behaviour. Opinions?

For now I'm doing this, is there a better way?

    cmd({"tabopen",     "t"  },         function (w, a)
                                            w:new_tab()
                                            searchopen(w, a)
                                        end),
--- window.lua.20100831    2010-09-02 04:39:41.000000000 +0930
+++ window.lua    2010-09-02 04:40:32.000000000 +0930
@@ -207,6 +207,7 @@
         local view = webview.new(w, uri)
         w.tabs:append(view)
         w:update_tab_count()
+        w.tabs:switch(w.tabs:count())
         return view
     end,
 

@mason: Thanks, I will check out the new features next time I update.

Why not make searchopen return the uri to load and then do this:

    cmd({"tabopen",     "t"  },         function (w, a) w:new_tab(searchopen(a)) end),

And then modify the other opening commands accordingly.

Offline

Board footer

Powered by FluxBB