From a0cd854a4d36167456bb28d255bf96a32321bf2a Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sat, 5 Dec 2020 20:57:04 -0500 Subject: fix more warnings --- .../github-contributions-widget.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'github-contributions-widget') 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) -- cgit v1.2.3