Use awful.layout.layouts for implementing optional parameters

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-03-28 13:29:16 +01:00
parent bfc6065ad9
commit 3cbdc2a79f
2 changed files with 9 additions and 8 deletions

View File

@ -168,10 +168,10 @@ for s = 1, screen.count() do
-- We need one layoutbox per screen. -- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s) mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join( mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(awful.layout.layouts, 1) end), awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(awful.layout.layouts, -1) end), awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc(awful.layout.layouts, 1) end), awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(awful.layout.layouts, -1) end))) awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget -- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
@ -254,8 +254,8 @@ globalkeys = awful.util.table.join(
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(awful.layout.layouts, 1) end), awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(awful.layout.layouts, -1) end), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end),
awful.key({ modkey, "Control" }, "n", awful.client.restore), awful.key({ modkey, "Control" }, "n", awful.client.restore),

View File

@ -51,11 +51,12 @@ function layout.get(screen)
end end
--- Change the layout of the current tag. --- Change the layout of the current tag.
-- @param layouts A table of layouts.
-- @param i Relative index. -- @param i Relative index.
-- @param s The screen number. -- @param s The screen number.
function layout.inc(layouts, i, s) -- @param layouts A table of layouts. (optional)
function layout.inc(i, s, layouts)
local t = tag.selected(s) local t = tag.selected(s)
local layouts = layouts or layout.layouts
if t then if t then
local curlayout = layout.get(s) local curlayout = layout.get(s)
local curindex local curindex