From 3cbdc2a79ff7230fe717ec71c0f7442043e93fd1 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 28 Mar 2014 13:29:16 +0100 Subject: [PATCH] Use awful.layout.layouts for implementing optional parameters Signed-off-by: Uli Schlachter --- awesomerc.lua.in | 12 ++++++------ lib/awful/layout/init.lua.in | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 40318028c..0cf3604c2 100755 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -168,10 +168,10 @@ for s = 1, screen.count() do -- We need one layoutbox per screen. mylayoutbox[s] = awful.widget.layoutbox(s) mylayoutbox[s]:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.layout.inc(awful.layout.layouts, 1) end), - awful.button({ }, 3, function () awful.layout.inc(awful.layout.layouts, -1) end), - awful.button({ }, 4, function () awful.layout.inc(awful.layout.layouts, 1) end), - awful.button({ }, 5, 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(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end))) -- Create a taglist widget 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, "Control" }, "h", 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, "Shift" }, "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(-1) end), awful.key({ modkey, "Control" }, "n", awful.client.restore), diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index b087be1a0..eb5af12fa 100755 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -51,11 +51,12 @@ function layout.get(screen) end --- Change the layout of the current tag. --- @param layouts A table of layouts. -- @param i Relative index. -- @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 layouts = layouts or layout.layouts if t then local curlayout = layout.get(s) local curindex