summaryrefslogtreecommitdiff
path: root/github-contributions-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2020-12-05 20:57:04 -0500
committerstreetturtle <streetturtle@gmail.com>2020-12-05 20:57:04 -0500
commita0cd854a4d36167456bb28d255bf96a32321bf2a (patch)
treeb42aa4e39d0b46144ed64d1d4f20e90c28465d3d /github-contributions-widget
parentd9eb3885eea90e06b79ff8fc4b2d1c1b8f5e4cfd (diff)
fix more warnings
Diffstat (limited to 'github-contributions-widget')
-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)