diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 9cf87c12..9d492757 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -68,9 +68,13 @@ mytextbox:set("text", "awesome " .. AWESOME_VERSION .. "") 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 diff --git a/awful.lua b/awful.lua index 31b1a063..5d66c3a3 100644 --- a/awful.lua +++ b/awful.lua @@ -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 diff --git a/layout.c b/layout.c index a3a8a038..e52f159e 100644 --- a/layout.c +++ b/layout.c @@ -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