[layout] Pass screen number on arrange; fix layoutbox

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-26 16:07:35 +02:00
parent be44700669
commit a5c00cca24
3 changed files with 19 additions and 14 deletions

View File

@ -68,9 +68,13 @@ mytextbox:set("text", "<i><small>awesome " .. AWESOME_VERSION .. "</small></i>")
myiconbox = widget.new({ type = "iconbox", name = "myiconbox", align = "right" })
myiconbox:set("image", "@iconsdir@/awesome16.png")
-- Create an iconbox widget which will contains an icon indicating which layout we're using
mylayoutbox = widget.new({ type = "iconbox", name = "myiconbox", align = "right" })
mylayoutbox:set("image", "@iconsdir@/layouts/tile.png")
-- Create an iconbox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox = {}
for s = 1, awesome.screen_count() do
mylayoutbox[s] = widget.new({ type = "iconbox", name = "myiconbox", align = "right" })
mylayoutbox[s]:set("image", "@iconsdir@/layouts/tile.png")
end
-- Create a statusbar for each screen and add it
for s = 1, awesome.screen_count() do
@ -80,7 +84,7 @@ for s = 1, awesome.screen_count() do
mystatusbar:widget_add(mytaglist)
mystatusbar:widget_add(mytasklist)
mystatusbar:widget_add(mytextbox)
mystatusbar:widget_add(mylayoutbox)
mystatusbar:widget_add(mylayoutbox[s])
mystatusbar:add(s)
end
-- }}}
@ -197,9 +201,9 @@ end
-- Hook function to execute when arranging the screen
-- (tag switch, new client, etc)
function hook_arrange()
local layout = awful.layout.get()
mylayoutbox:set("image", "@iconsdir@/layouts/" .. layout .. "w.png")
function hook_arrange(screen)
local layout = awful.layout.get(screen)
mylayoutbox[screen]:set("image", "@iconsdir@/layouts/" .. layout .. "w.png")
end
-- Set up some hooks

View File

@ -91,9 +91,9 @@ function screen_focus(i)
end
-- Return a table with all visible tags
function tag_selectedlist()
function tag_selectedlist(s)
local idx = 1
local screen = mouse.screen_get()
local screen = s or mouse.screen_get()
local tags = tag.get(screen)
local vtags = {}
for i, t in ipairs(tags) do
@ -107,8 +107,8 @@ end
-- Return only the first element of all visible tags,
-- so that's the first visible tags.
function tag_selected()
return tag_selectedlist()[1]
function tag_selected(s)
return tag_selectedlist(s)[1]
end
-- Set master width factor
@ -223,8 +223,8 @@ function client_togglefloating(c)
end
end
function layout_get()
local t = tag_selected()
function layout_get(screen)
local t = tag_selected(screen)
if t then
return t:layout_get()
end

View File

@ -94,7 +94,8 @@ arrange(int screen)
globalconf.screens[screen].need_arrange = false;
/* call hook */
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 0);
lua_pushnumber(globalconf.L, screen + 1);
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1);
}
/** Refresh the screen disposition