Talk:Luakit
Web pages snapshot with LuaKit
Hi, I would like to use LuaKit and ImageMagick (import) behind Xfvb to take snapshots of urls: start xfvb, start LuaKit on the new display and set the window size, get the first url, load the page, call import to take the first snapshot and save it, get the next url, load the page, etc...
Is there an advanced user of Lua and LuaKit to put me on the track?
Some idea
Hi, you can probably find it useful starting luakit with a lua file either directly or as an extension ever. Yet no idea how do we make it happen any elegant, while you still can post to
Luakit Bugtracker
Can be found in these projects:
http://github.com/luakit/luakit/ (Luakit: updated for WebKit2 + GTK 3)
http://github.com/luakit/luakit-plugins/ (Plugins for Luakit)
http://github.com/luakit-crowd/luakit/ (Luakit in the crowd, to bake fixes and make pull requests no-rotten) (Outdated luakit)
First try
I used unsuccessfully these two rc files:
-- uris to snapshot uris = { "https://www.archlinux.org/", "https://wiki.archlinux.org/index.php/Luakit" } -- minimal rc from /etc/xdg/luakit/rc.lua require "lfs" require "lousy" function warn(...) io.stderr:write(string.format(...) .. "\n") end function info(...) if luakit.verbose then io.stdout:write(string.format(...) .. "\n") end end require "globals" lousy.theme.init(lousy.util.find_config("theme.lua")) theme = assert(lousy.theme.get(), "failed to load theme") require "window" require "webview" require "modes" -- my lua extension if #uris then window.new({""}) local w = lousy.util.table.values(window.bywidget)[1] w.win.fullscreen = true for _, uri in ipairs(uris) do w.view.uri = uri uri = string.gsub(uri, "/", "_") os.execute("import -window root "..uri..".png") end end
Snapshots are made but before the LuaKit window is opened... I tried to introduce a sleep but the LuaKit window is never opened...
.. for _, uri in ipairs(uris) do w.view.uri = uri while w.view:loading() do os.execute("sleep 1s") end uri = string.gsub(uri, "/", "_") os.execute("import -window root "..uri..".png") end ..
Need a proper delay
As far as I get, you may require to wait until luakit comes to idle state after it went to the URIs you passed. This can be achieved using luakit.idle_add( callback ). Also, if making snapshots of sites with tools like CutyCapt is not elegant enough (as seen on Wiki: https://github.com/mason-larobina/luakit/wiki/Opera-Speed-Dial-like-chrome), I could try to help you how ever I can.
Plaque FCC (talk) 07:10, 13 May 2013 (UTC)