3 -- Widget construction aliases
4 function eventbox() return widget
{type="eventbox"} end
5 function hbox() return widget
{type="hbox"} end
6 function label() return widget
{type="label"} end
7 function notebook() return widget
{type="notebook"} end
8 function vbox() return widget
{type="vbox"} end
9 function webview() return widget
{type="webview"} end
10 function window() return widget
{type="window"} end
12 function widget_setup(w
)
13 print("new widget", w
.type)
14 if w
.type == "window" then
15 -- Call the quit function if this was the last window left
16 w
:add_signal("destroy", function ()
17 if #luakit
.windows
== 0 then luakit
.quit() end
22 widget
.add_signal("new", function(w
)
23 w
:add_signal("init", function(w
)
28 -- Create main widgets
33 -- Create tabbed notebook to store webviews
35 layout
:pack_start(tabs
, true, true, 0)
37 -- Create "status bar"
41 left
:set_alignment(0.0, 0.0)
45 right
:set_alignment(1.0, 0.0)
48 sbar_layout
:pack_start(left
, true, true, 2)
49 sbar_layout
:pack_start(right
, false, false, 2)
51 statusbar
= eventbox()
52 statusbar
:set_child(sbar_layout
)
54 layout
:pack_start(statusbar
, false, false, 0)
57 uris
= { "http://github.com/mason-larobina/luakit" }
60 for _
, uri
in ipairs(uris
) do
64 view
:add_signal("property::title", function (v
)
65 local title
= v
:get_prop("title")
66 tabs
:set_title(v
, title
)
69 right
.text
= v
:get_prop("uri")
72 view
:add_signal("link-hover", function(v
, link
)
76 view
:add_signal("link-unhover", function(v
, link
)