-------------------------------------------------------------------------------- -- set up paths 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' local try_config_paths = { '/home/ndwar/.config/conky.yml', conky_dir..'config/fallback.yml' } local config_path local config for i = 1, #try_config_paths do config_path = try_config_paths[i] local r = i_o.read_file(config_path) if r ~= nil then config = yaml.load(r) break end end i_o.printf('Using config at %s', config_path) if i_o.exit_code_cmd('command -v yajsv > /dev/null') == 0 then local cmd = string.format('yajsv -q -s %s %s', schema_path, config_path) assert(i_o.exit_code_cmd(cmd) == 0, 'ERROR: config failed validation') else print(string.format('WARNING: could not validate config')) end local bootstrap = config.bootstrap local startup_hook = string.format( 'start %f %s %s %s', bootstrap.update_interval, config_path, package.path, package.cpath ) conky.config = { background = false, -- adjust cpu dial sensitivity (1-14) cpu_avg_samples = 4, net_avg_samples = 1, out_to_console = false, own_window = true, own_window_type = 'override', own_window_transparent = true, own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager', xinerama_head = 0, double_buffer = true, minimum_width = bootstrap.dimensions[1], minimum_height = bootstrap.dimensions[2], draw_shades = false, draw_outline = false, draw_borders = false, gap_x = 0, gap_y = 0, alignment = 'top_left', no_buffers = true, -- Lua Load lua_load = conky_dir..'main.lua', lua_draw_hook_post = 'main', lua_startup_hook = startup_hook } --control updates entirely in lua conky.text = [[]]