summaryrefslogtreecommitdiff
path: root/github-contributions-widget/github-contributions-widget.lua
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-12-07 15:33:55 -0500
committerGitHub <noreply@github.com>2020-12-07 15:33:55 -0500
commitd4971690cec1e074999e730d87045e578d71e43c (patch)
treeb0f05079840eba5467e14bdcd093ad3ed5362cf4 /github-contributions-widget/github-contributions-widget.lua
parentf078748e76eacae599cf0ad06120d9fff54f8fa5 (diff)
parented2b256407291d8edadfcea9380029633cc7d9d8 (diff)
Merge pull request #224 from streetturtle/comply-with-luacheck
Comply with luacheck
Diffstat (limited to 'github-contributions-widget/github-contributions-widget.lua')
-rw-r--r--github-contributions-widget/github-contributions-widget.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/github-contributions-widget/github-contributions-widget.lua b/github-contributions-widget/github-contributions-widget.lua
index b462299..5a45fcb 100644
--- a/github-contributions-widget/github-contributions-widget.lua
+++ b/github-contributions-widget/github-contributions-widget.lua
@@ -13,7 +13,8 @@ local naughty = require("naughty")
local wibox = require("wibox")
local widget_themes = require("awesome-wm-widgets.github-contributions-widget.themes")
-local GET_CONTRIBUTIONS_CMD = [[bash -c "curl -s https://github-contributions.now.sh/api/v1/%s | jq -r '[.contributions[] | select ( .date | strptime(\"%%Y-%%m-%%d\") | mktime < now)][:%s]| .[].color'"]]
+local GET_CONTRIBUTIONS_CMD = [[bash -c "curl -s https://github-contributions.now.sh/api/v1/%s]]
+ .. [[ | jq -r '[.contributions[] | select ( .date | strptime(\"%%Y-%%m-%%d\") | mktime < now)][:%s]| .[].color'"]]
local github_contributions_widget = wibox.widget{
reflection = {
@@ -30,9 +31,9 @@ local function show_warning(message)
text = message}
end
-local function worker(args)
+local function worker(user_args)
- local args = args or {}
+ local args = user_args or {}
local username = args.username or 'streetturtle'
local days = args.days or 365
@@ -62,10 +63,10 @@ local function worker(args)
local r, g, b = hex2rgb(color)
return wibox.widget{
- fit = function(self, context, width, height)
+ fit = function()
return 3, 3
end,
- draw = function(self, context, cr, width, height)
+ draw = function(_, _, cr, _, _)
cr:set_source_rgb(r/255, g/255, b/255)
cr:rectangle(0, 0, with_border and 2 or 3, with_border and 2 or 3)
cr:fill()
@@ -77,11 +78,11 @@ local function worker(args)
local col = {layout = wibox.layout.fixed.vertical}
local row = {layout = wibox.layout.fixed.horizontal}
local a = 5 - os.date('%w')
- for i = 0, a do
+ for _ = 0, a do
table.insert(col, get_square(color_of_empty_cells))
end
- local update_widget = function(widget, stdout, _, _, _)
+ local update_widget = function(_, stdout, _, _, _)
for colors in stdout:gmatch("[^\r\n]+") do
if a%7 == 0 then
table.insert(row, col)
@@ -100,7 +101,7 @@ local function worker(args)
end
awful.spawn.easy_async(string.format(GET_CONTRIBUTIONS_CMD, username, days),
- function(stdout, stderr)
+ function(stdout)
update_widget(github_contributions_widget, stdout)
end)