From 6b3bdcaed1a8ba4fba8343c5d19b3b73542e0780 Mon Sep 17 00:00:00 2001 From: Luca CPZ Date: Mon, 30 Nov 2020 14:58:27 +0000 Subject: [PATCH] #474: remove remaining 9 warnings --- helpers.lua | 5 ++--- layout/centerwork.lua | 8 ++++---- layout/termfair.lua | 4 ++-- util/quake.lua | 34 +++++++++++++++++----------------- util/separators.lua | 8 ++++---- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/helpers.lua b/helpers.lua index 1829b7b..45f090f 100644 --- a/helpers.lua +++ b/helpers.lua @@ -25,9 +25,8 @@ helpers.scripts_dir = helpers.lain_dir .. 'scripts/' -- {{{ Modules loader -function helpers.wrequire(table, key) - local module = rawget(table, key) - return module or require(table._NAME .. '.' .. key) +function helpers.wrequire(t, k) + return rawget(t, k) or require(t._NAME .. '.' .. k) end -- }}} diff --git a/layout/centerwork.lua b/layout/centerwork.lua index 81ac8f3..142ccbe 100644 --- a/layout/centerwork.lua +++ b/layout/centerwork.lua @@ -24,7 +24,7 @@ local function arrange(p, layout) if #cls == 0 then return end - local c, g = cls[1], {} + local g = {} -- Main column, fixed width and height local mwfact = t.master_width_factor @@ -64,12 +64,12 @@ local function arrange(p, layout) g.width = max(g.width, 1) g.height = max(g.height, 1) - p.geometries[c] = g + p.geometries[cls[1]] = g -- Auxiliary clients if #cls <= 1 then return end for i = 2, #cls do - local c, g = cls[i], {} + g = {} local idxChecker, dimToAssign local rowIndex = floor(i/2) @@ -121,7 +121,7 @@ local function arrange(p, layout) g.width = max(g.width, 1) g.height = max(g.height, 1) - p.geometries[c] = g + p.geometries[cls[i]] = g end end diff --git a/layout/termfair.lua b/layout/termfair.lua index eede3ba..cf018ef 100644 --- a/layout/termfair.lua +++ b/layout/termfair.lua @@ -241,7 +241,7 @@ local function do_fair(p, orientation) local height = math.floor(wa.height / num_y[i]) local wy = wa.y for _ = 0, (num_y[i]-2) do - local g = {} + g = {} g.x = wx g.y = wy g.height = height @@ -252,7 +252,7 @@ local function do_fair(p, orientation) nclient = nclient + 1 wy = wy + height end - local g = {} + g = {} g.x = wx g.y = wy g.height = wa.height - (num_y[i] - 1)*height diff --git a/util/quake.lua b/util/quake.lua index 698277b..8bc68a7 100644 --- a/util/quake.lua +++ b/util/quake.lua @@ -122,8 +122,22 @@ function quake:compute_size() return self.geometry[self.screen.index] end -function quake:new(config) - local conf = config or {} +function quake:toggle() + if self.followtag then self.screen = awful.screen.focused() end + local current_tag = self.screen.selected_tag + if current_tag and self.last_tag ~= current_tag and self.visible then + local c=self:display() + if c then + c:move_to_tag(current_tag) + end + else + self.visible = not self.visible + self:display() + end +end + +function quake.new(conf) + conf = conf or {} conf.app = conf.app or "xterm" -- application to spawn conf.name = conf.name or "QuakeDD" -- window name @@ -162,18 +176,4 @@ function quake:new(config) return dropdown end -function quake:toggle() - if self.followtag then self.screen = awful.screen.focused() end - local current_tag = self.screen.selected_tag - if current_tag and self.last_tag ~= current_tag and self.visible then - local c=self:display() - if c then - c:move_to_tag(current_tag) - end - else - self.visible = not self.visible - self:display() - end -end - -return setmetatable(quake, { __call = function(_, ...) return quake:new(...) end }) +return setmetatable(quake, { __call = function(_, ...) return quake.new(...) end }) diff --git a/util/separators.lua b/util/separators.lua index b13ddf8..23535b7 100644 --- a/util/separators.lua +++ b/util/separators.lua @@ -69,13 +69,13 @@ function separators.arrow_left(col1, col2) widget.col1 = col1 widget.col2 = col2 - widget.fit = function(_, _, _) + widget.fit = function(_, _, _) return separators.width, separators.height end - widget.update = function(col1, col2) - widget.col1 = col1 - widget.col2 = col2 + widget.update = function(c1, c2) + widget.col1 = c1 + widget.col2 = c2 widget:emit_signal("widget::redraw_needed") end