[github-contributions] fix issue caused by changed api contract
This commit is contained in:
parent
10e59679dc
commit
d5993d336f
|
@ -25,8 +25,6 @@ _Note:_ widget height is 21px (7 rows of 3x3 cells). So it would look nice on th
|
||||||
|
|
||||||
### Themes
|
### Themes
|
||||||
|
|
||||||
Themes don't work for the moment due to changes in the API the widget relies upon;
|
|
||||||
|
|
||||||
Following themes are available:
|
Following themes are available:
|
||||||
|
|
||||||
| Theme name | Preview |
|
| Theme name | Preview |
|
||||||
|
|
|
@ -14,7 +14,7 @@ local wibox = require("wibox")
|
||||||
local widget_themes = require("awesome-wm-widgets.github-contributions-widget.themes")
|
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]]
|
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'"]]
|
.. [[ | jq -r '[.contributions[] | select ( .date | strptime(\"%%Y-%%m-%%d\") | mktime < now)][:%s]| .[].intensity'"]]
|
||||||
|
|
||||||
local github_contributions_widget = wibox.widget{
|
local github_contributions_widget = wibox.widget{
|
||||||
reflection = {
|
reflection = {
|
||||||
|
@ -50,7 +50,7 @@ local function worker(user_args)
|
||||||
if with_border == nil then with_border = true end
|
if with_border == nil then with_border = true end
|
||||||
|
|
||||||
local function hex2rgb(hex)
|
local function hex2rgb(hex)
|
||||||
if color_of_empty_cells ~= nil and hex == '#ebedf0' then
|
if color_of_empty_cells ~= nil and hex == widget_themes[theme][0] then
|
||||||
hex = color_of_empty_cells
|
hex = color_of_empty_cells
|
||||||
end
|
end
|
||||||
hex = tostring(hex):gsub('#','')
|
hex = tostring(hex):gsub('#','')
|
||||||
|
@ -77,20 +77,19 @@ local function worker(user_args)
|
||||||
|
|
||||||
local col = {layout = wibox.layout.fixed.vertical}
|
local col = {layout = wibox.layout.fixed.vertical}
|
||||||
local row = {layout = wibox.layout.fixed.horizontal}
|
local row = {layout = wibox.layout.fixed.horizontal}
|
||||||
local a = 5 - os.date('%w')
|
local day_idx = 5 - os.date('%w')
|
||||||
for _ = 0, a do
|
for _ = 0, day_idx do
|
||||||
table.insert(col, get_square(color_of_empty_cells))
|
table.insert(col, get_square(color_of_empty_cells))
|
||||||
end
|
end
|
||||||
|
|
||||||
local update_widget = function(_, stdout, _, _, _)
|
local update_widget = function(_, stdout, _, _, _)
|
||||||
for colors in stdout:gmatch("[^\r\n]+") do
|
for intensity in stdout:gmatch("[^\r\n]+") do
|
||||||
if a%7 == 0 then
|
if day_idx %7 == 0 then
|
||||||
table.insert(row, col)
|
table.insert(row, col)
|
||||||
col = {layout = wibox.layout.fixed.vertical}
|
col = {layout = wibox.layout.fixed.vertical}
|
||||||
end
|
end
|
||||||
--table.insert(col, get_square(widget_themes[theme][colors:match('var%(%-%-(.*)%)'):gsub('-', '_')]))
|
table.insert(col, get_square(widget_themes[theme][tonumber(intensity)]))
|
||||||
table.insert(col, get_square(colors))
|
day_idx = day_idx + 1
|
||||||
a = a + 1
|
|
||||||
end
|
end
|
||||||
github_contributions_widget:setup(
|
github_contributions_widget:setup(
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
local themes = {
|
local themes = {
|
||||||
standard = {
|
standard = {
|
||||||
color_calendar_graph_day_L4_bg = '#216e39',
|
[4] = '#216e39',
|
||||||
color_calendar_graph_day_L3_bg = '#30a14e',
|
[3] = '#30a14e',
|
||||||
color_calendar_graph_day_L2_bg = '#40c463',
|
[2] = '#40c463',
|
||||||
color_calendar_graph_day_L1_bg = '#9be9a8',
|
[1] = '#9be9a8',
|
||||||
color_calendar_graph_day_bg = '#ebedf0'
|
[0] = '#ebedf0'
|
||||||
},
|
},
|
||||||
classic = {
|
classic = {
|
||||||
color_calendar_graph_day_L4_bg = '#196127',
|
[4] = '#196127',
|
||||||
color_calendar_graph_day_L3_bg = '#239a3b',
|
[3] = '#239a3b',
|
||||||
color_calendar_graph_day_L2_bg = '#7bc96f',
|
[2] = '#7bc96f',
|
||||||
color_calendar_graph_day_L1_bg = '#c6e48b',
|
[1] = '#c6e48b',
|
||||||
color_calendar_graph_day_bg = '#ebedf0',
|
[0] = '#ebedf0',
|
||||||
},
|
},
|
||||||
teal = {
|
teal = {
|
||||||
color_calendar_graph_day_L4_bg = '#458B74',
|
[4] = '#458B74',
|
||||||
color_calendar_graph_day_L3_bg = '#66CDAA',
|
[3] = '#66CDAA',
|
||||||
color_calendar_graph_day_L2_bg = '#76EEC6',
|
[2] = '#76EEC6',
|
||||||
color_calendar_graph_day_L1_bg = '#7FFFD4',
|
[1] = '#7FFFD4',
|
||||||
color_calendar_graph_day_bg = '#ebedf0',
|
[0] = '#ebedf0',
|
||||||
},
|
},
|
||||||
leftpad = {
|
leftpad = {
|
||||||
color_calendar_graph_day_L4_bg = '#F6F6F6',
|
[4] = '#F6F6F6',
|
||||||
color_calendar_graph_day_L3_bg = '#DDDDDD',
|
[3] = '#DDDDDD',
|
||||||
color_calendar_graph_day_L2_bg = '#A5A5A5',
|
[2] = '#A5A5A5',
|
||||||
color_calendar_graph_day_L1_bg = '#646464',
|
[1] = '#646464',
|
||||||
color_calendar_graph_day_bg = '#2F2F2F',
|
[0] = '#2F2F2F',
|
||||||
},
|
},
|
||||||
dracula = {
|
dracula = {
|
||||||
color_calendar_graph_day_L4_bg = '#ff79c6',
|
[4] = '#ff79c6',
|
||||||
color_calendar_graph_day_L3_bg = '#bd93f9',
|
[3] = '#bd93f9',
|
||||||
color_calendar_graph_day_L2_bg = '#6272a4',
|
[2] = '#6272a4',
|
||||||
color_calendar_graph_day_L1_bg = '#44475a',
|
[1] = '#44475a',
|
||||||
color_calendar_graph_day_bg = '#282a36'
|
[0] = '#282a36'
|
||||||
},
|
},
|
||||||
pink = {
|
pink = {
|
||||||
color_calendar_graph_day_L4_bg = '#61185f',
|
[4] = '#61185f',
|
||||||
color_calendar_graph_day_L3_bg = '#a74aa8',
|
[3] = '#a74aa8',
|
||||||
color_calendar_graph_day_L2_bg = '#ca5bcc',
|
[2] = '#ca5bcc',
|
||||||
color_calendar_graph_day_L1_bg = '#e48bdc',
|
[1] = '#e48bdc',
|
||||||
color_calendar_graph_day_bg = '#ebedf0',
|
[0] = '#ebedf0',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue