I had an issue - after the update - with conky not starting. Not sure if anyone else is having the problem.
Basically it’s because my scripts are OLD.
So I worked out that with conky 1.11.6_pre it generally tries to do this job on the fly, but obviously failed.
So the solution - make a file in your .local/bin called ‘convert.lua’. (This should be in your $PATH - you can check using echo $PATH
)
Paste this:
Summary
#! /usr/bin/lua
local usage = [[
Usage: convert.lua old_conkyrc [new_conkyrc]
Tries to convert conkyrc from the old v1.x format to the new, lua-based format.
Keep in mind that there is no guarantee that the output will work correctly
with conky, or that it will be able to convert every conkyrc. However, it
should provide a good starting point.
Although you can use this script with only 1 arg and let it overwrite the old
config, it’s suggested to use 2 args so that the new config is written in a new
file (so that you have backup if something went wrong).
Optional: Install dos2unix. We will attempt to use this if it is available
because Conky configs downloaded from Internet sometimes are created on DOS/Windows
machines with different line endings than Conky configs created on Unix/Linux.
For more information about the new format, read the wiki page
https://github.com/brndnmtthws/conky/wiki
]];
local function quote(s)
if not s:find("[\n’\]") then
return “’” … s … “’”;
end;
local q = ‘’;
while s:find(’]’ … q … ‘]’, 1, true) do
q = q … ‘=’;
end;
return string.format(’[%s[\n%s]%s]’, q, s, q);
end;
local bool_setting = {
background = true, disable_auto_reload = true, double_buffer = true, draw_borders = true,
draw_graph_borders = true, draw_outline = true, draw_shades = true, extra_newline = true,
format_human_readable = true, no_buffers = true, out_to_console = true,
out_to_ncurses = true, out_to_stderr = true, out_to_x = true, override_utf8_locale = true,
own_window = true, own_window_argb_visual = true, own_window_transparent = true,
short_units = true, show_graph_range = true, show_graph_scale = true,
times_in_seconds = true, top_cpu_separate = true, uppercase = true, use_xft = true,
draw_blended = true, forced_redraw = true
};
local num_setting = {
border_inner_margin = true, border_outer_margin = true, border_width = true,
cpu_avg_samples = true, diskio_avg_samples = true, gap_x = true, gap_y = true,
imlib_cache_flush_interval = true, imlib_cache_size = true,
max_port_monitor_connections = true, max_text_width = true, max_user_text = true,
maximum_width = true, mpd_port = true, music_player_interval = true, net_avg_samples = true,
own_window_argb_value = true, pad_percents = true, stippled_borders = true,
text_buffer_size = true, top_name_width = true, total_run_times = true,
update_interval = true, update_interval_on_battery = true, xftalpha = true,
xinerama_head = true,
};
local split_setting = {
default_bar_size = true, default_gauge_size = true, default_graph_size = true,
minimum_size = true
};
local colour_setting = {
color0 = true, color1 = true, color2 = true, color3 = true, color4 = true, color5 = true,
color6 = true, color7 = true, color8 = true, color9 = true, default_color = true,
default_outline_color = true, default_shade_color = true, own_window_colour = true
};
local function alignment_map(value)
local map = { m = ‘middle’, t = ‘top’, b = ‘bottom’, r = ‘right’, l = ‘left’ };
if map[value] == nil then
return value;
else
return map[value];
end;
end;
local function handle(setting, value)
setting = setting:lower();
if setting == ‘’ then
return ‘’;
end;
if split_setting[setting] then
local x, y = value:match(’^(%S+)%s*(%S*)$’);
local ret = setting:gsub(’_size’, ‘_width = ‘) … x … ‘,’;
if y ~= ‘’ then
ret = ret … ’ ’ … setting:gsub(’_size’, ‘height = ') … y … ‘,’;
end;
return ‘\t’ … ret;
end;
if bool_setting[setting] then
value = value:lower();
if value == ‘yes’ or value == ‘true’ or value == ‘1’ or value == ‘’ then
value = ‘true’;
else
value = ‘false’;
end;
elseif not num_setting[setting] then
if setting == ‘alignment’ and value:len() == 2 then
value = alignment_map(value:sub(1,1)) … '’ … alignment_map(value:sub(2,2));
elseif colour_setting[setting] and value:match(’^[0-9a-fA-F]+$’) then
value = ‘#’ … value;
elseif setting == ‘xftfont’ then
setting = ‘font’;
end;
value = quote(value);
end;
return ‘\t’ … setting … ’ = ’ … value … ‘,’;
end;
local function convert(s)
local setting, comment = s:match(’^([^#])#?(.)\n$’);
if comment ~= ‘’ then
comment = ‘–’ … comment;
end;
comment = comment … ‘\n’;
return handle(setting:match(’^%s*(%S*)%s*(.-)%s*$’)) … comment;
end;
local input;
local output;
if conky == nil then → standalone program
– 1 arg: arg is input and outputfile
– 2 args: 1st is inputfile, 2nd is outputfile
– 0, 3 or more args: print usage to STDERR and quit
if #arg == 1 or #arg == 2 then
if os.execute(‘command -v dos2unix 2&>1’) then
os.execute('dos2unix ’ … arg[1]);
end
input = io.input(arg[1]);
else
io.stderr:write(usage);
return;
end;
else
– we are called from conky, the filename is the first argument
input = io.open(…, ‘r’);
end;
local config = input:read(’*a’);
input:close();
local settings, text = config:match(’^(.-)TEXT\n(.*)$’);
local converted = ‘conky.config = {\n’ … settings:gsub(’.-\n’, convert) … '};\n\nconky.text = ’ …
quote(text) … ‘;\n’;
if conky == nil then
if #arg == 2 then
output = io.output(arg[2]);
else
output = io.output(arg[1]);
end
output:write(converted);
output:close();
else
return assert(load(converted, ‘converted config’));
end;
Make it executable Then find your conky folder and simply do this (e.g. for my ‘network.conky’ script)
$ convert.lua network.conky
I’d advise making a backup first - I hadn’t realised it will simply overwrite the contents of the file.
However, it worked.
My new network conky looks like this:
Exactly the same, but the file now looks like this:
Summary
conky.config = {
– Conky settings
background = true,
update_interval = 1,
double_buffer = true,
no_buffers = true,
imlib_cache_size = 10,
window = 'specifications',
gap_x = 5,
gap_y = 0,
minimum_width = 20, minimum_height = 0,
maximum_width = 220,
alignment = 'top_right',
own_window = true,
own_window_type = 'normal',
own_window_transparent = false,
own_window_argb_visual = true,
own_window_argb_value = 80,
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager',
–own_window_type normal
–own_window_transparent no
–own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
–own_window_argb_visual yes
–own_window_argb_value 0
border_inner_margin = 0,
border_outer_margin = 0,
graphics = ‘settings’,
draw_shades = false,
default_shade_color = '#484848',
draw_outline = false,
default_outline_color = '#dddddd',
draw_borders = false,
draw_graph_borders = false,
default_graph_width = 40, default_graph_height = 80,
show_graph_scale = true,
show_graph_range = false,
text = 'settings',
use_xft = true,
xftalpha = 0,
font = 'Droid Sans:size=9',
text_buffer_size = 256,
override_utf8_locale = true,
useful = 'shortenings',
short_units = true,
pad_percents = 2,
top_name_width = 30,
color = 'scheme',
default_color = '#FFFFFF',
color1 = '#FFFFFF',
color2 = '#2dcba5',-- teal
color3 = '#16a085',-- teal2
color4 = '#FFFFFF',
color5 = '#DCDCDC',
–DCDCDC
color6 = ‘#FFFFFF’,
color7 = ‘#FFFFFF’,
color8 = ‘#A9CFF4’,
–A9CFF4
– iphone wlp0s20u12
};
conky.text = [[
${if_existing /proc/net/route enp2s0} ${upspeedgraph enp2s0 30,50 efa644 ff5b00 3500 -l} ${alignr}${downspeedgraph enp2s0 30,50 88a669 55ff1a 10000 -l}${color }${font mitr:bold:size=2}
${font mitr:bold:size=9}Up: ${upspeed enp2s0} ${alignr}Dn: ${downspeed enp2s0}${endif} ${if_existing /proc/net/route wlp0s20u12}WiFi${upspeedgraph wlp0s20u12 50,125 efa644 ff5b00 3500 -l} ${alignr}${downspeedgraph wlp0s20u12 50,125 88a669 55ff1a 10000 -l}
${color }Up: ${upspeed wlp0s20u12} Σ=${totalup wlp0s20u12}${alignr}Dn: ${color8}${downspeed wlp0s20u12} Σ=${totaldown wlp0s20u12}${endif} ${if_existing /proc/net/route wlp0s20u11} ${upspeedgraph wlp0s20u11 50,125 efa644 ff5b00 3500 -l} ${alignr}${downspeedgraph wlp0s20u11 50,125 88a669 55ff1a 10000 -l}
${color }Up: ${upspeed wlp0s20u11} Σ=${totalup wlp0s20u11}${alignr}Dn: ${color8}${downspeed wlp0s20u11} Σ=${totaldown wlp0s20u11}${endif} ]];
So now to see if it works on my ‘processes’ conky