The original poster never stated what Conky is being used that is to be converted to display 24-hour time. Without knowing that I will presume it is the default Conky for MX-23. This is how I converted that Conky in a Live MX-23.4 (Xfce) to display 24-hour time. If another Conky is being used then please advise the name.
The default Conky for MX-23 is "MX-Cowon_MildBlue" so that is what I used. If you want an easier solution then just copy the entire Conky code for that Conky, which is the result of the edits I made as shown below. That is in the last code window below, and paste it into a new file in the directory that contains the original (default) Conky. I suggest you name it anything other than the default name so you can easily identify it in the Conky Manager.
Edit the Conky file, starting at the line below the beginning of the Conky text, like this:
1. After the first line of the Conky text
conky.text = [[, delete the four lines below it. Those four lines to delete are:
- ${if_match "${lua time A}" == "${time %A}"}${lua set_time A}\
- ${else}${lua set_time a}${endif}\
- ${if_match "${lua time B}" == "${time %B}"}${lua set_time B}\
- ${else}${lua set_time b}${endif}\
2. Now delete the line
${lua hours} and put
${time %H} in its place. Note that the "H" in strftime code means "The hour as a decimal number using a 24-hour clock". In other words, this will produce a 00-24 hour display, based on the system time.
To summarize Steps 1-2 above, the first four lines of the Conky text should now look like this:
Code: Select all
conky.text = [[
${voffset -176}
${time %H}
${color2}${offset 36}${voffset -95}${time %M}
3. Now that the Conky is displaying 24-hour time, the AM/PM text should be removed since it is not needed. To do that:
- Remove the AM/PM text to the right of the time. To do that simply comment out the line ${color2}${lua AM_PM} (this is done by putting the number symbol (#) at the start of the line so it looks like # ${color2}${lua AM_PM} (or you can just delete that line, but then remember to adjust the below two line numbers by -1).
- On Line 97 change the "offset" value from 150 to 0.
This moves the hour and minute numbers to the right to make up for the removal of the "AM/PM" text.
- On Line 105: change the "voffset" value from 160 to 180.
This moves the "hdd" line below the date line.
Note that those are the line numbers AFTER Steps 1-2 have been done.
The completed text of the "MX-Cowon_MildBlue" Conky file (Steps 1-3 above) is in the below code window. Copy that into another Conky file and it will appear as another Conky for use in the Conky Manager.
Code: Select all
conky.config = {
--#####################
-- - Conky settings - #
--#####################
update_interval = 1,
total_run_times = 0,
net_avg_samples = 1,
cpu_avg_samples = 1,
imlib_cache_size = 0,
double_buffer = true,
no_buffers = true,
--####################
-- - Text settings - #
--####################
use_xft = true,
font = 'Roboto-Light:size=100',
override_utf8_locale = true,
text_buffer_size = 2048,
xftalpha = 0.9,
--############################
-- - Window specifications - #
--############################
own_window_class = 'Conky',
own_window = true,
own_window_type = 'normal',
own_window_transparent = true,
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
--own_window_argb_visual yes
--own_window_argb_value 100
alignment = 'top_right',
gap_x = 40,
gap_y = 40,
minimum_width = 200, minimum_height = 220,
--########################
-- - Templates - #
--########################
template1 = '${color4}${font RobotoMono-Light:bold:pixelsize=12}${offset 8}',
template2 = '${offset 4} ${color4}batt${offset 6}',
--########################
-- - Graphics settings - #
--########################
draw_shades = false,
--hour
default_color = 'aabbcc',
default_shade_color = '1d1d1d',
color0 = 'ffffff',
--date
color1 = 'aabbcc',
--min
color2 = '77ddff',
--text
color3 = '77ddff',
--percentages
color4 = 'aabbcc',
--lua_load ~/.conky/conkybg.lua
--lua_draw_hook_pre conky_draw_bg
own_window_argb_value = 0,
own_window_argb_visual = true,
own_window_colour = '000000',
lua_load = 'lua/conky.lua',
};
-- fluxbox adjustment
-- if os.getenv("XDG_SESSION_DESKTOP") == 'fluxbox' then
return_code = os.execute('pidof -q fluxbox')
if _VERSION == 'Lua 5.1' and math.floor(return_code/256) == 0 or
_VERSION ~= 'Lua 5.1' and return_code then
conky.config.own_window_transparent = true
conky.config.own_window_argb_visual = false
end
conky.text = [[
${voffset -176}
${time %H}
${color2}${offset 36}${voffset -95}${time %M}
${voffset -130}${offset 10}\
${if_match "${lua cjk}" == "false"}\
${font Roboto-Light:bold:size=12}\
${else}\
${font wqy-microhei:bold:size=12}\
${endif}\
${color1}${lua date}
${offset 0}${voffset -175}\
${if_match "${lua cjk}" == "false"}\
${font Roboto-Light:size=12}\
${else}\
${font wqy-microhei:size=12}\
${endif}\
# ${color2}${lua AM_PM}
#system
${offset 0}${voffset 180}\
${font Roboto-Light:bold:pixelsize=14}${offset 12}${color3}hdd \
${offset 2}${color4}\
${font RobotoMono-Light:bold:pixelsize=12}${fs_used_perc /}%\
${font Roboto-Light:bold:pixelsize=14}\
${offset 4}${color3} mem \
${offset 2}${color4}\
${font RobotoMono-Light:bold:pixelsize=12}${lua memperc}%\
${font Roboto-Light:bold:pixelsize=14}\
${offset 2}${offset 4}${color3}cpu\
${color4}${font RobotoMono-Light:bold:pixelsize=12}${lua cpu}%\
#battery
${offset 0}${voffset 10}\
${if_existing /sys/class/power_supply/BAT0/present/ 1}${template1}
${template2}${battery_bar 8,80 BAT0} ${battery_percent BAT0}% ${endif}\
${if_existing /sys/class/power_supply/BAT0}${template1}
${template2}${battery_bar 8,80 BAT0} ${battery_percent BAT0}% ${endif}\
${if_existing /sys/class/power_supply/BAT1}${template1}
${template2}${battery_bar 8,80 BAT1} ${battery_percent BAT1}% ${endif}
${voffset -190}
]];
The below screenshot is the result of the above, showing how the "MX-Cowon_MildBlue" Conky looks displaying 24-hour time, showing 21:00 (9:00 PM):
MX-Cowon_MildBlue_Conky_24-hr_Modification.png