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