REF add some nice comments
This commit is contained in:
parent
ee09e31e7d
commit
40678a8e17
15
conky.conf
15
conky.conf
|
@ -55,21 +55,6 @@ package.cpath = conky_dir..'lib/lib/lua/5.4/?.so;'
|
|||
local yaml = require 'lyaml'
|
||||
local i_o = require 'i_o'
|
||||
|
||||
-- local schema_path = conky_dir..'/config/schema.yml'
|
||||
-- local validate_config
|
||||
|
||||
-- if i_o.exe_exists('yajsv') then
|
||||
-- validate_config = function(config_path)
|
||||
-- local cmd = string.format('yajsv -q -s %s %s', schema_path, config_path)
|
||||
-- return i_o.exit_code_cmd(cmd) == 0
|
||||
-- end
|
||||
-- else
|
||||
-- validate_config = function(_)
|
||||
-- i_o.warnf('could not validate config')
|
||||
-- return true
|
||||
-- end
|
||||
-- end
|
||||
|
||||
local config_path = '/tmp/conky.yml'
|
||||
|
||||
local try_read_config = function(path)
|
||||
|
|
|
@ -61,19 +61,23 @@ local compile_patterns
|
|||
compile_patterns = function(patterns)
|
||||
local r = {}
|
||||
for k, v in pairs(patterns) do
|
||||
-- number -> solid color
|
||||
if type(v) == "number" then
|
||||
r[k] = rgb(v)
|
||||
-- { color = x, alpha = y} -> alpha color
|
||||
elseif v.color ~= nil then
|
||||
r[k] = rgba(v.color, v.alpha)
|
||||
-- ASSUME non-empty array is a gradient
|
||||
elseif #v > 0 then
|
||||
-- ASSUME alpha gradient will have color/stop/alpha records for each
|
||||
-- member, so just check the first
|
||||
if v[1].alpha ~= nil then
|
||||
r[k] = compile_gradient_alpha(v)
|
||||
else
|
||||
-- for k, v in pairs(compile_gradient(v)) do
|
||||
-- print(k, v.r)
|
||||
-- end
|
||||
r[k] = compile_gradient(v)
|
||||
end
|
||||
-- ASSUME nothing else in the tree is a number, a table with 'color', or
|
||||
-- an array
|
||||
else
|
||||
r[k] = compile_patterns(v)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue