summaryrefslogtreecommitdiff
path: root/gerrit-widget/gerrit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit-widget/gerrit.lua')
-rw-r--r--gerrit-widget/gerrit.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/gerrit-widget/gerrit.lua b/gerrit-widget/gerrit.lua
index ad5d7a6..682eb0f 100644
--- a/gerrit-widget/gerrit.lua
+++ b/gerrit-widget/gerrit.lua
@@ -27,13 +27,13 @@ local DOWNLOAD_AVATAR_CMD = [[bash -c "curl --create-dirs -o %s %s"]]
local gerrit_widget = {}
-local function worker(args)
+local function worker(user_args)
- local args = args or {}
+ local args = user_args or {}
local icon = args.icons or HOME_DIR .. '/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg'
local host = args.host or naughty.notify{
- preset = naughty.config.presets.critical,
+ preset = naughty.config.presets.critical,
title = 'Gerrit Widget',
text = 'Gerrit host is unknown'
}
@@ -93,11 +93,12 @@ local function worker(args)
if name_dict[user_id].username == nil then
name_dict[user_id].username = ''
- spawn.easy_async(string.format(GET_USER_CMD, host, user_id), function(stdout, stderr, reason, exit_code)
+ spawn.easy_async(string.format(GET_USER_CMD, host, user_id), function(stdout)
local user = json.decode(stdout)
name_dict[tonumber(user_id)].username = user.name
if not gfs.file_readable(PATH_TO_AVATARS .. user_id) then
- spawn.easy_async(string.format(DOWNLOAD_AVATAR_CMD, PATH_TO_AVATARS .. user_id, user.avatars[1].url))
+ spawn.easy_async(
+ string.format(DOWNLOAD_AVATAR_CMD, PATH_TO_AVATARS .. user_id, user.avatars[1].url))
end
end)
return name_dict[user_id].username
@@ -124,7 +125,8 @@ local function worker(args)
naughty.notify{
icon = HOME_DIR ..'/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg',
title = 'New Incoming Review',
- text = reviews[1].project .. '\n' .. get_name_by_user_id(reviews[1].owner._account_id) .. reviews[1].subject .. '\n',
+ text = reviews[1].project .. '\n' .. get_name_by_user_id(reviews[1].owner._account_id) ..
+ reviews[1].subject .. '\n',
run = function() spawn.with_shell("xdg-open https://" .. host .. '/' .. reviews[1]._number) end
}
end
@@ -174,7 +176,7 @@ local function worker(args)
widget = wibox.container.background
}
- row:connect_signal("button::release", function(_, _, _, button)
+ row:connect_signal("button::release", function()
spawn.with_shell("xdg-open " .. host .. '/' .. review._number)
end)