conky-config/conky.conf

126 lines
2.9 KiB
Plaintext
Raw Normal View History

--------------------------------------------------------------------------------
-- set up paths
2022-07-19 18:11:46 -04:00
local conky_dir = debug.getinfo(1).source:match("@?(.*/)")
local subdirs = {
'?.lua',
'drawing/?.lua',
'schema/?.lua',
'core/?.lua',
'core/widget/?.lua',
'core/widget/arc/?.lua',
'core/widget/text/?.lua',
'core/widget/timeseries/?.lua',
'core/widget/rect/?.lua',
'core/widget/line/?.lua',
'lib/share/lua/5.4/?.lua',
'lib/share/lua/5.4/?/init.lua',
}
for i = 1, #subdirs do
subdirs[i] = conky_dir..subdirs[i]
end
package.path = table.concat(subdirs, ';')
package.cpath = conky_dir..'lib/lib/lua/5.4/?.so;'
--------------------------------------------------------------------------------
-- select global config to use (fallback to default if none found)
local yaml = require 'lyaml'
local i_o = require 'i_o'
local schema_path = conky_dir..'/config/schema.yml'
2022-07-19 22:55:17 -04:00
local validate_config
2022-07-19 22:55:17 -04:00
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(_)
print('WARNING: could not validate config')
return true
end
end
2022-07-19 22:55:17 -04:00
local find_valid_config = function(paths)
for i = 1, #paths do
local path = paths[i]
local r = i_o.read_file(path)
if r ~= nil then
if validate_config(path) then
i_o.printf('INFO: Using config at %s', path)
return path, yaml.load(r)
else
i_o.printf('WARNING: %s did not pass; trying next', path)
end
else
i_o.printf('INFO: could not find %s; trying next', path)
end
end
assert(false, 'ERROR: could not load valid config')
end
2022-07-19 22:55:17 -04:00
local get_config_dir = function()
return (os.getenv("XDG_CONFIG_HOME") or os.getenv("HOME")..'/.config')..'/'
end
2022-07-19 22:55:17 -04:00
local try_config_paths = {
get_config_dir()..'conky.ymll',
conky_dir..'config/fallback.yml'
}
local config_path, config = find_valid_config(try_config_paths)
local bootstrap = config.bootstrap
local startup_hook = string.format(
'start %f %s %s %s',
bootstrap.update_interval,
config_path,
package.path,
package.cpath
)
2022-07-19 18:11:46 -04:00
2016-08-11 23:25:56 -04:00
conky.config = {
2017-07-16 23:49:27 -04:00
background = false,
2016-08-11 23:25:56 -04:00
-- adjust cpu dial sensitivity (1-14)
2016-08-11 23:25:56 -04:00
cpu_avg_samples = 4,
net_avg_samples = 1,
2016-08-11 23:25:56 -04:00
out_to_console = false,
own_window = true,
2020-03-15 12:05:08 -04:00
own_window_type = 'override',
2016-08-11 23:25:56 -04:00
own_window_transparent = true,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
xinerama_head = 0,
2016-08-11 23:25:56 -04:00
double_buffer = true,
minimum_width = bootstrap.dimensions[1],
minimum_height = bootstrap.dimensions[2],
2016-08-11 23:25:56 -04:00
draw_shades = false,
draw_outline = false,
draw_borders = false,
gap_x = 0,
gap_y = 0,
alignment = 'top_left',
no_buffers = true,
-- Lua Load
2022-07-19 18:11:46 -04:00
lua_load = conky_dir..'main.lua',
lua_draw_hook_post = 'main',
lua_startup_hook = startup_hook
2016-08-11 23:25:56 -04:00
}
--control updates entirely in lua
conky.text = [[]]