Merge pull request #1622 from Veratil/fix-new-luacheck
Fix Luacheck 0.19.0 release Travis breaks
This commit is contained in:
commit
971adec0d0
|
@ -13,11 +13,13 @@ files["awesomerc.lua"].allow_defined_top = true
|
|||
-- This file itself
|
||||
files[".luacheckrc"].ignore = {"111", "112", "131"}
|
||||
|
||||
-- Theme files, ignore max line length
|
||||
files["themes/*"].ignore = {"631"}
|
||||
|
||||
-- Global objects defined by the C code
|
||||
read_globals = {
|
||||
"awesome",
|
||||
"button",
|
||||
"client",
|
||||
"dbus",
|
||||
"drawable",
|
||||
"drawin",
|
||||
|
@ -28,6 +30,8 @@ read_globals = {
|
|||
"selection",
|
||||
"tag",
|
||||
"window",
|
||||
"table.unpack",
|
||||
"math.atan2",
|
||||
}
|
||||
|
||||
-- screen may not be read-only, because newer luacheck versions complain about
|
||||
|
|
|
@ -106,7 +106,8 @@ function completion.shell(command, cur_pos, ncomp, shell)
|
|||
-- check commands, aliases, builtins, functions and reswords
|
||||
shell_cmd = "/usr/bin/env zsh -c 'local -a res; "..
|
||||
"res=( "..
|
||||
"\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" \"${(k)reswords[@]}\" "..
|
||||
"\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" "..
|
||||
"\"${(k)reswords[@]}\" "..
|
||||
"${PWD}/*(:t)"..
|
||||
"); "..
|
||||
"print -ln -- ${(M)res[@]:#" .. string.format('%q', words[cword_index]) .. "*}'"
|
||||
|
|
|
@ -117,7 +117,8 @@ local function mouse_resize_handler(c, _, _, _, orientation)
|
|||
|
||||
local geom = c:geometry()
|
||||
|
||||
-- we have to make sure we're not on the last visible client where we have to use different settings.
|
||||
-- we have to make sure we're not on the last visible
|
||||
-- client where we have to use different settings.
|
||||
local wfact
|
||||
local wfact_x, wfact_y
|
||||
if (geom.y+geom.height+15) > (wa.y+wa.height) then
|
||||
|
@ -265,7 +266,8 @@ local function do_tile(param, orientation)
|
|||
if not data[0] then
|
||||
data[0] = {}
|
||||
end
|
||||
coord = coord + tile_group(gs, cls, wa, orientation, data[0], {first=1, last=nmaster, coord = coord, size = size})
|
||||
coord = coord + tile_group(gs, cls, wa, orientation, data[0],
|
||||
{first=1, last=nmaster, coord = coord, size = size})
|
||||
end
|
||||
|
||||
if not place_master and nother > 0 then
|
||||
|
@ -285,7 +287,8 @@ local function do_tile(param, orientation)
|
|||
if not data[i] then
|
||||
data[i] = {}
|
||||
end
|
||||
coord = coord + tile_group(gs, cls, wa, orientation, data[i], { first = first, last = last, coord = coord, size = size })
|
||||
coord = coord + tile_group(gs, cls, wa, orientation, data[i],
|
||||
{ first = first, last = last, coord = coord, size = size })
|
||||
end
|
||||
end
|
||||
place_master = not place_master
|
||||
|
|
|
@ -632,8 +632,10 @@ end
|
|||
--- Create a menu popup.
|
||||
-- @param args Table containing the menu informations.
|
||||
--
|
||||
-- * Key items: Table containing the displayed items. Each element is a table by default (when element 'new' is awful.menu.entry) containing: item name, triggered action, submenu table or function, item icon (optional).
|
||||
-- * Keys theme.[fg|bg]_[focus|normal], theme.border_color, theme.border_width, theme.submenu_icon, theme.height and theme.width override the default display for your menu and/or of your menu entry, each of them are optional.
|
||||
-- * Key items: Table containing the displayed items. Each element is a table by default (when element 'new' is
|
||||
-- awful.menu.entry) containing: item name, triggered action, submenu table or function, item icon (optional).
|
||||
-- * Keys theme.[fg|bg]_[focus|normal], theme.border_color, theme.border_width, theme.submenu_icon, theme.height
|
||||
-- and theme.width override the default display for your menu and/or of your menu entry, each of them are optional.
|
||||
-- * Key auto_expand controls the submenu auto expand behaviour by setting it to true (default) or false.
|
||||
--
|
||||
-- @param parent Specify the parent menu if we want to open a submenu, this value should never be set by the user.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
--luacheck: no max line length
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
--- Spawning of programs.
|
||||
--
|
||||
|
|
|
@ -471,7 +471,9 @@ end
|
|||
--- Create a new minimize button for a client.
|
||||
-- @param c The client for which the button is wanted.
|
||||
function titlebar.widget.minimizebutton(c)
|
||||
local widget = titlebar.widget.button(c, "minimize", function() return "" end, function(cl) cl.minimized = not cl.minimized end)
|
||||
local widget = titlebar.widget.button(c, "minimize",
|
||||
function() return "" end,
|
||||
function(cl) cl.minimized = not cl.minimized end)
|
||||
c:connect_signal("property::minimized", widget.update)
|
||||
return widget
|
||||
end
|
||||
|
@ -485,7 +487,9 @@ end
|
|||
--- Create a new ontop button for a client.
|
||||
-- @param c The client for which the button is wanted.
|
||||
function titlebar.widget.ontopbutton(c)
|
||||
local widget = titlebar.widget.button(c, "ontop", function(cl) return cl.ontop end, function(cl, state) cl.ontop = not state end)
|
||||
local widget = titlebar.widget.button(c, "ontop",
|
||||
function(cl) return cl.ontop end,
|
||||
function(cl, state) cl.ontop = not state end)
|
||||
c:connect_signal("property::ontop", widget.update)
|
||||
return widget
|
||||
end
|
||||
|
@ -493,7 +497,9 @@ end
|
|||
--- Create a new sticky button for a client.
|
||||
-- @param c The client for which the button is wanted.
|
||||
function titlebar.widget.stickybutton(c)
|
||||
local widget = titlebar.widget.button(c, "sticky", function(cl) return cl.sticky end, function(cl, state) cl.sticky = not state end)
|
||||
local widget = titlebar.widget.button(c, "sticky",
|
||||
function(cl) return cl.sticky end,
|
||||
function(cl, state) cl.sticky = not state end)
|
||||
c:connect_signal("property::sticky", widget.update)
|
||||
return widget
|
||||
end
|
||||
|
|
|
@ -145,7 +145,8 @@ function util.escape(text)
|
|||
return text and text:gsub("['&<>\"]", xml_entity_names) or nil
|
||||
end
|
||||
|
||||
local xml_entity_chars = { lt = "<", gt = ">", nbsp = " ", quot = "\"", apos = "'", ndash = "-", mdash = "-", amp = "&" };
|
||||
local xml_entity_chars = { lt = "<", gt = ">", nbsp = " ", quot = "\"", apos = "'", ndash = "-", mdash = "-",
|
||||
amp = "&" };
|
||||
--- Unescape a string from entities.
|
||||
-- @param text Text to unescape.
|
||||
-- @return Unescaped text.
|
||||
|
|
|
@ -45,7 +45,8 @@ function button.new(args)
|
|||
orig_set_image(self, img_release)
|
||||
end
|
||||
w:set_image(args.image)
|
||||
w:buttons(abutton({}, 1, function () orig_set_image(w, img_press) end, function () orig_set_image(w, img_release) end))
|
||||
w:buttons(abutton({}, 1, function () orig_set_image(w, img_press) end,
|
||||
function () orig_set_image(w, img_release) end))
|
||||
|
||||
w:connect_signal("mouse::leave", function(self) orig_set_image(self, img_release) end)
|
||||
|
||||
|
|
|
@ -210,7 +210,8 @@ local function tasklist_label(c, args, tb)
|
|||
local bg_focus = args.bg_focus or theme.tasklist_bg_focus or theme.bg_focus or bg_normal
|
||||
local fg_urgent = util.ensure_pango_color(args.fg_urgent or theme.tasklist_fg_urgent or theme.fg_urgent, fg_normal)
|
||||
local bg_urgent = args.bg_urgent or theme.tasklist_bg_urgent or theme.bg_urgent or bg_normal
|
||||
local fg_minimize = util.ensure_pango_color(args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize, fg_normal)
|
||||
local fg_minimize = util.ensure_pango_color(args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize,
|
||||
fg_normal)
|
||||
local bg_minimize = args.bg_minimize or theme.tasklist_bg_minimize or theme.bg_minimize or bg_normal
|
||||
-- FIXME v5, remove the fallback theme.bg_image_* variables, see GH#1403
|
||||
local bg_image_normal = args.bg_image_normal or theme.tasklist_bg_image_normal or theme.bg_image_normal
|
||||
|
|
|
@ -111,7 +111,10 @@ end
|
|||
-- @return item name, item background color, background image, item icon.
|
||||
local function label(o)
|
||||
if o.focused then
|
||||
return colortext(o.name, (theme.menu_fg_focus or theme.fg_focus)), (theme.menu_bg_focus or theme.bg_focus), nil, o.icon
|
||||
return colortext(o.name, (theme.menu_fg_focus or theme.fg_focus)),
|
||||
(theme.menu_bg_focus or theme.bg_focus),
|
||||
nil,
|
||||
o.icon
|
||||
else
|
||||
return o.name, (theme.menu_bg_normal or theme.bg_normal), nil, o.icon
|
||||
end
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
-- @module naughty
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
--luacheck: no max line length
|
||||
|
||||
-- Package environment
|
||||
local pairs = pairs
|
||||
local table = table
|
||||
|
|
|
@ -105,98 +105,99 @@ local function convert_icon(w, h, rowstride, channels, data)
|
|||
return cairo.ImageSurface.create_for_data(tcat(rows), format, w, h, stride)
|
||||
end
|
||||
|
||||
capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
|
||||
local args = { }
|
||||
if data.member == "Notify" then
|
||||
if text ~= "" then
|
||||
args.text = text
|
||||
if title ~= "" then
|
||||
args.title = title
|
||||
end
|
||||
else
|
||||
if title ~= "" then
|
||||
args.text = title
|
||||
capi.dbus.connect_signal("org.freedesktop.Notifications",
|
||||
function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
|
||||
local args = { }
|
||||
if data.member == "Notify" then
|
||||
if text ~= "" then
|
||||
args.text = text
|
||||
if title ~= "" then
|
||||
args.title = title
|
||||
end
|
||||
else
|
||||
return
|
||||
if title ~= "" then
|
||||
args.text = title
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if appname ~= "" then
|
||||
args.appname = appname
|
||||
end
|
||||
for _, obj in pairs(dbus.config.mapping) do
|
||||
local filter, preset = obj[1], obj[2]
|
||||
if (not filter.urgency or filter.urgency == hints.urgency) and
|
||||
(not filter.category or filter.category == hints.category) and
|
||||
(not filter.appname or filter.appname == appname) then
|
||||
args.preset = util.table.join(args.preset, preset)
|
||||
if appname ~= "" then
|
||||
args.appname = appname
|
||||
end
|
||||
end
|
||||
local preset = args.preset or naughty.config.defaults
|
||||
local notification
|
||||
if actions then
|
||||
args.actions = {}
|
||||
for _, obj in pairs(dbus.config.mapping) do
|
||||
local filter, preset = obj[1], obj[2]
|
||||
if (not filter.urgency or filter.urgency == hints.urgency) and
|
||||
(not filter.category or filter.category == hints.category) and
|
||||
(not filter.appname or filter.appname == appname) then
|
||||
args.preset = util.table.join(args.preset, preset)
|
||||
end
|
||||
end
|
||||
local preset = args.preset or naughty.config.defaults
|
||||
local notification
|
||||
if actions then
|
||||
args.actions = {}
|
||||
|
||||
for i = 1,#actions,2 do
|
||||
local action_id = actions[i]
|
||||
local action_text = actions[i + 1]
|
||||
for i = 1,#actions,2 do
|
||||
local action_id = actions[i]
|
||||
local action_text = actions[i + 1]
|
||||
|
||||
if action_id == "default" then
|
||||
args.run = function()
|
||||
sendActionInvoked(notification.id, "default")
|
||||
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
||||
end
|
||||
elseif action_id ~= nil and action_text ~= nil then
|
||||
args.actions[action_text] = function()
|
||||
sendActionInvoked(notification.id, action_id)
|
||||
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
||||
if action_id == "default" then
|
||||
args.run = function()
|
||||
sendActionInvoked(notification.id, "default")
|
||||
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
||||
end
|
||||
elseif action_id ~= nil and action_text ~= nil then
|
||||
args.actions[action_text] = function()
|
||||
sendActionInvoked(notification.id, action_id)
|
||||
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
args.destroy = function(reason)
|
||||
sendNotificationClosed(notification.id, reason)
|
||||
end
|
||||
if not preset.callback or (type(preset.callback) == "function" and
|
||||
preset.callback(data, appname, replaces_id, icon, title, text, actions, hints, expire)) then
|
||||
if icon ~= "" then
|
||||
args.icon = icon
|
||||
elseif hints.icon_data or hints.image_data then
|
||||
if hints.icon_data == nil then hints.icon_data = hints.image_data end
|
||||
args.destroy = function(reason)
|
||||
sendNotificationClosed(notification.id, reason)
|
||||
end
|
||||
if not preset.callback or (type(preset.callback) == "function" and
|
||||
preset.callback(data, appname, replaces_id, icon, title, text, actions, hints, expire)) then
|
||||
if icon ~= "" then
|
||||
args.icon = icon
|
||||
elseif hints.icon_data or hints.image_data then
|
||||
if hints.icon_data == nil then hints.icon_data = hints.image_data end
|
||||
|
||||
-- icon_data is an array:
|
||||
-- 1 -> width
|
||||
-- 2 -> height
|
||||
-- 3 -> rowstride
|
||||
-- 4 -> has alpha
|
||||
-- 5 -> bits per sample
|
||||
-- 6 -> channels
|
||||
-- 7 -> data
|
||||
local w, h, rowstride, _, _, channels, icon_data = unpack(hints.icon_data)
|
||||
args.icon = convert_icon(w, h, rowstride, channels, icon_data)
|
||||
-- icon_data is an array:
|
||||
-- 1 -> width
|
||||
-- 2 -> height
|
||||
-- 3 -> rowstride
|
||||
-- 4 -> has alpha
|
||||
-- 5 -> bits per sample
|
||||
-- 6 -> channels
|
||||
-- 7 -> data
|
||||
local w, h, rowstride, _, _, channels, icon_data = unpack(hints.icon_data)
|
||||
args.icon = convert_icon(w, h, rowstride, channels, icon_data)
|
||||
end
|
||||
if replaces_id and replaces_id ~= "" and replaces_id ~= 0 then
|
||||
args.replaces_id = replaces_id
|
||||
end
|
||||
if expire and expire > -1 then
|
||||
args.timeout = expire / 1000
|
||||
end
|
||||
notification = naughty.notify(args)
|
||||
return "u", notification.id
|
||||
end
|
||||
if replaces_id and replaces_id ~= "" and replaces_id ~= 0 then
|
||||
args.replaces_id = replaces_id
|
||||
return "u", "0"
|
||||
elseif data.member == "CloseNotification" then
|
||||
local obj = naughty.getById(appname)
|
||||
if obj then
|
||||
naughty.destroy(obj, naughty.notificationClosedReason.dismissedByCommand)
|
||||
end
|
||||
if expire and expire > -1 then
|
||||
args.timeout = expire / 1000
|
||||
end
|
||||
notification = naughty.notify(args)
|
||||
return "u", notification.id
|
||||
elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then
|
||||
-- name of notification app, name of vender, version, specification version
|
||||
return "s", "naughty", "s", "awesome", "s", capi.awesome.version, "s", "1.0"
|
||||
elseif data.member == "GetCapabilities" then
|
||||
-- We actually do display the body of the message, we support <b>, <i>
|
||||
-- and <u> in the body and we handle static (non-animated) icons.
|
||||
return "as", { "s", "body", "s", "body-markup", "s", "icon-static", "s", "actions" }
|
||||
end
|
||||
return "u", "0"
|
||||
elseif data.member == "CloseNotification" then
|
||||
local obj = naughty.getById(appname)
|
||||
if obj then
|
||||
naughty.destroy(obj, naughty.notificationClosedReason.dismissedByCommand)
|
||||
end
|
||||
elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then
|
||||
-- name of notification app, name of vender, version, specification version
|
||||
return "s", "naughty", "s", "awesome", "s", capi.awesome.version, "s", "1.0"
|
||||
elseif data.member == "GetCapabilities" then
|
||||
-- We actually do display the body of the message, we support <b>, <i>
|
||||
-- and <u> in the body and we handle static (non-animated) icons.
|
||||
return "as", { "s", "body", "s", "body-markup", "s", "icon-static", "s", "actions" }
|
||||
end
|
||||
end)
|
||||
|
||||
capi.dbus.connect_signal("org.freedesktop.DBus.Introspectable", function (data)
|
||||
|
|
|
@ -127,7 +127,11 @@ local function calculate_info(self, context, width, height)
|
|||
|
||||
local x, y = 0, 0
|
||||
local function get_scroll_offset(size, visible_size)
|
||||
return self._private.step_function(self._private.timer:elapsed(), size, visible_size, self._private.speed, self._private.extra_space)
|
||||
return self._private.step_function(self._private.timer:elapsed(),
|
||||
size,
|
||||
visible_size,
|
||||
self._private.speed,
|
||||
self._private.extra_space)
|
||||
end
|
||||
if self._private.dir == "h" then
|
||||
x = -get_scroll_offset(surface_width - extra, width)
|
||||
|
|
|
@ -76,7 +76,11 @@ local function widget_layout(state, arguments)
|
|||
return false
|
||||
end
|
||||
say:set("assertion.widget_layout.positive", "Expected:\n%s\nbut got:\n%s\nwhen offering (%s, %s) to widget")
|
||||
assert:register("assertion", "widget_layout", widget_layout, "assertion.widget_layout.positive", "assertion.widget_layout.positive")
|
||||
assert:register("assertion",
|
||||
"widget_layout",
|
||||
widget_layout,
|
||||
"assertion.widget_layout.positive",
|
||||
"assertion.widget_layout.positive")
|
||||
-- }}}
|
||||
|
||||
return {
|
||||
|
|
|
@ -8,7 +8,8 @@ local create_wibox = require("_wibox_helper").create_wibox
|
|||
|
||||
local BENCHMARK_EXACT = os.getenv("BENCHMARK_EXACT")
|
||||
if not BENCHMARK_EXACT then
|
||||
print("Doing quick and inexact measurements. Set BENCHMARK_EXACT=1 as an environment variable when you actually want to look at the results.")
|
||||
print("Doing quick and inexact measurements. Set BENCHMARK_EXACT=1 as an "..
|
||||
"environment variable when you actually want to look at the results.")
|
||||
end
|
||||
|
||||
local measure, benchmark
|
||||
|
|
Loading…
Reference in New Issue